We are using react-navigation as the default navigation system in our react native app, which currently has multiple stacks. We would like to navigate from a screen in one stack to a screen in another stack. This is a basic example of the different stacks:
const StackNavigator = createStackNavigator({
SplashScreen: connectToStore(SplashScreen),
},{
initialRouteName: 'SplashScreen',
mode: 'card'
})
const ModalNavigator = createStackNavigator({
LoginScreen: connectToStore(LoginScreen),
})
const AppNavigator = createStackNavigator({
StackNavigator: StackNavigator,
ModalNavigator: ModalNavigator,
}, {
initialRouteName: 'StackNavigator',
headerMode: 'none',
mode: 'modal'
})
The problem is if we try to reset to a new screen like so:
const resetAction = StackActions.reset({
index: 0,
key: null,
actions: [
NavigationActions.navigate({
routeName: 'LoginScreen',
})
]
});
this.props.navigation.dispatch(resetAction);
We get an error that says something like so:
ExceptionsManager.js:74 Error: There is no route defined for key DashboardScreen. Must be one of: 'StackNavigator','ModalNavigator'