question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onMessage is not trigger on Android (working on iOS as well)

See original GitHub issue

<WebView style={{flex: 1}} javaScriptEnabled={true} domStorageEnabled={true} originWhitelist={[‘*’]} source={{uri: ‘https://slo-v0.netlify.com/’}}
injectedJavaScript={window.ReactNativeWebView.postMessage(JSON.stringify({ listening: 'Sup' }), '*')} onMessage={(event) => console.log(event.nativeEvent.data)} />

This is my code to use react-native-webview 8.0.4 now. It’s working as well on iOS version. But on android, onMessage function don’t trigger.

What’s the reason?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
haveamissioncommented, Jan 22, 2020

I also am having an issue like this as well.

I have a message on my server side (the site loaded in the webview) that should send a message back like so:

window.ReactNativeWebView.postMessage("testdsfdsfdsfds");

However nothing is happening

4reactions
livefuture009commented, Feb 4, 2020

Is there any solve way yet? It’s very critical issue to make native app for websites now. 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

onMessage is not trigger on Android (working on iOS as well)
This is my code to use react-native-webview 8.0.4 now. It's working as well on iOS version. But on android, onMessage function don't trigger....
Read more >
Firebase onMessageReceived not called when app in ...
Send only data and handle it in onMessageReceived() otherwise your onMessageReceived() will not be triggered when app is in background or killed.
Read more >
MessageEvent - Web APIs - MDN Web Docs - Mozilla
The MessageEvent interface represents a message received by a target object. This is used to represent messages in: ... The action triggered by ......
Read more >
Understanding message delivery | Firebase Cloud ... - Google
FCM provides three sets of tools to help you get insight into message delivery: Firebase console message delivery reports; Aggregated Android SDK delivery ......
Read more >
Notifications on React Native using Firebase Cloud ...
Firebase Cloud Messaging is a notification service which can be used to send push notifications and in-app messages in iOS and Android applications....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found