Description
I'm receiving this error (same as screenshot below):
Setting onMessage on a WebView overrides existing values of window.postMessage,
but a previous value was defined.

That specific error message is found in the code base here: https://github.com/facebook/react-native/blob/master/React/Views/RCTWebView.m#L286
Implementation
I followed the example at this link for onMessage at this link: http://facebook.github.io/react-native/releases/0.37/docs/webview.html#examples
I made a callable respondToOnMessage and injected some JavaScript.
class MessagingTest extends React.Component {
respondToOnMessage = e =>{
console.log(e);
};
render() {
const jsCode = `window.postMessage('test');`;
return (
<WebView
injectedJavaScript={jsCode}
source={uri: 'https://www.foo.com/'}}
onMessage={this.respondToOnMessage}
/>
)
}
}
Reproduction
I load the app with this example and I have it pointed to a website (rather not say which one. Sorry.) And the website is emitting 2 errors into the Chrome console when I go there.
(index):994 A Parser-blocking, cross-origin script, http://example.com/thing.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity.
widgets.js:8 Uncaught TypeError: Cannot set property '[object Array]' of undefined(…)
Other websites like google.com and github.com are just fine. If you want to replicate it, change the uri to yahoo.com
Additional Information
- React Native version: 0.37
- Platform: iOS 10.1, iPhone 6 emulator
- Operating System: Mac OSX Sierra 10.12.1
Description
I'm receiving this error (same as screenshot below):
That specific error message is found in the code base here: https://github.com/facebook/react-native/blob/master/React/Views/RCTWebView.m#L286
Implementation
I followed the example at this link for onMessage at this link: http://facebook.github.io/react-native/releases/0.37/docs/webview.html#examples
I made a callable
respondToOnMessageand injected some JavaScript.Reproduction
I load the app with this example and I have it pointed to a website (rather not say which one. Sorry.) And the website is emitting 2 errors into the Chrome console when I go there.
Other websites like google.com and github.com are just fine. If you want to replicate it, change the
urito yahoo.comAdditional Information