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

WebViewBridge is undefined #40

Closed
lucars opened this issue Nov 30, 2015 · 5 comments
Closed

WebViewBridge is undefined #40

lucars opened this issue Nov 30, 2015 · 5 comments

Comments

@lucars
Copy link

lucars commented Nov 30, 2015

  • I install react-native-webview-bridge following the installation, and run Sample1 APP successfully.
  • Then I create a page using WebViewBridgeReady and WebViewBridge.send just like the Example.
  • I modify the Example trying to send message manually by press a button.
  • But the document listener WebViewBridge is not triggered, and nothing is sent when I'm pressing the button.

I'm trying to figure out what has happened, then i found window.WebViewBridge is always undefined. Is there any step I've missed?

@gre
Copy link

gre commented Dec 7, 2015

Same problem to me. The example does not log any "Received message".

@gre
Copy link

gre commented Dec 7, 2015

This bug is because the "pathForResource" doesn't work here:

screen shot 2015-12-07 at 14 58 57

Workaround:

copy webview-bridge-script.js into your own project folder in XCode...

@alinz
Copy link
Owner

alinz commented Dec 9, 2015

@lucars the native will manage the injection. so it is guarantee to have WebViewBridge object in global scope. Please try the new version. I have also updated doc with more details.

@gre I have ported the bridge script into objective c code so there won't be any manual work of adding webview-bridge-script.js as one of bundle.

Please reopen if you have this issue.

@alinz alinz closed this as completed Dec 9, 2015
@gre
Copy link

gre commented Dec 9, 2015

great work! thanks!

@lucars
Copy link
Author

lucars commented Dec 23, 2015

It works. Great job. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants