From d5c55eda869ff874f44770110f2381d144d2c3b4 Mon Sep 17 00:00:00 2001 From: ignaciosantise <25931366+ignaciosantise@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:34:23 -0300 Subject: [PATCH] fix: changed init config of frame provider --- .changeset/heavy-hairs-suffer.md | 18 ++++++++++++++++++ packages/wallet/src/AppKitFrameConstants.ts | 9 +++------ packages/wallet/src/AppKitFrameProvider.ts | 1 + 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 .changeset/heavy-hairs-suffer.md diff --git a/.changeset/heavy-hairs-suffer.md b/.changeset/heavy-hairs-suffer.md new file mode 100644 index 00000000..49911c28 --- /dev/null +++ b/.changeset/heavy-hairs-suffer.md @@ -0,0 +1,18 @@ +--- +'@reown/appkit-wallet-react-native': patch +'@reown/appkit-auth-ethers-react-native': patch +'@reown/appkit-auth-wagmi-react-native': patch +'@reown/appkit-coinbase-ethers-react-native': patch +'@reown/appkit-coinbase-wagmi-react-native': patch +'@reown/appkit-common-react-native': patch +'@reown/appkit-core-react-native': patch +'@reown/appkit-ethers-react-native': patch +'@reown/appkit-ethers5-react-native': patch +'@reown/appkit-scaffold-react-native': patch +'@reown/appkit-scaffold-utils-react-native': patch +'@reown/appkit-siwe-react-native': patch +'@reown/appkit-ui-react-native': patch +'@reown/appkit-wagmi-react-native': patch +--- + +fix: changed init config of email provider diff --git a/packages/wallet/src/AppKitFrameConstants.ts b/packages/wallet/src/AppKitFrameConstants.ts index 5ddd69ff..a3e28fcf 100644 --- a/packages/wallet/src/AppKitFrameConstants.ts +++ b/packages/wallet/src/AppKitFrameConstants.ts @@ -15,12 +15,9 @@ export const AppKitFrameConstants = { EMAIL: 'EMAIL', FRAME_MESSAGES_HANDLER: ` - const iframe = document.getElementById("frame-mobile-sdk"); - iframe.onload = () => { - window.addEventListener('message', ({ data, origin }) => { - window.ReactNativeWebView.postMessage(JSON.stringify({ ...data, origin })) - }) - } + window.addEventListener('message', ({ data, origin }) => { + window.ReactNativeWebView.postMessage(JSON.stringify({ ...data, origin })) + }) `, APP_SWITCH_NETWORK: '@w3m-app/SWITCH_NETWORK', diff --git a/packages/wallet/src/AppKitFrameProvider.ts b/packages/wallet/src/AppKitFrameProvider.ts index 05d6a60f..df75457a 100644 --- a/packages/wallet/src/AppKitFrameProvider.ts +++ b/packages/wallet/src/AppKitFrameProvider.ts @@ -662,6 +662,7 @@ export class AppKitFrameProvider { // console.log('📡 sending', strEvent); // eslint-disable-line no-console const send = ` (function() { + let iframe = document.getElementById('frame-mobile-sdk'); iframe.contentWindow.postMessage(${strEvent}, '*'); })() `;