@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,6 +1,5 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
|
-
import Modal from 'react-native
|
|
3
|
-
import { FlatList, View } from 'react-native';
|
|
2
|
+
import { FlatList, View, Modal } from 'react-native';
|
|
4
3
|
import {
|
|
5
4
|
FlexView,
|
|
6
5
|
IconBox,
|
|
@@ -54,72 +53,69 @@ export function SelectorModal({
|
|
|
54
53
|
};
|
|
55
54
|
|
|
56
55
|
return (
|
|
57
|
-
<Modal
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
<Modal visible={visible} transparent animationType="slide" onRequestClose={onClose}>
|
|
57
|
+
<View style={styles.modal}>
|
|
58
|
+
<FlexView style={[styles.container, { backgroundColor: Theme['bg-100'] }]}>
|
|
59
|
+
<FlexView
|
|
60
|
+
alignItems="center"
|
|
61
|
+
justifyContent="space-between"
|
|
62
|
+
flexDirection="row"
|
|
63
|
+
style={styles.header}
|
|
64
|
+
>
|
|
65
|
+
<IconLink icon="chevronLeft" onPress={onClose} testID="selector-modal-button-back" />
|
|
66
|
+
{!!title && <Text variant="paragraph-600">{title}</Text>}
|
|
67
|
+
{showNetwork ? (
|
|
68
|
+
networkImage ? (
|
|
69
|
+
<FlexView
|
|
70
|
+
alignItems="center"
|
|
71
|
+
justifyContent="center"
|
|
72
|
+
style={styles.iconPlaceholder}
|
|
73
|
+
>
|
|
74
|
+
<Image source={networkImage} style={styles.networkImage} />
|
|
75
|
+
</FlexView>
|
|
76
|
+
) : (
|
|
77
|
+
<IconBox
|
|
78
|
+
style={styles.iconPlaceholder}
|
|
79
|
+
icon="networkPlaceholder"
|
|
80
|
+
background
|
|
81
|
+
iconColor="fg-200"
|
|
82
|
+
size="sm"
|
|
83
|
+
/>
|
|
84
|
+
)
|
|
81
85
|
) : (
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
<
|
|
86
|
+
<View style={styles.iconPlaceholder} />
|
|
87
|
+
)}
|
|
88
|
+
</FlexView>
|
|
89
|
+
<SearchBar
|
|
90
|
+
onChangeText={onSearch}
|
|
91
|
+
style={styles.searchBar}
|
|
92
|
+
placeholder={searchPlaceholder}
|
|
93
|
+
/>
|
|
94
|
+
{selectedItem && (
|
|
95
|
+
<FlexView style={styles.selectedContainer}>
|
|
96
|
+
{renderItem({ item: selectedItem })}
|
|
97
|
+
<Separator style={styles.separator} color="gray-glass-020" />
|
|
98
|
+
</FlexView>
|
|
92
99
|
)}
|
|
100
|
+
<FlatList
|
|
101
|
+
data={items}
|
|
102
|
+
renderItem={renderItem}
|
|
103
|
+
fadingEdgeLength={20}
|
|
104
|
+
contentContainerStyle={styles.listContent}
|
|
105
|
+
ItemSeparatorComponent={renderSeparator}
|
|
106
|
+
keyExtractor={keyExtractor}
|
|
107
|
+
getItemLayout={
|
|
108
|
+
itemHeight
|
|
109
|
+
? (_, index) => ({
|
|
110
|
+
length: itemHeight + SEPARATOR_HEIGHT,
|
|
111
|
+
offset: (itemHeight + SEPARATOR_HEIGHT) * index,
|
|
112
|
+
index
|
|
113
|
+
})
|
|
114
|
+
: undefined
|
|
115
|
+
}
|
|
116
|
+
/>
|
|
93
117
|
</FlexView>
|
|
94
|
-
|
|
95
|
-
onChangeText={onSearch}
|
|
96
|
-
style={styles.searchBar}
|
|
97
|
-
placeholder={searchPlaceholder}
|
|
98
|
-
/>
|
|
99
|
-
{selectedItem && (
|
|
100
|
-
<FlexView style={styles.selectedContainer}>
|
|
101
|
-
{renderItem({ item: selectedItem })}
|
|
102
|
-
<Separator style={styles.separator} color="gray-glass-020" />
|
|
103
|
-
</FlexView>
|
|
104
|
-
)}
|
|
105
|
-
<FlatList
|
|
106
|
-
data={items}
|
|
107
|
-
renderItem={renderItem}
|
|
108
|
-
fadingEdgeLength={20}
|
|
109
|
-
contentContainerStyle={styles.listContent}
|
|
110
|
-
ItemSeparatorComponent={renderSeparator}
|
|
111
|
-
keyExtractor={keyExtractor}
|
|
112
|
-
getItemLayout={
|
|
113
|
-
itemHeight
|
|
114
|
-
? (_, index) => ({
|
|
115
|
-
length: itemHeight + SEPARATOR_HEIGHT,
|
|
116
|
-
offset: (itemHeight + SEPARATOR_HEIGHT) * index,
|
|
117
|
-
index
|
|
118
|
-
})
|
|
119
|
-
: undefined
|
|
120
|
-
}
|
|
121
|
-
/>
|
|
122
|
-
</FlexView>
|
|
118
|
+
</View>
|
|
123
119
|
</Modal>
|
|
124
120
|
);
|
|
125
121
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EventsController,
|
|
3
|
+
OnRampController,
|
|
4
|
+
RouterController,
|
|
5
|
+
SendController,
|
|
6
|
+
SwapController
|
|
7
|
+
} from '@reown/appkit-core-react-native';
|
|
8
|
+
|
|
9
|
+
export const RouterUtil = {
|
|
10
|
+
checkBack() {
|
|
11
|
+
this.checkSwapBack();
|
|
12
|
+
this.checkSendBack();
|
|
13
|
+
this.checkOnRampBack();
|
|
14
|
+
this.checkSocialLoginBack();
|
|
15
|
+
this.checkOnRampBackLoading();
|
|
16
|
+
},
|
|
17
|
+
checkOnRampBackLoading() {
|
|
18
|
+
if (
|
|
19
|
+
RouterController.state.view === 'OnRampLoading' &&
|
|
20
|
+
EventsController.state.data.event === 'BUY_SUBMITTED'
|
|
21
|
+
) {
|
|
22
|
+
// Send event only if the onramp url was already created
|
|
23
|
+
EventsController.sendEvent({ type: 'track', event: 'BUY_CANCEL' });
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
checkSocialLoginBack() {
|
|
27
|
+
if (RouterController.state.view === 'ConnectingSocial') {
|
|
28
|
+
EventsController.sendEvent({
|
|
29
|
+
type: 'track',
|
|
30
|
+
event: 'SOCIAL_LOGIN_CANCELED',
|
|
31
|
+
properties: { provider: RouterController.state.data?.socialProvider! }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
checkSwapBack() {
|
|
36
|
+
if (RouterController.state.view === 'Swap') {
|
|
37
|
+
SwapController.clearTokens();
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
checkSendBack() {
|
|
41
|
+
if (RouterController.state.view === 'WalletSend') {
|
|
42
|
+
SendController.resetState();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
checkOnRampBack() {
|
|
46
|
+
if (RouterController.state.view === 'OnRamp') {
|
|
47
|
+
OnRampController.resetState();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
package/src/utils/UiUtil.ts
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AssetUtil,
|
|
3
3
|
ConnectionController,
|
|
4
|
+
RouterController,
|
|
4
5
|
StorageUtil,
|
|
5
6
|
type WcWallet
|
|
6
7
|
} from '@reown/appkit-core-react-native';
|
|
7
8
|
import type { WalletDeepLink } from '@reown/appkit-common-react-native';
|
|
8
9
|
|
|
10
|
+
// Global animation instance to coordinate transitions
|
|
11
|
+
let currentRouteTransition: ((direction: 'forward' | 'backward' | 'none') => Promise<void>) | null =
|
|
12
|
+
null;
|
|
13
|
+
|
|
9
14
|
export const UiUtil = {
|
|
10
15
|
TOTAL_VISIBLE_WALLETS: 4,
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
setRouteTransition: (
|
|
18
|
+
transitionFn: (direction: 'forward' | 'backward' | 'none') => Promise<void>
|
|
19
|
+
) => {
|
|
20
|
+
currentRouteTransition = transitionFn;
|
|
15
21
|
},
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
createViewTransition: async () => {
|
|
24
|
+
if (currentRouteTransition) {
|
|
25
|
+
const { navigationDirection } = RouterController.state;
|
|
26
|
+
await currentRouteTransition(navigationDirection);
|
|
27
|
+
}
|
|
20
28
|
},
|
|
21
29
|
|
|
22
30
|
storeConnectedWallet: async (wcLinking: WalletDeepLink, pressedWallet?: WcWallet) => {
|
|
@@ -26,7 +26,8 @@ export function AllWalletsView() {
|
|
|
26
26
|
|
|
27
27
|
const onWalletPress = (wallet: WcWallet) => {
|
|
28
28
|
const isExternal =
|
|
29
|
-
wallet.id === ConstantsUtil.
|
|
29
|
+
wallet.id === ConstantsUtil.PHANTOM_CUSTOM_WALLET.id ||
|
|
30
|
+
wallet.id === ConstantsUtil.SOLFLARE_CUSTOM_WALLET.id ||
|
|
30
31
|
wallet.id === ConstantsUtil.COINBASE_EXPLORER_ID;
|
|
31
32
|
if (isExternal) {
|
|
32
33
|
RouterController.push('ConnectingExternal', { wallet });
|
|
@@ -31,8 +31,9 @@ export function ConnectView() {
|
|
|
31
31
|
|
|
32
32
|
const onWalletPress = (wallet: WcWallet, isInstalled?: boolean) => {
|
|
33
33
|
const isExternal =
|
|
34
|
-
wallet.id === ConstantsUtil.
|
|
35
|
-
wallet.id === ConstantsUtil.COINBASE_EXPLORER_ID
|
|
34
|
+
wallet.id === ConstantsUtil.PHANTOM_CUSTOM_WALLET.id ||
|
|
35
|
+
wallet.id === ConstantsUtil.COINBASE_EXPLORER_ID ||
|
|
36
|
+
wallet.id === ConstantsUtil.SOLFLARE_CUSTOM_WALLET.id;
|
|
36
37
|
if (isExternal) {
|
|
37
38
|
RouterController.push('ConnectingExternal', { wallet });
|
|
38
39
|
} else {
|
|
@@ -39,8 +39,10 @@ export function ConnectingExternalView() {
|
|
|
39
39
|
try {
|
|
40
40
|
const wallet = RouterController.state.data?.wallet;
|
|
41
41
|
if (wallet) {
|
|
42
|
-
if (wallet.id === ConstantsUtil.
|
|
42
|
+
if (wallet.id === ConstantsUtil.PHANTOM_CUSTOM_WALLET.id) {
|
|
43
43
|
await connect('phantom');
|
|
44
|
+
} else if (wallet.id === ConstantsUtil.SOLFLARE_CUSTOM_WALLET.id) {
|
|
45
|
+
await connect('solflare');
|
|
44
46
|
} else if (wallet.id === ConstantsUtil.COINBASE_EXPLORER_ID) {
|
|
45
47
|
await connect('coinbase');
|
|
46
48
|
} else {
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
ConnectionController,
|
|
14
14
|
ConnectionsController,
|
|
15
15
|
EventsController,
|
|
16
|
-
ModalController,
|
|
17
16
|
OptionsController,
|
|
18
17
|
RouterController,
|
|
19
18
|
SnackController
|
|
@@ -73,7 +72,6 @@ export function ConnectingSiweView() {
|
|
|
73
72
|
if (ConnectionsController.state.activeAddress) {
|
|
74
73
|
setIsDisconnecting(true);
|
|
75
74
|
await disconnect();
|
|
76
|
-
ModalController.close();
|
|
77
75
|
setIsDisconnecting(false);
|
|
78
76
|
} else {
|
|
79
77
|
RouterController.push('Connect');
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
RouterController,
|
|
14
14
|
EventsController,
|
|
15
15
|
ConnectionsController,
|
|
16
|
-
ModalController,
|
|
17
16
|
OptionsController,
|
|
18
17
|
AssetController
|
|
19
18
|
} from '@reown/appkit-core-react-native';
|
|
@@ -34,7 +33,7 @@ export function NetworksView() {
|
|
|
34
33
|
const itemGap = Math.abs(
|
|
35
34
|
Math.trunc((usableWidth - numColumns * CardSelectWidth) / numColumns) / 2
|
|
36
35
|
);
|
|
37
|
-
const { switchNetwork } = useAppKit();
|
|
36
|
+
const { switchNetwork, back } = useAppKit();
|
|
38
37
|
|
|
39
38
|
const networkList = isConnected ? ConnectionsController.getConnectedNetworks() : networks;
|
|
40
39
|
|
|
@@ -46,12 +45,7 @@ export function NetworksView() {
|
|
|
46
45
|
const networksTemplate = () => {
|
|
47
46
|
const onNetworkPress = async (network: AppKitNetwork) => {
|
|
48
47
|
await switchNetwork(network);
|
|
49
|
-
|
|
50
|
-
if (RouterController.state.history.length > 1) {
|
|
51
|
-
RouterController.goBack();
|
|
52
|
-
} else {
|
|
53
|
-
ModalController.close();
|
|
54
|
-
}
|
|
48
|
+
back();
|
|
55
49
|
};
|
|
56
50
|
|
|
57
51
|
return networkList.map(network => {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { ModalController, RouterController } from '@reown/appkit-core-react-native';
|
|
3
2
|
import { IconLink, Text, FlexView } from '@reown/appkit-ui-react-native';
|
|
3
|
+
import { useAppKit } from '../../../AppKitContext';
|
|
4
4
|
|
|
5
5
|
interface HeaderProps {
|
|
6
6
|
onSettingsPress: () => void;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function Header({ onSettingsPress }: HeaderProps) {
|
|
10
|
+
const { back } = useAppKit();
|
|
11
|
+
|
|
10
12
|
const handleGoBack = () => {
|
|
11
|
-
|
|
12
|
-
RouterController.goBack();
|
|
13
|
-
} else {
|
|
14
|
-
ModalController.close();
|
|
15
|
-
}
|
|
13
|
+
back();
|
|
16
14
|
};
|
|
17
15
|
|
|
18
16
|
return (
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* eslint-disable valtio/state-snapshot-rule */
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
3
|
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
4
|
-
import Modal from 'react-native
|
|
5
|
-
import { FlatList, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { FlatList, StyleSheet, View, Modal } from 'react-native';
|
|
6
5
|
import {
|
|
7
6
|
FlexView,
|
|
8
7
|
IconLink,
|
|
@@ -135,69 +134,63 @@ export function SelectPaymentModal({ title, visible, onClose }: SelectPaymentMod
|
|
|
135
134
|
}, [visible]);
|
|
136
135
|
|
|
137
136
|
return (
|
|
138
|
-
<Modal
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
137
|
+
<Modal visible={visible} transparent animationType="slide" onRequestClose={onClose}>
|
|
138
|
+
<View style={styles.modalContent}>
|
|
139
|
+
<FlexView style={[styles.container, { backgroundColor: Theme['bg-100'] }]}>
|
|
140
|
+
<FlexView
|
|
141
|
+
alignItems="center"
|
|
142
|
+
justifyContent="space-between"
|
|
143
|
+
flexDirection="row"
|
|
144
|
+
style={styles.header}
|
|
145
|
+
>
|
|
146
|
+
<IconLink icon="arrowLeft" onPress={onClose} testID="payment-modal-button-back" />
|
|
147
|
+
{!!title && <Text variant="paragraph-600">{title}</Text>}
|
|
148
|
+
<View style={styles.iconPlaceholder} />
|
|
149
|
+
</FlexView>
|
|
150
|
+
<Text variant="small-500" color="fg-150" style={styles.subtitle}>
|
|
151
|
+
Pay with
|
|
152
|
+
</Text>
|
|
153
|
+
<FlexView>
|
|
154
|
+
<FlatList
|
|
155
|
+
data={availablePaymentMethods}
|
|
156
|
+
renderItem={renderPaymentMethod}
|
|
157
|
+
ref={paymentMethodsRef}
|
|
158
|
+
style={styles.paymentMethodsContainer}
|
|
159
|
+
contentContainerStyle={styles.paymentMethodsContent}
|
|
160
|
+
fadingEdgeLength={20}
|
|
161
|
+
keyExtractor={item => item.paymentMethod}
|
|
162
|
+
horizontal
|
|
163
|
+
showsHorizontalScrollIndicator={false}
|
|
164
|
+
/>
|
|
165
|
+
</FlexView>
|
|
166
|
+
<Separator style={styles.separator} color="gray-glass-010" />
|
|
167
|
+
<Text variant="small-500" color="fg-150" style={styles.subtitle}>
|
|
168
|
+
Providers
|
|
169
|
+
</Text>
|
|
163
170
|
<FlatList
|
|
164
|
-
data={
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
contentContainerStyle={styles.
|
|
171
|
+
data={sortedQuotes}
|
|
172
|
+
bounces={false}
|
|
173
|
+
renderItem={renderQuote}
|
|
174
|
+
extraData={selectedPaymentMethod}
|
|
175
|
+
contentContainerStyle={styles.listContent}
|
|
176
|
+
ItemSeparatorComponent={renderSeparator}
|
|
169
177
|
fadingEdgeLength={20}
|
|
170
|
-
keyExtractor={item => item.
|
|
171
|
-
|
|
172
|
-
|
|
178
|
+
keyExtractor={item => `${item.serviceProvider}-${item.paymentMethodType}`}
|
|
179
|
+
getItemLayout={(_, index) => ({
|
|
180
|
+
length: QUOTE_ITEM_HEIGHT + SEPARATOR_HEIGHT,
|
|
181
|
+
offset: (QUOTE_ITEM_HEIGHT + SEPARATOR_HEIGHT) * index,
|
|
182
|
+
index
|
|
183
|
+
})}
|
|
173
184
|
/>
|
|
174
185
|
</FlexView>
|
|
175
|
-
|
|
176
|
-
<Text variant="small-500" color="fg-150" style={styles.subtitle}>
|
|
177
|
-
Providers
|
|
178
|
-
</Text>
|
|
179
|
-
<FlatList
|
|
180
|
-
data={sortedQuotes}
|
|
181
|
-
bounces={false}
|
|
182
|
-
renderItem={renderQuote}
|
|
183
|
-
extraData={selectedPaymentMethod}
|
|
184
|
-
contentContainerStyle={styles.listContent}
|
|
185
|
-
ItemSeparatorComponent={renderSeparator}
|
|
186
|
-
fadingEdgeLength={20}
|
|
187
|
-
keyExtractor={item => `${item.serviceProvider}-${item.paymentMethodType}`}
|
|
188
|
-
getItemLayout={(_, index) => ({
|
|
189
|
-
length: QUOTE_ITEM_HEIGHT + SEPARATOR_HEIGHT,
|
|
190
|
-
offset: (QUOTE_ITEM_HEIGHT + SEPARATOR_HEIGHT) * index,
|
|
191
|
-
index
|
|
192
|
-
})}
|
|
193
|
-
/>
|
|
194
|
-
</FlexView>
|
|
186
|
+
</View>
|
|
195
187
|
</Modal>
|
|
196
188
|
);
|
|
197
189
|
}
|
|
198
190
|
const styles = StyleSheet.create({
|
|
199
|
-
|
|
191
|
+
modalContent: {
|
|
200
192
|
margin: 0,
|
|
193
|
+
flex: 1,
|
|
201
194
|
justifyContent: 'flex-end'
|
|
202
195
|
},
|
|
203
196
|
header: {
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { ScrollView } from 'react-native';
|
|
4
4
|
import { NumberUtil } from '@reown/appkit-common-react-native';
|
|
5
5
|
import { RouterController, SwapController } from '@reown/appkit-core-react-native';
|
|
6
|
-
import {
|
|
7
|
-
Button,
|
|
8
|
-
FlexView,
|
|
9
|
-
Icon,
|
|
10
|
-
Spacing,
|
|
11
|
-
Text,
|
|
12
|
-
TokenButton,
|
|
13
|
-
UiUtil
|
|
14
|
-
} from '@reown/appkit-ui-react-native';
|
|
6
|
+
import { Button, FlexView, Icon, Text, TokenButton, UiUtil } from '@reown/appkit-ui-react-native';
|
|
15
7
|
import { SwapDetails } from '../../partials/w3m-swap-details';
|
|
16
8
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
17
|
-
import { useKeyboard } from '../../hooks/useKeyboard';
|
|
18
9
|
import styles from './styles';
|
|
19
10
|
|
|
20
11
|
export function SwapPreviewView() {
|
|
21
12
|
const { padding } = useCustomDimensions();
|
|
22
|
-
const { keyboardShown, keyboardHeight } = useKeyboard();
|
|
23
13
|
const {
|
|
24
14
|
sourceToken,
|
|
25
15
|
sourceTokenAmount,
|
|
@@ -37,11 +27,6 @@ export function SwapPreviewView() {
|
|
|
37
27
|
NumberUtil.parseLocalStringToNumber(sourceTokenAmount) * sourceTokenPriceInUSD;
|
|
38
28
|
const toTokenMarketValue = NumberUtil.parseLocalStringToNumber(toTokenAmount) * toTokenPriceInUSD;
|
|
39
29
|
|
|
40
|
-
const paddingBottom = Platform.select({
|
|
41
|
-
android: keyboardShown ? keyboardHeight + Spacing['2xl'] : Spacing['2xl'],
|
|
42
|
-
default: Spacing['2xl']
|
|
43
|
-
});
|
|
44
|
-
|
|
45
30
|
const loading =
|
|
46
31
|
loadingQuote || loadingBuildTransaction || loadingTransaction || loadingApprovalTransaction;
|
|
47
32
|
|
|
@@ -75,12 +60,8 @@ export function SwapPreviewView() {
|
|
|
75
60
|
}, []);
|
|
76
61
|
|
|
77
62
|
return (
|
|
78
|
-
<ScrollView
|
|
79
|
-
|
|
80
|
-
bounces={false}
|
|
81
|
-
keyboardShouldPersistTaps="always"
|
|
82
|
-
>
|
|
83
|
-
<FlexView padding="l" justifyContent="center" style={{ paddingBottom }}>
|
|
63
|
+
<ScrollView style={{ paddingHorizontal: padding }} bounces={false}>
|
|
64
|
+
<FlexView padding={['l', 'l', '2xl', 'l']} justifyContent="center">
|
|
84
65
|
<FlexView flexDirection="row" justifyContent="space-between">
|
|
85
66
|
<FlexView>
|
|
86
67
|
<Text variant="small-400" color="fg-150">
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ScrollView,
|
|
5
|
+
SectionList,
|
|
6
|
+
View,
|
|
7
|
+
type SectionListData,
|
|
8
|
+
type StyleProp,
|
|
9
|
+
type ViewStyle
|
|
10
|
+
} from 'react-native';
|
|
4
11
|
import {
|
|
5
12
|
FlexView,
|
|
6
13
|
IconLink,
|
|
@@ -30,9 +37,10 @@ import { createSections } from './utils';
|
|
|
30
37
|
interface Props {
|
|
31
38
|
onClose: () => void;
|
|
32
39
|
type?: SwapInputTarget;
|
|
40
|
+
style?: StyleProp<ViewStyle>;
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
export function SwapSelectTokenView({ onClose, type }: Props) {
|
|
43
|
+
export function SwapSelectTokenView({ onClose, type, style }: Props) {
|
|
36
44
|
const { padding } = useCustomDimensions();
|
|
37
45
|
const Theme = useTheme();
|
|
38
46
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
@@ -77,7 +85,8 @@ export function SwapSelectTokenView({ onClose, type }: Props) {
|
|
|
77
85
|
{
|
|
78
86
|
paddingHorizontal: padding,
|
|
79
87
|
backgroundColor: Theme['bg-100']
|
|
80
|
-
}
|
|
88
|
+
},
|
|
89
|
+
style
|
|
81
90
|
]}
|
|
82
91
|
>
|
|
83
92
|
<FlexView
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import Modal from 'react-native-modal';
|
|
3
|
+
import { ScrollView, Modal } from 'react-native';
|
|
5
4
|
import {
|
|
6
5
|
ConnectionsController,
|
|
7
6
|
ConstantsUtil,
|
|
@@ -10,7 +9,7 @@ import {
|
|
|
10
9
|
SwapController,
|
|
11
10
|
type SwapInputTarget
|
|
12
11
|
} from '@reown/appkit-core-react-native';
|
|
13
|
-
import { Button, FlexView, IconLink,
|
|
12
|
+
import { Button, FlexView, IconLink, useTheme } from '@reown/appkit-ui-react-native';
|
|
14
13
|
import { NumberUtil } from '@reown/appkit-common-react-native';
|
|
15
14
|
|
|
16
15
|
import { useKeyboard } from '../../hooks/useKeyboard';
|
|
@@ -37,7 +36,7 @@ export function SwapView() {
|
|
|
37
36
|
} = useSnapshot(SwapController.state);
|
|
38
37
|
const Theme = useTheme();
|
|
39
38
|
const { padding } = useCustomDimensions();
|
|
40
|
-
const { keyboardShown
|
|
39
|
+
const { keyboardShown } = useKeyboard();
|
|
41
40
|
const [showModal, setShowModal] = useState<SwapInputTarget | undefined>();
|
|
42
41
|
const showDetails = !!sourceToken && !!toToken && !inputError;
|
|
43
42
|
|
|
@@ -51,11 +50,6 @@ export function SwapView() {
|
|
|
51
50
|
token => token.address === SwapController.state.toToken?.address
|
|
52
51
|
) >= 0;
|
|
53
52
|
|
|
54
|
-
const paddingBottom = Platform.select({
|
|
55
|
-
android: keyboardShown ? keyboardHeight + Spacing['2xl'] : Spacing['2xl'],
|
|
56
|
-
default: Spacing['2xl']
|
|
57
|
-
});
|
|
58
|
-
|
|
59
53
|
const getActionButtonState = () => {
|
|
60
54
|
if (!SwapController.state.sourceToken || !SwapController.state.toToken) {
|
|
61
55
|
return { text: 'Select token', disabled: true };
|
|
@@ -159,11 +153,11 @@ export function SwapView() {
|
|
|
159
153
|
return (
|
|
160
154
|
<>
|
|
161
155
|
<ScrollView
|
|
162
|
-
style={{ paddingHorizontal: padding }}
|
|
156
|
+
style={[{ paddingHorizontal: padding }, keyboardShown && styles.withKeyboard]}
|
|
163
157
|
bounces={false}
|
|
164
158
|
keyboardShouldPersistTaps="always"
|
|
165
159
|
>
|
|
166
|
-
<FlexView padding=
|
|
160
|
+
<FlexView padding={['l', 'l', '2xl', 'l']} alignItems="center" justifyContent="center">
|
|
167
161
|
<SwapInput
|
|
168
162
|
token={sourceToken}
|
|
169
163
|
value={sourceTokenAmount}
|
|
@@ -210,15 +204,8 @@ export function SwapView() {
|
|
|
210
204
|
</Button>
|
|
211
205
|
</FlexView>
|
|
212
206
|
</ScrollView>
|
|
213
|
-
<Modal
|
|
214
|
-
|
|
215
|
-
useNativeDriver
|
|
216
|
-
useNativeDriverForBackdrop
|
|
217
|
-
onBackdropPress={onModalClose}
|
|
218
|
-
onDismiss={onModalClose}
|
|
219
|
-
style={styles.modal}
|
|
220
|
-
>
|
|
221
|
-
<SwapSelectTokenView onClose={onModalClose} type={showModal} />
|
|
207
|
+
<Modal visible={!!showModal} transparent animationType="slide" onRequestClose={onModalClose}>
|
|
208
|
+
<SwapSelectTokenView style={styles.modalContent} onClose={onModalClose} type={showModal} />
|
|
222
209
|
</Modal>
|
|
223
210
|
</>
|
|
224
211
|
);
|