Extra calls onNavigationStateChange in WebView on Android
Extra calls onNavigationStateChange when update window.location attributes values in WebView on Android RN - 0.17. For example:
- update value of window.location.hash - 2 calls of onNavigationStateChange;
- update value of window.location.search - 3 calls of onNavigationStateChange.
On IOS platform all fine 1 call of onNavigationStateChange in this cases.
Hey barbarosh, thanks for reporting this issue!
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
- If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag
react-nativeor for more real time interactions, ask on Discord in the #react-native channel. - If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
- We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using, as well as the platform you're on e.g.- Android, iOS. Thank you for your contributions!
Can you submit a pull request to fix this please? :smile:
Otherwise it's not likely to be fixed very soon
I shall investigate and try fix. :)
Awesome @barbarosh! Looking forward to it. Feel free to submit a PR with whatever you manage to figure out and we can take it from there. Any code is better than no code! :)
+1
I faced this problem multiple times since I was intensively using WebView for my application. I've yet to deep dive into the WebView Android wrapping implementation but for now anyone that had this problem can try filtering the events using setState inside onNavigationStateChange and handle shouldComponentUpdate or using some other way of setting flags.
You can also use InteractionManager in some scenarios to go around this problem.
@brentvatne @barbarosh sorry to disturb you but has there been any investigation on this?
@barbarosh just for ping.
try to wrap your javascripts in this block
function main() { your scripts here}
if (window.loaded) { main(); } else { window.onload = main; }
Still seeing this at 0.26.3.
I'm also facing this issue plz suggest when you get resolve it
Another one here ,I ended hooking up debugging and seeing all the callbacks being triggered. Found that onLoadStart and onLoad was only being called once for the url I wanted to act upon. So switched my logic over from onNavigationStateChange to onLoadStart.
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
- Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
- If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
- Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
This is still happening on version 0.50 I believe.
Still an issue in 0.51
Please open a new issue, as the original post in this thread was created prior to us settling on the current template.
Still facing this issue in 0.51