React-router history pushes / replaces not triggering webview events unless links are clicked twice
See original GitHub issueBug description:
On Android, when navigating on our React web app, running inside a react-native-webview, no navigation events are triggered, unless you click the link twice.
Adding the workarounds previously found in Guide.md
(shimming the history methods) works, but I was under the impression this shouldn’t be necessary.
The page I’m working with doesn’t use react-router
directly but it uses the same underlying library (ReactTraining/history) and I can confirm the problem exists with react-router as well.
To Reproduce:
Load this codesandbox (it’s one of the react-router demo pages): https://bnpsd.csb.app/ in a react-native-webview Click around
Expected behavior:
Navigation events (like onNavigationStateChange
) are called.
Environment:
- OS: Android
- OS version: 9 / 10
- react-native version: 0.61.4
- react-native-webview version: 8.0.3
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:10
Top Results From Across the Web
React-router history pushes / replaces not triggering webview ...
On Android, when navigating on our React web app, running inside a react-native-webview, no navigation events are triggered, unless you click ...
Read more >React history.push() is updating url but not navigating to it in ...
Once your custom history object is passed in via Router's history prop, history.push should work just as expected in anywhere of your app....
Read more >React Navigation - Ionic Framework
The React Navigation guide covers routing in an app built with Ionic and React. Learn to define a redirect path for router links...
Read more >Interact programmatically with the Navigation component
The Navigation component provides ways to programmatically create and interact with certain navigation elements.
Read more >Framework7 Release Notes
Router. Fixed swipe-back issues on iOS 14. Device. Fixed iOS detection for newest iPads. Svelte. ListInput, Input. Fixed not working TextEditor events.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This problem is not solved. Can this issue be opened again?
Although this is an old thread, maybe it’s helpful for others. It appears that
onNavigationStateChange
is not called on Android when the app uses historypushState
andpopState
when navigating back in history. On iOS it is being called just fine. I noticed thatonLoadProgress
is called in both platforms so what I did was to use both like this: