-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
navigation.goBack() to previous page is impossible if that page was on another stackNavigator #4403
Comments
Hi! Can you create a reproducible example with Snack? Can you also follow the issue template? Thanks! |
updated. Ofc there is an hack, just call |
Possible Solution: Calling popToTop() before navigate, will clear the actual tab stack, and move the the old (routBack, passed as param) without drawback. |
Also, there is a graphical glitch when navigating from detailscreen1 to detailscreen2. edit: as react navigation blog say, we must use both navigate and push now, because of different use case. |
if you'd like to go back to the other tab right now you are right that you would need to use |
@ericvicenti went on to add:
tl;dr: this is working as expected. the docs need some better wording around another way you could handle this in your app is to pass the route info for the route you want to return to in the params when navigating to another route. then check if that param exists and go back there if so. |
Thanks for the reply! If you use navigate(), the function will not pop che old tab stack. ( when you use the tabBar to navigate, you will see the deepest stack instead of the initial) Sometimes it glitch, showing both popToTop and navigate animation, but this is the only working one. updated: |
@brentvatne is there a recommended solution for going "chronologically back" (i.e., "take me back to the last screen i was on") since |
@uladkasach Sounds like |
Change to |
@toancaro if you are still experiencing issues, I recommend checking out Reactiflux or Stack Overflow. Feel free to open a new issue if you believe this is a bug. |
Update: added snack and example
Your Environment
so, for eg, from Screen1 i call
navigation.navigate('detailScreen2')
using on detailScreen2
headerLeft: <GoBack onPress={() => navigation.goBack(null)} />
move me to Screen2 instead of screen1 .
In fact, goBack call stack2 (who call screen2 as default screen for the stack).
How to fix this? Because if i call
navigation.navigate('screen1')
, the screen stack will be still full, so when i will press on stack2 tab icon, the new screen will be detailScreen2 instead of screen2 (because of the old opened screen on stack2)Update:
snack
Easy example made from navigation playground.
On home Tab go to Profile page, after go to notification, then go back.
The back will move you to the true parent (settings screen) instead to the previous page (profile screen).
The text was updated successfully, but these errors were encountered: