如何将事件侦听器添加到React-Native 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}
/>
如果您有任何想法,请帮助我。 谢谢