Closed dlombardi closed 6 years ago
found a temporary fix that worked for me:
in componentDidMount
of root-most component add:
AppState.addEventListener('change', (state) => {
if (state === 'active') {
PushNotification.popInitialNotification((notification) => {
if (notification) {
Alert.alert(JSON.stringify(notification));
// onNotification(notification);
}
});
PushNotification.setApplicationIconBadgeNumber(0);
}
});
EDIT: this actually does NOT work. this just shows the same notification used to launch an app from a cold-start every time the app gets reopened while it exists in the background. In other words -- if you use a push notification to cold start an application all subsequent push notifications will be that same notification if the app is opened while it is in the background.
@dlombardi I looked in to this more and I have a couple of suggestions.
First off please pull the latest version. Once you do that, you'll notice that I added an additonal method called appStart().
In the componentDidMount of your most top level react component, go ahead and call that appStart() and you should get the notification they tapped on.
If you don't, go in to xcode and make sure that you've enabled background mode and checked push notifications
@dlombardi can you verify that you are working now?
Closing this issue since I haven't heard back. Feel free to post back and reopen if you're still having issues
platform: iOS 11.3 device: iPhoneX
problem: the onNotification callback is not triggered when navigating to backgrounded app from push notification.
desired behavior: navigating from a push notification to a backgrounded application will trigger the onNotification callback with the notification as an argument.