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() { constructor() {
this.pendingMessages = [] this.pendingMessages = []
window.addEventListener('message', this.handleMessageFromReactNative.bind(this)) window.addEventListener('message', this.handleMessageFromReactNative.bind(this))
document.addEventListener('message', this.handleMessageFromReactNative.bind(this))
} }
handleMessageFromReactNative(event) { handleMessageFromReactNative(event) {

View File

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