window.ReactNativeWebView.postMessage(data) and onMessage doesn't work on release apk mode. [only works in debug mode]
See original GitHub issueBug description:
Hello, i’m trying to send data from my web page to my react native app through this library, using a phone phisical android and it only perfectly works in debug mode. When i build it for production, it doesn’t work, window.ReactNativeWebView.postMessage(data)
does nothing.
Expected behavior: Capure the data sent from my web page in release apk mode
Screenshots/Videos: Code from my web page
code from my RN app
Environment:
- OS: android
- OS version: 8.1.1
- react-native version: 0.63.4
- react-native-webview version: 11.15.0 => I was trying another version 9.0.2 and it didn’t work either
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
React Native WebView postMessage does not work
I had the same problem and fixed it by adding the event listener to the document instead of the window. Change: window.
Read more >App doesn't work in release apk but works fine in debug mode
My app works fine in debug mode but when i make its release build blank screen comes up as soon as internet is...
Read more >Fixing React Native WebView's postMessage for iOS
In 2016, a GitHub user opened an issue on the React Native repository reporting the error, but nothing has been done to resolve...
Read more >react native html postMessage can not reach to WebView ...
Coding example for the question react native html postMessage can not reach to WebView-React Native.
Read more >postmessage webview react native Code Example
if(navigator.appVersion.includes('Android')){ document.addEventListener("message", function (data) { alert("you are in android OS"); } ...
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’m having same issue. In my case, I’m trying to get events from iframe video but it only works on browser and not on react native via webview.
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically