You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on May 20, 2021. It is now read-only.
Any guidance on how to support back behavior with the browser back button?
Since the switch navigator is the only available option on web, the browser back button event will pop a historical URL without the browser application responding as a forward navigation.
Pressing browser back button always triggers a Navigation/NAVIGATE to the currently active Tab(i.e. Stack Navigator) instead of to the previous Screen on the stack. Like in the following screen shot where I box the Screen in the stack that I should have been taken to:
Let me know if you need more info @ericvicenti . This is roughly what I'm using currently version-wise for native/web(p.s. using react-native-web and createBrowserApp for web):
@ericvicenti It appears that what is really happening is that entire chain of actions is created to direct the User to the screen in the history just before the current one. To simulate going back. However this only works for my:
MyHome - Stack Navigator
MySearch - Stack Navigator
MyShopping - Stack Navigator
The other two Stack Navigators that are being used fail to complete all of the chained navigation actions. Or some of the actions are invalid:
MyProfile - Stack Navigator
MySettings - Stack Navigator
Not sure what to exactly provide. Each navigator is created in the exact same way. Haven't been able to find the culprit in those latter two Stack Navigators that would be causing the back navigation to fail. One thing that does stand out is that the NotificationScreenProfile route name in one of the actions is not a route that exists in my app.
@ericvicenti Figured out the NotificationScreenProfile . We have a separate set of routes where the route names are prefixed with NotificationScreen for in-app/push notification navigation. So there will be a Profile and NotificationScreenProfile named routes that point to the Profile.js screen. Still not sure how it's picking.
Activity
ericvicenti commentedon Dec 29, 2018
Your issue seems quite valid but I can’t think of the exact use case. Can you give me a more complete example, perhaps with some code I can run?
509dave16 commentedon Mar 12, 2020
@ericvicenti @toddpi314 Having the same problem with a navigation structure that roughly looks like this.
Switch Navigator -> Custom Tab Navigator -> Stack Navigator
Pressing browser back button always triggers a
Navigation/NAVIGATEto the currently active Tab(i.e. Stack Navigator) instead of to the previous Screen on the stack. Like in the following screen shot where I box the Screen in the stack that I should have been taken to:Let me know if you need more info @ericvicenti . This is roughly what I'm using currently version-wise for native/web(p.s. using
react-native-webandcreateBrowserAppfor web):509dave16 commentedon Mar 13, 2020
@ericvicenti It appears that what is really happening is that entire chain of actions is created to direct the User to the screen in the history just before the current one. To simulate going back. However this only works for my:
MyHome - Stack Navigator
MySearch - Stack Navigator
MyShopping - Stack Navigator
The other two Stack Navigators that are being used fail to complete all of the chained navigation actions. Or some of the actions are invalid:
MyProfile - Stack Navigator
MySettings - Stack Navigator
Not sure what to exactly provide. Each navigator is created in the exact same way. Haven't been able to find the culprit in those latter two Stack Navigators that would be causing the back navigation to fail. One thing that does stand out is that the
NotificationScreenProfileroute name in one of the actions is not a route that exists in my app.509dave16 commentedon Mar 13, 2020
@ericvicenti Figured out the
NotificationScreenProfile. We have a separate set of routes where the route names are prefixed withNotificationScreenfor in-app/push notification navigation. So there will be aProfileandNotificationScreenProfilenamed routes that point to theProfile.jsscreen. Still not sure how it's picking.