componentDidMount(){ PushNotification.configure({ onNotification: function(notification) { console.log( 'NOTIFICATION:', notification ); // process the notification // required on iOS only (see fetchCompletionHandler docs: https://facebook.github.io/react-native/docs/pushnotificationios.html) notification.finish(PushNotificationIOS.FetchResult.NoData); }, }); }
// Initialize local notifications. static init(callback: (Object) => void) { PushNotification.configure({ onNotification: (notification) => { log("Notification: " + notification); callback(notification); // Required for iOS. notification.finish(PushNotificationIOS.FetchResult.NoData); }, popInitialNotification: false, /** * (optional) default: true * - Specified if permissions (ios) and token (android and ios) will requested or not, * - if not, you must call PushNotificationsHandler.requestPermissions() later */ requestPermissions: false, }) }
notification.finish(PushNotificationIOS.FetchResult.NoData); onRemoteNotificationIos(notification); return;