Problem
RootTabNavigator
| Auth Screen
| Welcome Screen
| MainTabNavigator
| FeedStacknavigator
| Screen A
| MenuStackNavigator
| Screen B <-I'm here and want to reset to 'Auth Screen'
The tree structure shows my app's Navigation structure. I'm on 'Screen B' and would like to go back to Auth Screen. (NOT Navigate) When I navigate to Auth Screen, it create new Auth Screen and I want to avoid it.
if ( ... ) {
// I'm getting undefined error here
nextProps.navigation.reset('Autho');
Why is it not working?
Possible Solution1: reset
const resetAction = NavigationActions.reset({
index: 0,
actions: [
// getting error because auth screen is not in MenuStacknavigator.
NavigationActions.navigate({ routeName: 'Auth'})
]
})
this.props.navigation.dispatch(resetAction);
Possible Solution #2 :
const backAction = NavigationActions.back({
key: 'Autho'
})
# Back Action doesn't do anything
this.props.navigation.dispatch(backAction); # not working
Possible Solution #3 :
dispatch custom action. <- there were some solutions for StackNavigator but in my case it's TabNavigator.