Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView onMessage listener conflict with window.postMessage to iFrame #19866

Closed
danielang opened this issue Jun 24, 2018 · 2 comments
Closed
Labels
Component: WebView Related to the WebView component. Resolution: Locked This issue was locked by the bot.

Comments

@danielang
Copy link

danielang commented Jun 24, 2018

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.11.3
Yarn: 1.7.0
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.1 AI-173.4670197

Packages: (wanted => installed)
react: 16.3.2 => 16.3.2
react-native: 0.55.4 => 0.55.4

Description

This issue affects both iOS and Android.

The issue relates to how using onMessage on WebView appears to affect post messages from the actual web app which wants to send out messages to an iFrame.
It appears the listeners which is being picked up by react native app isn't being picked up within the web page itself - as if the onMessage is conflicting with natural behaviour within the web page.

Example wise, any simple WebView with onMessage prop and handler defined.
A web page which has its own postMessage e.g.

window.postMessage('example message', origin);

where origin is simply the origin of the url.

Is there reason for this potential conflict and why react native is not respecting the origin? Disabling onMessage on the web view works for the iFrame perfectly.

Reproducible Demo

This demo shows two WebViews (content from playbuzz.com) with the exact same configuration. But one has onMessage set.
https://snack.expo.io/HyG0CXAZm

@react-native-bot react-native-bot added the Component: WebView Related to the WebView component. label Jun 24, 2018
@nsams
Copy link

nsams commented Jul 12, 2018

see #18546

@jamonholmgren
Copy link
Collaborator

Migrated to react-native-webview/react-native-webview#20 and can be closed.

@kelset kelset closed this as completed Sep 24, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Sep 24, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: WebView Related to the WebView component. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants