ex-navigation-recipes
ex-navigation-recipes copied to clipboard
Handle navigation from push notification
Hi @sibelius , any idea how to do navigation when receiving data from push notification? You can take at look here: https://github.com/geektimecoil/react-native-onesignal#android-usage Basically, i need to do navigation outside component because i should configure OneSignal outside for trigger the OneSignal's function onNotificationOpened.
I think there are 2 approach to solve this problem:
1 - use redux to send actions to ex-navigation when u receive a push notification 2 - have a component that render nothing, and have the one signal configuration inside of it, something like this: https://github.com/fbsamples/f8app/blob/master/js/PushNotificationsController.js
I'll try to add a recipe for this later on
Thank you for the suggestion. I'll take a look at f8 project while looking for your recipe. But i've already tried configuring oneSignal on componentDidMount but the listener was not triggered..
i already tried to configure oneSignal inside component that render nothing but it's not triggered unless i configure oneSignal outside the class/component.
do u have a repo example using a component that render null, like in f8app ?
maybe this help https://github.com/exponent/ex-navigation#perform-navigation-actions-from-outside-of-a-component
hi @sibelius , apparently the event was not being called because i did some checking when app started. After i removed it, it works like i expected. Thank you for the suggestion to create separate push notification controller like f8app
Awesome, could u send a recipe to fix this?