替代@javascriptinterface in react-native for webview addjavascriptinterface()

时间:2018-04-07 18:44:49

标签: react-native

我想将我现有的项目之一实现为react-native,项目具有webview,其中加载页面,在页面加载之后,在我的本机端通过以下方式调用的方法很少:

 @javascriptbridge (webview.addJavaScriptInterface(bridge,"Android").

现在,想要在本机做反应,我已经尝试过WebViewBridge lib但是我在使用它时遇到问题无法解决:

"import WebViewBridge from 'react-native-webview-bridge' 

我也使用了invoke(onMessage = {this.invoke.listener})和invoke.define(“myMethod”,myMethod),但是在页面加载后我的方法仍未被调用。

你能帮帮我吗?

0 个答案:

没有答案