Yes
Yes
Environment:
OS: macOS Sierra 10.12.6
Node: 6.11.2
Yarn: 0.15.1
npm: 3.10.10
Watchman: 4.9.0
Xcode: Xcode 8.2 Build version 8C38
Android Studio: 2.2 AI-145.3537739
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3 (reproduced in react-native: 0.54.2, 0.55.4)
Newly clicked url stops loading
Url keeps loading
export var TestWebContentView = createReactClass( {displayName: 'TestWebContentView',
handleNavigationChange: function(navState) {
console.log(navState)
this.webview.stopLoading();
}
},
render: function() {
return (
<View style={rootViewStyle} >
<WebView
ref={(ref) => { this.webview = ref; }}
scrollEnabled={false}
source={{uri: 'http://www.simplehtmlguide.com/livedemo.php?e=youtube2' }}
startInLoadingState={false}
mixedContentMode={'always'}
scalesPageToFit={false}
onNavigationStateChange={this.handleNavigationChange}
allowsInlineMediaPlayback={true}
automaticallyAdjustContentInsets={false}
/>
</View>
)
}
})
I'm quite stumped by this, since it was working a week or so ago on the same Android device, on react-native 0.44. However, I reverted the react-native version back to 0.44 and it's still not working. Might a Chrome update be responsible? iOS version appears to work.
same problem,how to fix it
I had this issue on iOS, when trying to get an external link to stop loading in the webview and launch SafariView (via react-native-safari-view). I solved it (again, in iOS) by moving the relevant code to onShouldStartLoadWithRequest instead of onNavigationStateChange. My understanding is that onNavigationStateChange takes place too late in the lifecycle, so calling stopLoading does nothing.
How to fix it for both iOS & Android?
Since onShouldStartLoadWithRequest does not exist on Android and stopLoading does not work now inside onNavigationStateChange, there's no way at the moment to catch a link of page and process something else inside the App without opening that link... :(
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?
I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.
Still an issue in v0.53.0!
Still same issue in Android in v0.53.3
Reopening as have seen various reports of this happening in 0.54
I've updated the original post with additional information from #18047
It looks like stopLoading was added by the community in commit 774296b26349dbf6a1a0ccb1a870e3038ea2e046. I'll mark this as the community's responsibility. Note that there's an issue open with discussion on what should be done about WebView here: https://github.com/facebook/react-native/issues/321
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?
Thank you for your contributions.
Can confirm that this is still not working in 0.55.4
still not work in 0.56 for some URL
Migrated to https://github.com/react-native-community/react-native-webview/issues/8 and this issue can be closed.
can confirm that still not working in "react-native": "^0.57.4"
Most helpful comment
Can confirm that this is still not working in 0.55.4