0.4.1 • Published 2 years ago

@angoralabs/angora-react-native v0.4.1

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

Angora

React Native SDK

Installation

npm install @angoralabs/angora-react-native

or

yarn add @angoralabs/angora-react-native

Installation Dependencies

Angora's React Native SDK uses react-native-device-info.

After installing Angora's React Native SDK, you should also install react-native-device-info.

Usage

init

At the index.js, import angora from @angoralabs/angora-react-native and call the init function.

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import {version as appVersion} from './package.json';
import {angora} from '@angoralabs/angora-react-native';

angora.init({
  token:
    'OGIyZTJmNGEtMzc4OS01NGE3LTg4ZTctZGJjMmVkZDU1MjdjOjIxODE4NzhmOGExNWEyM2YxOTI4MzFiMGEwYzRjZmUzZDFhNjIxNDM=',
  appName,
  appVersion,
});

AppRegistry.registerComponent(appName, () => App);

The init function expects and object containing:

  • token: your app key, which can be found on the integration session
  • appName: your app's name
  • appVersion: your app's version

AppState

Angora needs access to the AppState. At your root component, probably the App.js, add the AngoraAppState component, if it's a class component or just call the useAngoraAppState hooks, if it's a function component.

Function Component

import React, {useEffect} from 'react';

import {useAngoraAppState} from '@angoralabs/angora-react-native';

const App = () => {
  useAngoraAppState();

  return (
    // ...
  );
};

export default App;

Class Component

import React, {Component} from 'react';

import {AngoraAppState} from '@angoralabs/angora-react-native';

class App extends Component {

  render() {
    return (
      <AngoraAppState />
      // ...
    );
  }
};

export default App;

Attention

Without AngoraAppState or useAngoraAppState, the Angora React Native SDK won't be able to track sessions events.

Contributing

Not available yet.

License

MIT

0.4.1

2 years ago

0.4.0

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.6

2 years ago