$ yarn add react-native-pigeon
or
$ npm install react-native-pigeon --save
$ react-native link react-native-pigeon
import Pigeon from 'react-native-pigeon';
Pigeon.setup({ publicKey: 'your_public_key' });
Pigeon.setCustomerToken('customer_token_here');
- Note that
setCustomerToken
must be called beforetrack
otherwise track won't work.
import Pigeon from 'react-native-pigeon';
// After Pigeon.setup and Pigeon.setCustomerToken
Pigeon.track('demo_event', { hello: 'world' } /* Event data */);
import Pigeon from 'react-native-pigeon';
// After Pigeon.setup and Pigeon.setCustomerToken
Pigeon.onMessageReceived(({ notification, data }) => {
const { title, body } = notification;
// Do something with data, title and body
});