react-native-push-notification
react-native-push-notification copied to clipboard
Handle navigation
hi guys. I want to handle navigation to another screen when I tap on the notification with condition the app is closed (not running). is there any way? I can handle navigation for foreground and background condition by calling NotificationServices.js in my home screen.
But when I tap on the notification when app is closed, the app is opened, but does not navigate to another screen.
My current flow for background condition is notification clicked, go to home, forwarded to designed screen. My current flow for foreground condition is notification clicked, forwarded to designed screen.
I use remote notification by FCM
Thanks.
you can delay with setTimeout
See react-navigation doc (if you use this lib): https://reactnavigation.org/docs/navigating-without-navigation-prop/#handling-initialization Then check "else" condition. You have to handle an "queue" until navigation ref is ready.
You can also check deep-linking doc to handle deep-link payload in your notification: https://reactnavigation.org/docs/deep-linking/#third-party-integrations
But it is not an issue about react-native-push-notification, it's more related to your navigation library.
what if i want to dispatch an action inside onNotification? That must be an issue about React- Redux. Right?
How can i get 'navigation' object in index.js ? because my push notification received in index.js so i want redirect on specific screen on click on.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.