-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Description
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:
- Run app
- Click on
Alice
orBob
link - Press
Show random contact
button - Wait for new page to load
- Repeat steps 3 and 4
- 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