Reputation: 208
Hello everyone i am new to react-native and stuck in a navigation problem. i have crawled through every question about this but found nothing helpful.
I have Navigation structure like this
Tab Navigator
HomeStack [mainScreen,Screen2]
PostStack[cameraScreen,UploadPostScreen]
Now i want to navigate to MainScreen of HomeStack after uploading the Post and along with that i want to remove these post and upload screen so that i can not go back by pressing back button.
Upvotes: 1
Views: 2936
Reputation: 1145
in my case,
I have just used
props.navigation.reset({
index: 0,
routes: [
{
name: 'Login'
}
]
});
Upvotes: 1
Reputation: 146
You need to use replace
method in that case, take a look here:
https://reactnavigation.org/docs/stack-actions/#replace
Upvotes: 5