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:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
Is there any solve way yet? It’s very critical issue to make native app for websites now. 😦