I would like to create mobile app with react expo. I used webview at my app. I wanted to open ads link at webpage with onNavigationStateChange. But after opening ads link, at main app don’t be clickable. Is there anything I missed? Can you give me an idea please? Thank you in advance..
let webRef:any = React.createRef();
export default class App extends React.Component {
constructor(props:any) {
super(props);
webRef = React.createRef();
this.state = {
canGoBack: false,
url: '***'
}
}
render() {
return (
<View id='main'>
<View>
<WebView
ref={(ref) => webRef.current = ref}
style={{flex:1}}
pullToRefreshEnabled={true}
id='webmain'
source={{ uri: '***' }}
onMessage={(event) => {
console.log('event: ', event)
}}
onNavigationStateChange={(event) => {
if (!event.url.includes('***') && event.canGoBack == true) {
console.log(event.canGoBack);
webRef?.current.stopLoading();
this.setState({
canGoBack: event.canGoBack
});
Linking.openURL(event.url);
}
}}
/>
</View>
</View>
);
}
}