question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onNavigationStateChange 'Not working in Andriod' while working fine on iOS.

See original GitHub issue

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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sterlingwescommented, Dec 13, 2018

(someone with permissions should fix the tag - this is an android issue)

0reactions
kelsetcommented, Dec 13, 2018

As pointed out by @sterlingwes, WebView now lives in its own repo: please open an issue in that repo 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

onNavigationStateChange not working in Android React ...
If it is a single page application then the navigationStateChange event will not be triggered for the internal links. – needsleep. Apr 25,...
Read more >
onNavigationStateChange is not working on Android in ...
On iOS it works perfectly. It is no normal # tag url change, it is a real change from /home to /dashboard. import...
Read more >
onNavigationStateChange not working in Android React ...
Coding example for the question onNavigationStateChange not working in Android React ... not working in React native iOS, but perfectly fine in Android...
Read more >
React Native WebView: A complete guide
This package will work both on Android and iOS devices. ... Well, React Native WebView also offers a solution for this problem!
Read more >
onnavigationstatechange react native webview
JS is enabled by default for WebView on iOS. ... [Solved]-onNavigationStateChange not working in Android React Native Resize WebView to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found