I'm having trouble with preventing user from going back to splash screen. Previously when I was working with React Navigation 4 this is what I used
const resetAction = StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: "HomeScreen" })]
});
navigation.dispatch(resetAction);
But in React Navigation 5 the I've tried the code below with no success:
const resetAction = CommonActions.reset({
index: 0,
actions: [CommonActions.navigate({ name: screenName })]
});
navigation.dispatch(resetAction);
or this:
navigation.reset({
index: 0,
routes: [{ name: "HomeScreen" }]
});
I've also tried to set gestureEnabled
to false in both Stack.Screen
options
props or in Stack.Navigator
screenOptions
props, but I can still swipe right to go back to splash screen.
Does anyone have any workaround for this? Thank you.