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
Post a Comment