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

How can I use PUSHER with React Navigation?

Open dillonvuong opened this issue 3 years ago • 2 comments
trafficstars

When I click on the notification it brings me to the main screen of my app. How can I use it to navigate to the specific page that I want it to be on? I am using a stack navigator.

dillonvuong avatar Dec 27 '21 23:12 dillonvuong

Hi,

I needed the same functionality.

I now used drawer navigator to fix this.

I'm using a custom drawer component :

<Drawer.Navigator initialRouteName="Login" screenOptions={{ gestureEnabled: false }} drawerContent={(props) => <CustomDrawerContentComponent {...props} />}>

and inside my CustomDrawerContentComponent I created my notificationHandler (it's just a component with register and handlenotification functions) and I pass the navigation props to this.

<NotificationHandler navigation={props.navigation} />

Now I can get navigation in my handlenotification function

I don't know if we can do better

arochedy avatar Jan 11 '22 14:01 arochedy

Thanks arochedy! Will this work with a Stack Navigator? I mean were u originally using a Stack Navigator then switched to a Drawer Navigator? I can try with the Drawer Navigator too

dillonvuong avatar Jan 12 '22 21:01 dillonvuong