Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何从给定url捕获事件以响应本机WebView_Reactjs_React Native_React Native Webview - Fatal编程技术网

Reactjs 如何从给定url捕获事件以响应本机WebView

Reactjs 如何从给定url捕获事件以响应本机WebView,reactjs,react-native,react-native-webview,Reactjs,React Native,React Native Webview,如何添加事件侦听器以响应本机WebView。例如,我如何从给定的url捕获事件,下面给出了我的代码,它不起作用 let INJECTEDJAVASCRIPT="window.addEventListener('callBack', function(event) {console.log(event,'lops')});true;" <WebView key={this.state.key}

如何添加事件侦听器以响应本机WebView。例如,我如何从给定的url捕获事件,下面给出了我的代码,它不起作用

     let  INJECTEDJAVASCRIPT="window.addEventListener('callBack', function(event) {console.log(event,'lops')});true;"

         <WebView
            key={this.state.key}
            ref={(ref) => { this.webview = ref; }}
            source={{uri:this.state.url || this.props.url}}
            javaScriptEnabled = {true}
            domStorageEnabled = {true}
            startInLoadingState={false}
            showsHorizontalScrollIndicator={false}
            showsVerticalScrollIndicator={false}
            injectedJavaScript={INJECTEDJAVASCRIPT}
            style={styles.web}
           
          />
let INJECTEDJAVASCRIPT=“window.addEventListener('callBack',function(event){console.log(event,'lops')),true
{this.webview=ref;}}
source={{uri:this.state.url | | this.props.url}}
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={false}
showshorizontalscrolindicator={false}
showsVerticalScrollIndicator={false}
injectedJavaScript={injectedJavaScript}
style={styles.web}
/>
如果你有什么想法,请帮帮我。。
谢谢

您想要收听哪种类型的事件..?来自Web的自定义事件请解释更多关于您的问题/我如何从给定的webview url捕获事件您想要收听哪种类型的事件..?来自Web的自定义事件请解释更多关于您的问题/我如何从给定的webview url捕获事件