Let's say we have this screen navigation case :
other previous screens -> A -> B -> C -> D
Now that we're in the Screen D, how can we go back directly to screen B and erase the screens D and C from the stack?
I'm using navigation.navigate(B, params), but then in the screen B when I click on the back button I'm back to screen D. The intent is to go to A.
Edit: I'm trying to use the reset action :
const resetAction = NavigationActions.reset({
index: 0,
actions: [previousNavigationActions, navigateActionToScreenB],
});
this.props.navigation.dispatch(resetAction);
How do I get the previous navigation actions from the navigation state?