Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Root.js - part of my code
- <Provider {...stores}>
- <MainStack
- ref={ref => {
- if (ref) {
- AppStore.setMainNavigationRef(ref)
- // this.navigation_ref = ref._navigation
- }
- }}
- />
- </Provider>
- // AppStore (I'm using with mobx)
- @action setMainNavigationRef(main_navigation_ref) {
- this.main_navigation_ref = main_navigation_ref
- console.log('setMainNavigationRef', main_navigation_ref)
- }
- resetMainStack(routeName, params) {
- this.main_navigation_ref.dispatch(
- StackActions.reset({
- index: 0,
- actions: [
- NavigationActions.navigate({
- routeName,
- params,
- }),
- ],
- })
- );
- }
- }
- // UserProfile (child of tabStack)
- resetStack = () => {
- this.props.AppStore.resetMainStack('Auth', null)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement