You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description: postMessage(0) used to properly trigger onMessage callback with data being coerced to string somehow, and it is not the case anymore
Im aware docs specify passing string only, but we dont own the code calling us unfortunately... Our current workaround is to inject js that instruments postMessage to force a String coerscion like
if (window.ReactNativeWebView) {
const postMessage = window.ReactNativeWebView.postMessage.bind(window.ReactNativeWebView);
window.ReactNativeWebView.postMessage = function _postMessage(data) {
postMessage(String(data));
}
}
Expected behavior:
Not sure if we want to fix this here and bring back the coerscion because I agree with the docs specify string only, but it used to work. At the very least this issue can be useful to others seeking workarounds.
Screenshots/Videos:
There are videos in my repo 🙂
Environment:
Im not certain this isnt happening on some ios devices, or not happening on some android device, but we could consistently reproduce with those
OS: android
OS version: android 15 / sdk 35
react-native version: .77
react-native-webview version: 13.13.2
My repo shows it works on react-native .76 and webview 13.12.5
The text was updated successfully, but these errors were encountered:
Bug description:
postMessage(0)
used to properly triggeronMessage
callback with data being coerced to string somehow, and it is not the case anymoreIm aware docs specify passing string only, but we dont own the code calling us unfortunately... Our current workaround is to inject js that instruments postMessage to force a String coerscion like
To Reproduce:
I have set it up for you here 🙂 https://github.com/eloiqs/react-native-webview-regression-repro
Expected behavior:
Not sure if we want to fix this here and bring back the coerscion because I agree with the docs specify string only, but it used to work. At the very least this issue can be useful to others seeking workarounds.
Screenshots/Videos:
There are videos in my repo 🙂
Environment:
Im not certain this isnt happening on some ios devices, or not happening on some android device, but we could consistently reproduce with those
My repo shows it works on react-native .76 and webview 13.12.5
The text was updated successfully, but these errors were encountered: