Rn module webview bridge.
function callNative(inData){
window.postMessage( JSON.stringify(inData) )
}
btn2.addEventListener('click', (e) => {
callNative({
invoke:'do',
name:'msg',
data:{
content:'message from h5 by postMessage method btn2.'
}
});
});
const { webview } = this.refs;
webview.injectJavaScript('window.h5Method()')
_onLoadStart = e => {
const { webview } = this.refs;
const webviewParams = {
user_id:1234,
data:1234,
otherData:['123','23']
};
webview.injectJavaScript(`window.__PARAMS__ =${JSON.stringify(webviewParams)}`);
}