Reputation: 1014
I'm trying to link between two different stack navigators and get back to initial state on the first stack from the second stack. Let me know if there is a possible way to do so.
Upvotes: 0
Views: 90
Reputation: 1014
I figured this out. So my route was stack navigator -> tab navigator -> stack navigator. and when I was trying to navigate back to the first stack navigator from the third one I tried passing screen props thinking it would go to the first stack navigator but it ended up going to the tab navigator.
all that I had to do was pass this.props.navigation as screen props from tab navigator.
Upvotes: 0
Reputation: 10761
It's hard to answer the question with so little information, but if you're just looking for a way to reset to the root this should work.
navigation.dispatch(
StackActions.reset({
index: 0,
key: null,
actions: [
NavigationActions.navigate({
routeName: routes.ROOT,
}),
],
})
);
Replace routes.ROOT
with your root route.
Upvotes: 1