react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Extra calls onNavigationStateChange in WebView on Android

Open barbarosh opened this issue 10 years ago • 17 comments

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.

barbarosh avatar Dec 23 '15 15:12 barbarosh

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-native or 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!

facebook-github-bot avatar Dec 23 '15 15:12 facebook-github-bot

Can you submit a pull request to fix this please? :smile:

Otherwise it's not likely to be fixed very soon

brentvatne avatar Dec 24 '15 22:12 brentvatne

I shall investigate and try fix. :)

barbarosh avatar Dec 24 '15 23:12 barbarosh

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! :)

brentvatne avatar Dec 24 '15 23:12 brentvatne

+1

guizmaii avatar Dec 28 '15 09:12 guizmaii

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.

ncnlinh avatar Feb 03 '16 06:02 ncnlinh

@brentvatne @barbarosh sorry to disturb you but has there been any investigation on this?

ncnlinh avatar Feb 03 '16 22:02 ncnlinh

@barbarosh just for ping.

terrysahaidak avatar Feb 06 '16 22:02 terrysahaidak

try to wrap your javascripts in this block

function main() { your scripts here}

if (window.loaded) { main(); } else { window.onload = main; }

jrwm avatar Mar 17 '16 15:03 jrwm

Still seeing this at 0.26.3.

aimbot avatar Jun 23 '16 23:06 aimbot

I'm also facing this issue plz suggest when you get resolve it

uc-asa avatar Oct 24 '16 09:10 uc-asa

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.

Dashue avatar May 11 '17 12:05 Dashue

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.

hramos avatar Jul 20 '17 21:07 hramos

This is still happening on version 0.50 I believe.

RLesser avatar Dec 01 '17 04:12 RLesser

Still an issue in 0.51

lacvapps avatar Dec 22 '17 06:12 lacvapps

Please open a new issue, as the original post in this thread was created prior to us settling on the current template.

hramos avatar Dec 22 '17 17:12 hramos

Still facing this issue in 0.51

faisalkhan1690 avatar Dec 27 '17 14:12 faisalkhan1690