Skip to content

Commit

Permalink
fix: let Android to correctly recognize the NativeMobileWeb environme…
Browse files Browse the repository at this point in the history
…nt when opening WebView on Android (#1503)
  • Loading branch information
vardan-arm committed Sep 8, 2022
1 parent 1d93210 commit 461ebc2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/mobile/WebFrame/MessageSender.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion packages/mobile/src/MobileWebAppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -128,7 +129,7 @@ export const MobileWebAppContainer = () => {
onMessage={onMessage}
allowFileAccess={true}
allowUniversalAccessFromFileURLs={true}
injectedJavaScript={injectedJS}
injectedJavaScriptBeforeContentLoaded={injectedJS}
/>
)
/* eslint-enable @typescript-eslint/no-empty-function */
Expand Down

0 comments on commit 461ebc2

Please sign in to comment.