@reown/appkit-react-native 0.0.0-chore-bump-builder-20250728195048 → 0.0.0-chore-solflare-20250730210452
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/AppKit.js +22 -2
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/AppKitContext.js +1 -0
- package/lib/commonjs/AppKitContext.js.map +1 -1
- package/lib/commonjs/hooks/useRouteTransition.js +83 -0
- package/lib/commonjs/hooks/useRouteTransition.js.map +1 -0
- package/lib/commonjs/modal/w3m-modal/index.js +10 -31
- package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/styles.js +0 -4
- package/lib/commonjs/modal/w3m-modal/styles.js.map +1 -1
- package/lib/commonjs/modal/w3m-router/index.js +16 -1
- package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +7 -15
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-information-modal/index.js +34 -32
- package/lib/commonjs/partials/w3m-information-modal/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-information-modal/styles.js +6 -4
- package/lib/commonjs/partials/w3m-information-modal/styles.js.map +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/index.js +64 -66
- package/lib/commonjs/partials/w3m-selector-modal/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/styles.js +1 -0
- package/lib/commonjs/partials/w3m-selector-modal/styles.js.map +1 -1
- package/lib/commonjs/utils/RouterUtil.js +52 -0
- package/lib/commonjs/utils/RouterUtil.js.map +1 -0
- package/lib/commonjs/utils/UiUtil.js +11 -6
- package/lib/commonjs/utils/UiUtil.js.map +1 -1
- package/lib/commonjs/views/w3m-all-wallets-view/index.js +1 -1
- package/lib/commonjs/views/w3m-all-wallets-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js +3 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js +0 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-networks-view/index.js +3 -6
- package/lib/commonjs/views/w3m-networks-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/Header.js +5 -6
- package/lib/commonjs/views/w3m-onramp-view/components/Header.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/SelectPaymentModal.js +68 -70
- package/lib/commonjs/views/w3m-onramp-view/components/SelectPaymentModal.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-preview-view/index.js +1 -14
- package/lib/commonjs/views/w3m-swap-preview-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-preview-view/styles.js +3 -0
- package/lib/commonjs/views/w3m-swap-preview-view/styles.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js +3 -2
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/styles.js +1 -2
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/styles.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js +10 -20
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/styles.js +5 -1
- package/lib/commonjs/views/w3m-swap-view/styles.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-view/index.js +4 -12
- package/lib/commonjs/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-view/styles.js +3 -0
- package/lib/commonjs/views/w3m-wallet-send-view/styles.js.map +1 -1
- package/lib/module/AppKit.js +22 -2
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/AppKitContext.js +1 -0
- package/lib/module/AppKitContext.js.map +1 -1
- package/lib/module/hooks/useRouteTransition.js +79 -0
- package/lib/module/hooks/useRouteTransition.js.map +1 -0
- package/lib/module/modal/w3m-modal/index.js +11 -32
- package/lib/module/modal/w3m-modal/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/styles.js +0 -4
- package/lib/module/modal/w3m-modal/styles.js.map +1 -1
- package/lib/module/modal/w3m-router/index.js +17 -2
- package/lib/module/modal/w3m-router/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +8 -16
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/partials/w3m-information-modal/index.js +33 -31
- package/lib/module/partials/w3m-information-modal/index.js.map +1 -1
- package/lib/module/partials/w3m-information-modal/styles.js +7 -5
- package/lib/module/partials/w3m-information-modal/styles.js.map +1 -1
- package/lib/module/partials/w3m-selector-modal/index.js +64 -66
- package/lib/module/partials/w3m-selector-modal/index.js.map +1 -1
- package/lib/module/partials/w3m-selector-modal/styles.js +1 -0
- package/lib/module/partials/w3m-selector-modal/styles.js.map +1 -1
- package/lib/module/utils/RouterUtil.js +48 -0
- package/lib/module/utils/RouterUtil.js.map +1 -0
- package/lib/module/utils/UiUtil.js +12 -7
- package/lib/module/utils/UiUtil.js.map +1 -1
- package/lib/module/views/w3m-all-wallets-view/index.js +1 -1
- package/lib/module/views/w3m-all-wallets-view/index.js.map +1 -1
- package/lib/module/views/w3m-connect-view/index.js +1 -1
- package/lib/module/views/w3m-connect-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-external-view/index.js +3 -1
- package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-siwe-view/index.js +1 -2
- package/lib/module/views/w3m-connecting-siwe-view/index.js.map +1 -1
- package/lib/module/views/w3m-networks-view/index.js +4 -7
- package/lib/module/views/w3m-networks-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/Header.js +5 -6
- package/lib/module/views/w3m-onramp-view/components/Header.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/SelectPaymentModal.js +68 -69
- package/lib/module/views/w3m-onramp-view/components/SelectPaymentModal.js.map +1 -1
- package/lib/module/views/w3m-swap-preview-view/index.js +3 -16
- package/lib/module/views/w3m-swap-preview-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-preview-view/styles.js +3 -0
- package/lib/module/views/w3m-swap-preview-view/styles.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js +3 -2
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/styles.js +1 -2
- package/lib/module/views/w3m-swap-view/components/select-token-view/styles.js.map +1 -1
- package/lib/module/views/w3m-swap-view/index.js +11 -21
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/styles.js +5 -1
- package/lib/module/views/w3m-swap-view/styles.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-view/index.js +6 -14
- package/lib/module/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-view/styles.js +3 -0
- package/lib/module/views/w3m-wallet-send-view/styles.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +2 -1
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/AppKitContext.d.ts +2 -1
- package/lib/typescript/AppKitContext.d.ts.map +1 -1
- package/lib/typescript/hooks/useRouteTransition.d.ts +16 -0
- package/lib/typescript/hooks/useRouteTransition.d.ts.map +1 -0
- package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/styles.d.ts +0 -4
- package/lib/typescript/modal/w3m-modal/styles.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-header/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-information-modal/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-information-modal/styles.d.ts +2 -0
- package/lib/typescript/partials/w3m-information-modal/styles.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-selector-modal/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-selector-modal/styles.d.ts +1 -0
- package/lib/typescript/partials/w3m-selector-modal/styles.d.ts.map +1 -1
- package/lib/typescript/utils/RouterUtil.d.ts +9 -0
- package/lib/typescript/utils/RouterUtil.d.ts.map +1 -0
- package/lib/typescript/utils/UiUtil.d.ts +2 -2
- package/lib/typescript/utils/UiUtil.d.ts.map +1 -1
- package/lib/typescript/views/w3m-all-wallets-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-external-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-networks-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/Header.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/SelectPaymentModal.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-preview-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-preview-view/styles.d.ts +3 -0
- package/lib/typescript/views/w3m-swap-preview-view/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts +3 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/styles.d.ts +0 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/styles.d.ts +5 -1
- package/lib/typescript/views/w3m-swap-view/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-view/styles.d.ts +3 -0
- package/lib/typescript/views/w3m-wallet-send-view/styles.d.ts.map +1 -1
- package/package.json +5 -6
- package/src/AppKit.ts +37 -2
- package/src/AppKitContext.tsx +1 -0
- package/src/hooks/useRouteTransition.ts +95 -0
- package/src/modal/w3m-modal/index.tsx +12 -39
- package/src/modal/w3m-modal/styles.ts +0 -4
- package/src/modal/w3m-router/index.tsx +17 -2
- package/src/partials/w3m-header/index.tsx +4 -15
- package/src/partials/w3m-information-modal/index.tsx +28 -32
- package/src/partials/w3m-information-modal/styles.ts +7 -5
- package/src/partials/w3m-selector-modal/index.tsx +61 -65
- package/src/partials/w3m-selector-modal/styles.ts +1 -0
- package/src/utils/RouterUtil.ts +50 -0
- package/src/utils/UiUtil.ts +14 -6
- package/src/views/w3m-all-wallets-view/index.tsx +2 -1
- package/src/views/w3m-connect-view/index.tsx +3 -2
- package/src/views/w3m-connecting-external-view/index.tsx +3 -1
- package/src/views/w3m-connecting-siwe-view/index.tsx +0 -2
- package/src/views/w3m-networks-view/index.tsx +2 -8
- package/src/views/w3m-onramp-view/components/Header.tsx +4 -6
- package/src/views/w3m-onramp-view/components/SelectPaymentModal.tsx +49 -56
- package/src/views/w3m-swap-preview-view/index.tsx +4 -23
- package/src/views/w3m-swap-preview-view/styles.ts +3 -0
- package/src/views/w3m-swap-view/components/select-token-view/index.tsx +12 -3
- package/src/views/w3m-swap-view/components/select-token-view/styles.ts +1 -2
- package/src/views/w3m-swap-view/index.tsx +7 -20
- package/src/views/w3m-swap-view/styles.ts +5 -1
- package/src/views/w3m-wallet-send-view/index.tsx +5 -10
- package/src/views/w3m-wallet-send-view/styles.ts +3 -0
- package/lib/commonjs/config/animations.js +0 -9
- package/lib/commonjs/config/animations.js.map +0 -1
- package/lib/commonjs/partials/w3m-otp-code/index.js +0 -89
- package/lib/commonjs/partials/w3m-otp-code/index.js.map +0 -1
- package/lib/commonjs/partials/w3m-otp-code/styles.js +0 -21
- package/lib/commonjs/partials/w3m-otp-code/styles.js.map +0 -1
- package/lib/module/config/animations.js +0 -9
- package/lib/module/config/animations.js.map +0 -1
- package/lib/module/partials/w3m-otp-code/index.js +0 -84
- package/lib/module/partials/w3m-otp-code/index.js.map +0 -1
- package/lib/module/partials/w3m-otp-code/styles.js +0 -17
- package/lib/module/partials/w3m-otp-code/styles.js.map +0 -1
- package/lib/typescript/config/animations.d.ts +0 -2
- package/lib/typescript/config/animations.d.ts.map +0 -1
- package/lib/typescript/partials/w3m-otp-code/index.d.ts +0 -16
- package/lib/typescript/partials/w3m-otp-code/index.d.ts.map +0 -1
- package/lib/typescript/partials/w3m-otp-code/styles.d.ts +0 -14
- package/lib/typescript/partials/w3m-otp-code/styles.d.ts.map +0 -1
- package/src/config/animations.ts +0 -7
- package/src/partials/w3m-otp-code/index.tsx +0 -81
- package/src/partials/w3m-otp-code/styles.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/index.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,QAAQ,4CA6LvB"}
|
|
@@ -17,10 +17,14 @@ declare const _default: {
|
|
|
17
17
|
marginTop: number;
|
|
18
18
|
width: "100%";
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
modalContent: {
|
|
21
21
|
margin: number;
|
|
22
|
+
flex: number;
|
|
22
23
|
justifyContent: "flex-end";
|
|
23
24
|
};
|
|
25
|
+
withKeyboard: {
|
|
26
|
+
height: "100%";
|
|
27
|
+
};
|
|
24
28
|
};
|
|
25
29
|
export default _default;
|
|
26
30
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/styles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBA2BG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-view/index.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-view/index.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,cAAc,4CAwG7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-view/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-view/styles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA,wBAoBG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-react-native",
|
|
3
|
-
"version": "0.0.0-chore-
|
|
3
|
+
"version": "0.0.0-chore-solflare-20250730210452",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -38,12 +38,11 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@reown/appkit-common-react-native": "0.0.0-chore-
|
|
42
|
-
"@reown/appkit-core-react-native": "0.0.0-chore-
|
|
43
|
-
"@reown/appkit-siwe-react-native": "0.0.0-chore-
|
|
44
|
-
"@reown/appkit-ui-react-native": "0.0.0-chore-
|
|
41
|
+
"@reown/appkit-common-react-native": "0.0.0-chore-solflare-20250730210452",
|
|
42
|
+
"@reown/appkit-core-react-native": "0.0.0-chore-solflare-20250730210452",
|
|
43
|
+
"@reown/appkit-siwe-react-native": "0.0.0-chore-solflare-20250730210452",
|
|
44
|
+
"@reown/appkit-ui-react-native": "0.0.0-chore-solflare-20250730210452",
|
|
45
45
|
"@walletconnect/universal-provider": "2.21.5",
|
|
46
|
-
"react-native-modal": ">=13",
|
|
47
46
|
"valtio": "2.1.5"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
package/src/AppKit.ts
CHANGED
|
@@ -46,6 +46,7 @@ import { SIWEController } from '@reown/appkit-siwe-react-native';
|
|
|
46
46
|
import { WalletConnectConnector } from './connectors/WalletConnectConnector';
|
|
47
47
|
import { WcHelpersUtil } from './utils/HelpersUtil';
|
|
48
48
|
import { NetworkUtil } from './utils/NetworkUtil';
|
|
49
|
+
import { RouterUtil } from './utils/RouterUtil';
|
|
49
50
|
|
|
50
51
|
interface AppKitConfig {
|
|
51
52
|
projectId: string;
|
|
@@ -296,8 +297,33 @@ export class AppKit {
|
|
|
296
297
|
ModalController.open(options);
|
|
297
298
|
}
|
|
298
299
|
|
|
299
|
-
close() {
|
|
300
|
+
async close() {
|
|
300
301
|
ModalController.close();
|
|
302
|
+
|
|
303
|
+
if (OptionsController.state.isSiweEnabled && ConnectionsController.state.isConnected) {
|
|
304
|
+
const session = await SIWEController.getSession();
|
|
305
|
+
if (
|
|
306
|
+
!session &&
|
|
307
|
+
SIWEController.state.status !== 'success' &&
|
|
308
|
+
ConnectionsController.state.activeNamespace === 'eip155' &&
|
|
309
|
+
!!ConnectionsController.state.activeAddress
|
|
310
|
+
) {
|
|
311
|
+
await this.disconnect();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
RouterUtil.checkOnRampBack();
|
|
316
|
+
RouterUtil.checkSocialLoginBack();
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
back() {
|
|
320
|
+
if (RouterController.state.history.length > 1) {
|
|
321
|
+
RouterUtil.checkBack();
|
|
322
|
+
|
|
323
|
+
return RouterController.goBack();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return this.close();
|
|
301
327
|
}
|
|
302
328
|
|
|
303
329
|
async switchAccountType(namespace: ChainNamespace, type: AccountType, network: AppKitNetwork) {
|
|
@@ -693,6 +719,15 @@ export class AppKit {
|
|
|
693
719
|
customList.push(ConstantsUtil.PHANTOM_CUSTOM_WALLET);
|
|
694
720
|
}
|
|
695
721
|
|
|
722
|
+
const addSolflare =
|
|
723
|
+
adapters.some(adapter => adapter.getSupportedNamespace() === 'solana') &&
|
|
724
|
+
extraConnectors?.some(connector => connector.type.toLowerCase() === 'solflare') &&
|
|
725
|
+
!customList.some(wallet => wallet.id === ConstantsUtil.SOLFLARE_CUSTOM_WALLET.id);
|
|
726
|
+
|
|
727
|
+
if (addSolflare) {
|
|
728
|
+
customList.push(ConstantsUtil.SOLFLARE_CUSTOM_WALLET);
|
|
729
|
+
}
|
|
730
|
+
|
|
696
731
|
OptionsController.setCustomWallets(customList);
|
|
697
732
|
}
|
|
698
733
|
|
|
@@ -743,7 +778,7 @@ export class AppKit {
|
|
|
743
778
|
// If it's connected but there's no session, show sign view
|
|
744
779
|
return this.onSiweNavigation();
|
|
745
780
|
} else if (isConnection) {
|
|
746
|
-
//Connected with 1CA
|
|
781
|
+
// Connected with 1CA
|
|
747
782
|
ModalController.close();
|
|
748
783
|
}
|
|
749
784
|
}
|
package/src/AppKitContext.tsx
CHANGED
|
@@ -32,6 +32,7 @@ export const useAppKit = () => {
|
|
|
32
32
|
disconnect: context.appKit.disconnect.bind(context.appKit),
|
|
33
33
|
open: context.appKit.open.bind(context.appKit),
|
|
34
34
|
close: context.appKit.close.bind(context.appKit),
|
|
35
|
+
back: context.appKit.back.bind(context.appKit),
|
|
35
36
|
switchNetwork: context.appKit.switchNetwork.bind(context.appKit),
|
|
36
37
|
getProvider: context.appKit.getProvider.bind(context.appKit),
|
|
37
38
|
switchAccountType: context.appKit.switchAccountType.bind(context.appKit)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
2
|
+
import { Animated, Dimensions } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const { width: screenWidth } = Dimensions.get('window');
|
|
5
|
+
|
|
6
|
+
export interface RouteTransitionConfig {
|
|
7
|
+
duration?: number;
|
|
8
|
+
useNativeDriver?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function useRouteTransition(config: RouteTransitionConfig = {}) {
|
|
12
|
+
const { duration = 300, useNativeDriver = true } = config;
|
|
13
|
+
|
|
14
|
+
const fadeAnim = useRef(new Animated.Value(1)).current;
|
|
15
|
+
const slideAnim = useRef(new Animated.Value(0)).current;
|
|
16
|
+
const isAnimating = useRef(false);
|
|
17
|
+
const currentAnimation = useRef<Animated.CompositeAnimation | null>(null);
|
|
18
|
+
|
|
19
|
+
const animateTransition = useCallback(
|
|
20
|
+
(direction: 'forward' | 'backward' | 'none') => {
|
|
21
|
+
if (isAnimating.current || direction === 'none') {
|
|
22
|
+
return Promise.resolve();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (currentAnimation.current) {
|
|
26
|
+
currentAnimation.current.stop();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
isAnimating.current = true;
|
|
30
|
+
|
|
31
|
+
return new Promise<void>(resolve => {
|
|
32
|
+
const startPosition =
|
|
33
|
+
direction === 'forward'
|
|
34
|
+
? screenWidth * 0.02 // Start from right for forward
|
|
35
|
+
: -screenWidth * 0.02; // Start from left for backward
|
|
36
|
+
|
|
37
|
+
// Immediately set starting position and fade out
|
|
38
|
+
fadeAnim.setValue(0);
|
|
39
|
+
slideAnim.setValue(startPosition);
|
|
40
|
+
|
|
41
|
+
// Animate to final position with fade in
|
|
42
|
+
const animation = Animated.parallel([
|
|
43
|
+
Animated.timing(fadeAnim, {
|
|
44
|
+
toValue: 1,
|
|
45
|
+
duration,
|
|
46
|
+
useNativeDriver
|
|
47
|
+
}),
|
|
48
|
+
Animated.timing(slideAnim, {
|
|
49
|
+
toValue: 0, // Slide to center
|
|
50
|
+
duration,
|
|
51
|
+
useNativeDriver
|
|
52
|
+
})
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
currentAnimation.current = animation;
|
|
56
|
+
|
|
57
|
+
animation.start(({ finished }) => {
|
|
58
|
+
if (finished) {
|
|
59
|
+
isAnimating.current = false;
|
|
60
|
+
currentAnimation.current = null;
|
|
61
|
+
resolve();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
[fadeAnim, slideAnim, duration, useNativeDriver]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const getAnimatedStyle = useCallback(
|
|
70
|
+
() => ({
|
|
71
|
+
opacity: fadeAnim,
|
|
72
|
+
transform: [{ translateX: slideAnim }]
|
|
73
|
+
}),
|
|
74
|
+
[fadeAnim, slideAnim]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
fadeAnim.setValue(1);
|
|
79
|
+
slideAnim.setValue(0);
|
|
80
|
+
|
|
81
|
+
return () => {
|
|
82
|
+
if (currentAnimation.current) {
|
|
83
|
+
currentAnimation.current.stop();
|
|
84
|
+
currentAnimation.current = null;
|
|
85
|
+
}
|
|
86
|
+
isAnimating.current = false;
|
|
87
|
+
};
|
|
88
|
+
}, [fadeAnim, slideAnim]);
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
animateTransition,
|
|
92
|
+
getAnimatedStyle,
|
|
93
|
+
isAnimating: isAnimating.current
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { useCallback, useEffect } from 'react';
|
|
3
3
|
import { useWindowDimensions, StatusBar } from 'react-native';
|
|
4
|
-
import Modal from 'react-native
|
|
5
|
-
import { Card, ThemeProvider } from '@reown/appkit-ui-react-native';
|
|
4
|
+
import { Card, Modal, ThemeProvider } from '@reown/appkit-ui-react-native';
|
|
6
5
|
import {
|
|
7
6
|
ApiController,
|
|
8
7
|
EventsController,
|
|
9
8
|
ModalController,
|
|
10
9
|
OptionsController,
|
|
11
10
|
RouterController,
|
|
12
|
-
ThemeController
|
|
13
|
-
ConnectionsController
|
|
11
|
+
ThemeController
|
|
14
12
|
} from '@reown/appkit-core-react-native';
|
|
15
|
-
import { SIWEController } from '@reown/appkit-siwe-react-native';
|
|
16
13
|
|
|
17
14
|
import { AppKitRouter } from '../w3m-router';
|
|
18
15
|
import { Header } from '../../partials/w3m-header';
|
|
19
16
|
import { Snackbar } from '../../partials/w3m-snackbar';
|
|
20
17
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
21
|
-
import styles from './styles';
|
|
22
18
|
import { useAppKit } from '../../AppKitContext';
|
|
19
|
+
import styles from './styles';
|
|
23
20
|
|
|
24
21
|
export function AppKit() {
|
|
25
|
-
const {
|
|
22
|
+
const { close } = useAppKit();
|
|
26
23
|
const { open } = useSnapshot(ModalController.state);
|
|
27
24
|
const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
|
|
28
25
|
const { projectId } = useSnapshot(OptionsController.state);
|
|
@@ -31,12 +28,12 @@ export function AppKit() {
|
|
|
31
28
|
const portraitHeight = height - 80;
|
|
32
29
|
const landScapeHeight = height * 0.95 - (StatusBar.currentHeight ?? 0);
|
|
33
30
|
|
|
34
|
-
const
|
|
31
|
+
const handleBackPress = () => {
|
|
35
32
|
if (RouterController.state.history.length > 1) {
|
|
36
33
|
return RouterController.goBack();
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
return
|
|
36
|
+
return handleModalClose();
|
|
40
37
|
};
|
|
41
38
|
|
|
42
39
|
const prefetch = useCallback(async () => {
|
|
@@ -44,27 +41,10 @@ export function AppKit() {
|
|
|
44
41
|
EventsController.sendEvent({ type: 'track', event: 'MODAL_LOADED' });
|
|
45
42
|
}, []);
|
|
46
43
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const session = await SIWEController.getSession();
|
|
50
|
-
if (
|
|
51
|
-
!session &&
|
|
52
|
-
SIWEController.state.status !== 'success' &&
|
|
53
|
-
ConnectionsController.state.activeNamespace === 'eip155' &&
|
|
54
|
-
!!ConnectionsController.state.activeAddress
|
|
55
|
-
) {
|
|
56
|
-
await disconnect();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
RouterController.state.view === 'OnRampLoading' &&
|
|
62
|
-
EventsController.state.data.event === 'BUY_SUBMITTED'
|
|
63
|
-
) {
|
|
64
|
-
// Send event only if the onramp url was already created
|
|
65
|
-
EventsController.sendEvent({ type: 'track', event: 'BUY_CANCEL' });
|
|
66
|
-
}
|
|
44
|
+
const handleModalClose = async () => {
|
|
45
|
+
await close();
|
|
67
46
|
};
|
|
47
|
+
|
|
68
48
|
useEffect(() => {
|
|
69
49
|
if (projectId) {
|
|
70
50
|
prefetch();
|
|
@@ -75,16 +55,9 @@ export function AppKit() {
|
|
|
75
55
|
<>
|
|
76
56
|
<ThemeProvider themeMode={themeMode} themeVariables={themeVariables}>
|
|
77
57
|
<Modal
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
useNativeDriverForBackdrop
|
|
82
|
-
statusBarTranslucent
|
|
83
|
-
hideModalContentWhileAnimating
|
|
84
|
-
propagateSwipe
|
|
85
|
-
onModalHide={handleClose}
|
|
86
|
-
onBackdropPress={ModalController.close}
|
|
87
|
-
onBackButtonPress={onBackButtonPress}
|
|
58
|
+
visible={open}
|
|
59
|
+
onRequestClose={handleBackPress}
|
|
60
|
+
onBackdropPress={handleModalClose}
|
|
88
61
|
testID="w3m-modal"
|
|
89
62
|
>
|
|
90
63
|
<Card
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
|
-
import { useLayoutEffect, useMemo } from 'react';
|
|
2
|
+
import { useEffect, useLayoutEffect, useMemo } from 'react';
|
|
3
3
|
import { RouterController } from '@reown/appkit-core-react-native';
|
|
4
4
|
|
|
5
5
|
import { AccountDefaultView } from '../../views/w3m-account-default-view';
|
|
@@ -32,9 +32,20 @@ import { WalletSendSelectTokenView } from '../../views/w3m-wallet-send-select-to
|
|
|
32
32
|
import { WhatIsANetworkView } from '../../views/w3m-what-is-a-network-view';
|
|
33
33
|
import { WhatIsAWalletView } from '../../views/w3m-what-is-a-wallet-view';
|
|
34
34
|
import { UiUtil } from '../../utils/UiUtil';
|
|
35
|
+
import { useRouteTransition } from '../../hooks/useRouteTransition';
|
|
36
|
+
|
|
37
|
+
import { Animated } from 'react-native';
|
|
35
38
|
|
|
36
39
|
export function AppKitRouter() {
|
|
37
40
|
const { view } = useSnapshot(RouterController.state);
|
|
41
|
+
const { animateTransition, getAnimatedStyle } = useRouteTransition({
|
|
42
|
+
duration: 300,
|
|
43
|
+
useNativeDriver: true
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
UiUtil.setRouteTransition(animateTransition);
|
|
48
|
+
}, [animateTransition]);
|
|
38
49
|
|
|
39
50
|
useLayoutEffect(() => {
|
|
40
51
|
UiUtil.createViewTransition();
|
|
@@ -105,5 +116,9 @@ export function AppKitRouter() {
|
|
|
105
116
|
}
|
|
106
117
|
}, [view]);
|
|
107
118
|
|
|
108
|
-
return
|
|
119
|
+
return (
|
|
120
|
+
<Animated.View style={[getAnimatedStyle()]}>
|
|
121
|
+
<ViewComponent />
|
|
122
|
+
</Animated.View>
|
|
123
|
+
);
|
|
109
124
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import {
|
|
3
3
|
RouterController,
|
|
4
|
-
ModalController,
|
|
5
4
|
EventsController,
|
|
6
5
|
type RouterControllerState
|
|
7
6
|
} from '@reown/appkit-core-react-native';
|
|
@@ -9,8 +8,10 @@ import { IconLink, Text, FlexView } from '@reown/appkit-ui-react-native';
|
|
|
9
8
|
import { StringUtil } from '@reown/appkit-common-react-native';
|
|
10
9
|
|
|
11
10
|
import styles from './styles';
|
|
11
|
+
import { useAppKit } from '../../AppKitContext';
|
|
12
12
|
|
|
13
13
|
export function Header() {
|
|
14
|
+
const { close, back } = useAppKit();
|
|
14
15
|
const { data, view } = useSnapshot(RouterController.state);
|
|
15
16
|
const onHelpPress = () => {
|
|
16
17
|
RouterController.push('WhatIsAWallet');
|
|
@@ -61,24 +62,12 @@ export function Header() {
|
|
|
61
62
|
const showClose = !noCloseViews.includes(view);
|
|
62
63
|
const header = headings(data, view);
|
|
63
64
|
|
|
64
|
-
const checkSocial = () => {
|
|
65
|
-
if (RouterController.state.view === 'ConnectingSocial') {
|
|
66
|
-
EventsController.sendEvent({
|
|
67
|
-
type: 'track',
|
|
68
|
-
event: 'SOCIAL_LOGIN_CANCELED',
|
|
69
|
-
properties: { provider: RouterController.state.data?.socialProvider! }
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
65
|
const handleGoBack = () => {
|
|
75
|
-
|
|
76
|
-
RouterController.goBack();
|
|
66
|
+
back();
|
|
77
67
|
};
|
|
78
68
|
|
|
79
69
|
const handleClose = () => {
|
|
80
|
-
|
|
81
|
-
ModalController.close();
|
|
70
|
+
close();
|
|
82
71
|
};
|
|
83
72
|
|
|
84
73
|
const dynamicButtonTemplate = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Modal from 'react-native
|
|
1
|
+
import { Modal } from 'react-native';
|
|
2
2
|
import {
|
|
3
3
|
FlexView,
|
|
4
4
|
Text,
|
|
@@ -27,38 +27,34 @@ export function InformationModal({
|
|
|
27
27
|
const Theme = useTheme();
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<Modal
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{!!title && (
|
|
49
|
-
<Text variant="paragraph-500" style={styles.title}>
|
|
50
|
-
{title}
|
|
51
|
-
</Text>
|
|
52
|
-
)}
|
|
30
|
+
<Modal visible={visible} transparent animationType="slide" onRequestClose={onClose}>
|
|
31
|
+
<FlexView style={styles.modal}>
|
|
32
|
+
<FlexView
|
|
33
|
+
style={[
|
|
34
|
+
styles.content,
|
|
35
|
+
{
|
|
36
|
+
backgroundColor: Theme['bg-100'],
|
|
37
|
+
borderColor: Theme['gray-glass-015']
|
|
38
|
+
}
|
|
39
|
+
]}
|
|
40
|
+
padding="2xl"
|
|
41
|
+
>
|
|
42
|
+
<IconBox icon={iconName} size="lg" background />
|
|
43
|
+
{!!title && (
|
|
44
|
+
<Text variant="paragraph-500" style={styles.title}>
|
|
45
|
+
{title}
|
|
46
|
+
</Text>
|
|
47
|
+
)}
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
{!!description && (
|
|
50
|
+
<Text variant="small-400" color="fg-150" center>
|
|
51
|
+
{description}
|
|
52
|
+
</Text>
|
|
53
|
+
)}
|
|
54
|
+
<Button onPress={onClose} variant="fill" style={styles.button}>
|
|
55
|
+
Got it
|
|
56
|
+
</Button>
|
|
57
|
+
</FlexView>
|
|
62
58
|
</FlexView>
|
|
63
59
|
</Modal>
|
|
64
60
|
);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { Spacing } from '@reown/appkit-ui-react-native';
|
|
1
|
+
import { BorderRadius, Spacing } from '@reown/appkit-ui-react-native';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
modal: {
|
|
6
6
|
margin: 0,
|
|
7
|
-
justifyContent: 'flex-end'
|
|
7
|
+
justifyContent: 'flex-end',
|
|
8
|
+
flex: 1
|
|
8
9
|
},
|
|
9
10
|
content: {
|
|
10
|
-
borderTopLeftRadius:
|
|
11
|
-
borderTopRightRadius:
|
|
12
|
-
alignItems: 'center'
|
|
11
|
+
borderTopLeftRadius: BorderRadius.l,
|
|
12
|
+
borderTopRightRadius: BorderRadius.l,
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
13
15
|
},
|
|
14
16
|
title: {
|
|
15
17
|
marginTop: Spacing.s,
|