fix: let Android to correctly recognize the NativeMobileWeb environment when opening WebView on Android (#1503)

This commit is contained in:
Vardan Hakobyan
2022-09-08 23:45:32 +04:00
committed by GitHub
parent 1d93210f81
commit 461ebc2768
2 changed files with 3 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ class WebProcessMessageSender {
constructor() {
this.pendingMessages = []
window.addEventListener('message', this.handleMessageFromReactNative.bind(this))
document.addEventListener('message', this.handleMessageFromReactNative.bind(this))
}
handleMessageFromReactNative(event) {

View File

@@ -57,6 +57,7 @@ export const MobileWebAppContainer = () => {
constructor() {
this.pendingMessages = []
window.addEventListener('message', this.handleMessageFromReactNative.bind(this))
document.addEventListener('message', this.handleMessageFromReactNative.bind(this))
}
handleMessageFromReactNative(event) {
@@ -128,7 +129,7 @@ export const MobileWebAppContainer = () => {
onMessage={onMessage}
allowFileAccess={true}
allowUniversalAccessFromFileURLs={true}
injectedJavaScript={injectedJS}
injectedJavaScriptBeforeContentLoaded={injectedJS}
/>
)
/* eslint-enable @typescript-eslint/no-empty-function */