react-native-pusher-push-notifications icon indicating copy to clipboard operation
react-native-pusher-push-notifications copied to clipboard

navigate to specific screen after tap on notification

Open iamhaaamed opened this issue 2 years ago • 2 comments
trafficstars

How can we navigate the user to a specific screen when the user tap on notifications?

iamhaaamed avatar Jul 05 '23 18:07 iamhaaamed

You need to send a body on the notification from the backend or pusher "debug console" and then handle the notification on "handleNotification" function as it will show you the body of the alert

Sulaiman122 avatar Oct 06 '23 22:10 Sulaiman122

I'm having similar problem navigating due to the limitation discussed in https://github.com/b8ne/react-native-pusher-push-notifications/issues/97.

Since the instance and event listener has to be called at index.js, I have no access to navigation props to navigate user to certain screen. Have to follow this docs to implement the navigation

RNPusherPushNotifications.on('notification', (payload: any) => {
      console.log('PAYLOAD received', payload);
      if (payload.data.key === 'profile') {
        RootNavigation.navigate('Profile');
      }
    });

anniewey avatar Apr 29 '24 15:04 anniewey