File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import { StyleSheet } from 'react-native' ;
2+ import { StyleSheet , Linking } from 'react-native' ;
33import { WebView } from 'react-native-webview' ;
44import PropTypes from 'prop-types' ;
55import { isJsonString , storeHelper , generateScripts , getMessage } from './utils' ;
@@ -45,6 +45,15 @@ const WebViewComponent = ({
4545 customAttributes,
4646 } ) ;
4747
48+ const onShouldStartLoadWithRequest = ( request ) => {
49+ if ( request . url !== widgetUrl ) {
50+ Linking . openURL ( request . url ) ;
51+ return false ;
52+ }
53+
54+ return true ;
55+ } ;
56+
4857 return (
4958 < WebView
5059 source = { {
@@ -74,6 +83,7 @@ const WebViewComponent = ({
7483 domStorageEnabled = { true }
7584 style = { styles . WebViewStyle }
7685 injectedJavaScript = { injectedJavaScript }
86+ onShouldStartLoadWithRequest = { onShouldStartLoadWithRequest }
7787 scrollEnabled
7888 />
7989 ) ;
You can’t perform that action at this time.
0 commit comments