React Native Remote Push Notifications Component
There's very little to say about this Module, it's name says a lot. It will let you handle Push Notifications in React Native.
react-native-remote-push
React Native module that allows you to:
- Request push notification permissions
- Get the device token back from the request
- Subscribe to remote push notifications
RemotePushIOS will listen out for remote notifications on startup or when your application is active. To receive these notifications in your code, you need to set a listener. Ideally you should set this on your top-level react component.
You can add a listener in the following way:
componentWillMount: function() {
// Add the listener when the component mounts
RemotePushIOS.setListenerForNotifications(this.receiveRemoteNotification);
},
receiveRemoteNotification: function(notification) {
// Your code to run when the alert fires
AlertIOS.alert(
'Notification received',
notification.aps.alert,
[
{text: 'OK', onPress: () => console.log('Ok pressed!')}
]
);
}