React-native: Proper way to route while notification is opened? -


my schema:

stacknavigator - home (view component) - main (tabnavigator) - - tab1 - - tab2

my code on app.js (root)

const resetaction = navigationactions.reset({             index: 1,             key: null,             actions: [                 navigationactions.navigate({ routename: 'home' }),                               navigationactions.navigate({                      routename: 'main',                     params: {changetotab: 'tab2'}                 })             ]         })         this.navigator.dispatch(resetaction) 

inside tabnavigator wrapper, use componentdidupdate navigate tab2 after getting changetotab param.

my purpose open tab2 after receiving openned notification. way work if app on root screen. if in tabnavigator, doesn't work.

i've tried use navigationactions.navigate brings worse result while stack more screen on existing 1 (not switch them).

so what's best way navigate screen wanted no matter screen user's viewing?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -