Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Webivew onNavigationStateChange method call multiple time in react native

$
0
0

I am making react native application and one screen I am used webview for that and I want to handle onNavigationStateChange props one time call right now it is calling multiple times so any idea how can I solve this issue. refer below code

<WebView 
         ref={r => this.webview = r}
         style={{width:globals.screenWidth, height:globals.screenHeight}}
         bounces={false}
         style={{ flex: 1 }}
         startInLoadingState
         scalesPageToFit
         javaScriptEnabledAndroid={true}
         javaScriptEnabled={true}
         domStorageEnabled = {true}
         onNavigationStateChange={data =>
            this.handleNavigationStateChange(data)
        }
         onLoadStart={() => {
             console.log("onLoadStart-->");
         }}
         onLoadEnd={() => {
            console.log("onLoadEnd-->");
         }}
         source={{uri: globals.MYURL}}
         onError={(error) => this.onError()}
        />


handleNavigationStateChange = navState => {
    console.log("navState >>>>" + JSON.stringify(navState));

};

When i run above code navState >>>> print 3 times I want to handle it 1 time so how can I solve this issue? Your all suggestions are appreciable.


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>