I am trying to return to two screens. The goal is to go from EditPageto Cover. Here is my navigation stack:
Main -> Cover -> EditCover -> EditPage
I read the docs and it says, to provide the screen key you want to return to, here is my code:
this.props.navigation.dispatch(NavigationActions.back({key: 'EditCover'}));
I also tried (no luck):
this.props.navigation.dispatch(NavigationActions.back('EditCover'));
this.props.navigation.dispatch(NavigationActions.back({key: 'EditCover'}));
this.props.navigation.dispatch(NavigationActions.back({routeName: 'EditCover'}));
this.props.navigation.goBack('EditCover');
this.props.navigation.goBack({key: 'EditCover'});
this.props.navigation.goBack({routeName: 'EditCover'});
The funny thing is that I get no errors. Nothing happens when the code is called ...
PS If I just want to return to one screen, this code works fine:
this.props.navigation.goBack(null);
PSS In case someone comes across this before there is a solution. This hack works now:
this.props.navigation.goBack(null);
this.props.navigation.goBack(null);
source
share