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
I am using react-router to build out a mobile PWA. The app uses tab navigation and has a traditional navigation bar at the top. I am using the data browser router and the <ScrollRestoration /> component.
This all works great on iOS and Android using their native system for going back to the previous screen (swipe gesture or physical/software back button).
However, I also have a back button in the navigation bar that I'd like to work in the same way. I cannot use navigate(-1) which may work as that would break the semantics of links, and each page has a specific backTo route. This also avoids the back button accidentally taking you tab to another tab (unavoidable if using native system but a tradeoff that is fine for now).
I cannot seem to find an API that does this though. I am kinda looking for this
// This would navigate to `/path` and restore the scroll position to what has been stored there.<Linkto="/path"restoreScroll={true}/>
I see there is prevent scroll reset which looks to be in the same vein, but not quite what I am after.
Is it possible to implement this or do I need to implement it myself? Ideally was hoping to use react-routers implementation.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
👋
I am using
react-router
to build out a mobile PWA. The app uses tab navigation and has a traditional navigation bar at the top. I am using the data browser router and the<ScrollRestoration />
component.This all works great on iOS and Android using their native system for going back to the previous screen (swipe gesture or physical/software back button).
However, I also have a back button in the navigation bar that I'd like to work in the same way. I cannot use
navigate(-1)
which may work as that would break the semantics of links, and each page has a specificbackTo
route. This also avoids the back button accidentally taking you tab to another tab (unavoidable if using native system but a tradeoff that is fine for now).I cannot seem to find an API that does this though. I am kinda looking for this
I see there is prevent scroll reset which looks to be in the same vein, but not quite what I am after.
Is it possible to implement this or do I need to implement it myself? Ideally was hoping to use
react-routers
implementation.Beta Was this translation helpful? Give feedback.
All reactions