Hi guys after a function call and its eventual callback I have to change the webview url but the error prints that this.webview is undefined, this is my code.
Into the function onMessage after I use postMessage from html I have to change the URL of the webview.
Help me and I will never stop thanking you
export default class WevViewApp extends Component {
constructor( props ) {
super( props );
this.webView = null;
}
onMessage( event ) {
if(registerToken){
//change url of my webview
}
}
render() {
return (
<View style={{flex: 1}}>
<WebView
ref={( webView ) => this.webView = webView}
style={{flex: 1}}
source={{uri: 'https://url.com/test123'}}
javaScriptEnabled={true}
injectedJavaScript={myInjectedJs}
onMessage={this.onMessage}
/>
</View>
);
}
}