Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView finishes with loading event #13279

Closed
farazs opened this issue Apr 3, 2017 · 4 comments
Closed

WebView finishes with loading event #13279

farazs opened this issue Apr 3, 2017 · 4 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@farazs
Copy link

farazs commented Apr 3, 2017

Description

I have noticed this with pages that use angular ui router but it's possible it happens in other cases as well. When switching states on a page with angular ui router, in a small percentage of loads, the last navigation state change event on Android has loading: true. If you use a loading indicator, this would cause it to show indefinitely.

This happens because some Android webview event is triggered, usually onPageFinished but the progress of the webview is not 100 so loading is set as true for the event.

I have encountered this on iOS as well but am unable to consistently reproduce. It occurs because webViewDidFinishLoad is called multiple times and in a small number of cases webView.loading is never false so we never send the finish event.

Reproduction Steps and Sample Code

Snack/Sketch link: https://snack.expo.io/SkaN34l6x
Github repo: https://github.com/farazs/webview-sample/tree/navigation_state_bug
Video: https://drive.google.com/file/d/0B9SwtBquHoExUkU1ckgxOHJzcWc/view?usp=sharing

Steps:

  1. Run app
  2. Click on Alice or Boblink
  3. Press Show random contact button
  4. Wait for new page to load
  5. Repeat steps 3 and 4
  6. Eventually the loading screen will stay on until you press another link

Solution

Either always set loading to false for onPageFinished or add an onProgressChanged method and send a navigation state change event for that as well.

Additional Information

  • React Native version: 0.42.3
  • Platform: Android and iOS
  • Development Operating System: MacOS
  • Dev tools: Android Studio 2.3 and Xcode 8.3.2

Reproduced on Samsung S5, S7 Edge and iPhone 6S

@chiraggshah
Copy link
Contributor

chiraggshah commented Apr 19, 2017

@farazs : I too am facing this issue. Were you able to fix or a possible workaround?

@farazs
Copy link
Author

farazs commented Apr 19, 2017

@chiraggshah I'll create a PR with my solution. Had to change some stuff in a fork

@farazs
Copy link
Author

farazs commented Apr 19, 2017

See #13586. You can cherry pick that onto a fork and use that for a fix in the meantime.

@farazs farazs changed the title [Android] WebView finishes with loading event WebView finishes with loading event Apr 26, 2017
@hramos
Copy link
Contributor

hramos commented Jul 25, 2017

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 hramos added the Icebox label Jul 25, 2017
@hramos hramos closed this as completed Jul 25, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Jul 25, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants