ex-navigation-recipes icon indicating copy to clipboard operation
ex-navigation-recipes copied to clipboard

Handle navigation from push notification

Open adrianha opened this issue 8 years ago • 7 comments
trafficstars

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.

adrianha avatar Jan 24 '17 11:01 adrianha

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

sibelius avatar Jan 24 '17 11:01 sibelius

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..

adrianha avatar Jan 24 '17 12:01 adrianha

i already tried to configure oneSignal inside component that render nothing but it's not triggered unless i configure oneSignal outside the class/component.

adrianha avatar Jan 25 '17 06:01 adrianha

do u have a repo example using a component that render null, like in f8app ?

sibelius avatar Jan 26 '17 19:01 sibelius

maybe this help https://github.com/exponent/ex-navigation#perform-navigation-actions-from-outside-of-a-component

sibelius avatar Jan 26 '17 19:01 sibelius

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

adrianha avatar Jan 30 '17 03:01 adrianha

Awesome, could u send a recipe to fix this?

sibelius avatar Jan 30 '17 08:01 sibelius