Hi i am using react native\'s webview to display some html, i want that whenever a user clicks a link inside that html, it will open the user\'s browser with that link.
Solution for those who use expo:
import * as WebBrowser from 'expo-web-browser';
import { WebView } from 'react-native-webview';
...
render() {
return (
{ this.webview = ref; } }
onNavigationStateChange={ (event) => {
if (event.url !== uri) {
this.webView.stopLoading();
WebBrowser.openBrowserAsync(event.url);
}
}}
/>
);
}
WebBrowser is installed via: expo install expo-web-browser