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.