react-native-webview: window.ReactNativeWebView is undefined on Android platform, iOS works just fine.
Bug description:
window.ReactNativeWebView
is undefined on Android platform, iOS works just fine.
To Reproduce:
Build for both platforms from same project, open Chrome’s DevTool and Safari’s Web Inspector, type window.ReactNativeWebView
in the Console section and send it.
Expected behavior:
Webpage JS can call window.ReactNativeWebView.postMessage()
on both platform successfully.
Further action handled within React Native.
Screenshots/Videos:
Console at the top showing iOS console, bottom is Android console
Environment:
-
OS: iOS
-
OS version: 14.3
-
react-native version: 0.63.4
-
react-native-webview version: 11.0.2
-
OS: Android
-
OS version: 11
-
react-native version: 0.63.4
-
react-native-webview version: 11.0.2
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 18
Commits related to this issue
- fix: onMessage can't be undefeind https://github.com/react-native-webview/react-native-webview/issues/1829#issuecomment-1699235643 — committed to tiddly-gittly/TidGi-Mobile by linonetwo 10 months ago
same issue
@fpena I do aware that the issue may not related to
onNavigationStateChange
, I just not sure that if having the prop will affect anything, or if I’m doing it wrongly (I’m new to React Native)I created an example repo where this can be reproduced.
In iOS, an alert shows up because the website is call callback function. In Android doesn’t happen.
Also, the codesandbox with the web-view behaviour.
cc: @jamonholmgren