onNavigationStateChange 'Not working in Andriod' while working fine on iOS.
See original GitHub issue- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
Run react-native info
in your terminal and paste its contents here.
System: OS: macOS 10.14 CPU: x64 Intel® Core™ i5-4278U CPU @ 2.60GHz Memory: 34.90 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.12.0 - /usr/local/bin/node Yarn: 1.9.4 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 Android SDK: Build Tools: 26.0.2, 27.0.3, 28.0.3 API Levels: 23, 24, 25, 27, 28 IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Xcode: 10.1/10O35n - /usr/bin/xcodebuild npmPackages: react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728 react-native: 0.57.3 => 0.57.3 npmGlobalPackages: create-react-native-app: 2.0.2 react-native-cli: 2.0.1
Description
I am having problem in getting the ‘onNavigationStateChange’ getting called in Andriod. It’s working pretty well in iOS. The scenario is that when we select the country in the WebView their is change In url based on which onNavigationStateChange gets called in iOS but not working in Andriod.
Reproducible Demo
Here is the code I am using :
<WebView ref=“webview” source={{ uri: this.state.url }} // onNavigationStateChange={this.handleNavigationStateChange} // // onShouldStartLoadWithRequest={this.onShouldStartLoadWithRequest} //for iOS // // onNavigationStateChange ={this.onShouldStartLoadWithRequest} //for Android // javaScriptEnabled = {true} bounces={false} domStorageEnabled = {true} // injectedJavaScript = {injectedJs} // javaScriptEnabledAndroid={true} // bounces={false} // startInLoadingState={false}
javaScriptEnabledAndroid={true}
javaScriptEnabled={true}
injectedJavaScript={injectedJs}
onNavigationStateChange={this.handleNavigationStateChange}
// startInLoadingState
// scalesPageToFit
// mixedContentMode= {'always'}
/>
I have tried all the commented code as well but nothing appears to work.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
(someone with permissions should fix the tag - this is an android issue)
As pointed out by @sterlingwes, WebView now lives in its own repo: please open an issue in that repo 😊