- React Native webView postMessa
- react-native-webview postMessage
- React Native react-native-webvie
- react-native-webview HTML和RN通信 互
- ReactNative WebView 与H5页面的交互
- 关于 React Native 与 WebView 的通信
- react-native-webview20-04-27
- Did not receive response to shou
- RN集成native-echarts报错:Invariant V
- react-native-webview的console.log
报错如下:
Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined.
IMG_2306.PNG
解决方法:
(function() {
var originalPostMessage = window.postMessage;
var patchedPostMessage = function(message, targetOrigin, transfer) {
originalPostMessage(message, targetOrigin, transfer);
};
patchedPostMessage.toString = function() {
return String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage');
};
window.postMessage = patchedPostMessage;
//业务代码
$("#header").hide();
$(".consultBtn").click(function(){
window.postMessage("gochat")
})
})();
网友评论