@reown/appkit-react-native 0.0.0-fix-height-calc-20250815195135 → 0.0.0-fix-ui-changes-20250828183750
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 +7 -5
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +1 -2
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/index.js +1 -6
- package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-router/index.js +7 -1
- package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/components/Loading.js +7 -97
- package/lib/commonjs/partials/w3m-all-wallets-list/components/Loading.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js +5 -4
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js +85 -0
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -0
- package/lib/commonjs/partials/w3m-all-wallets-list/index.js +7 -41
- package/lib/commonjs/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/styles.js +8 -4
- package/lib/commonjs/partials/w3m-all-wallets-list/styles.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js +7 -38
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-search/styles.js +2 -2
- package/lib/commonjs/partials/w3m-all-wallets-search/styles.js.map +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/styles.js +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/styles.js.map +1 -1
- package/lib/commonjs/views/w3m-all-wallets-view/index.js +2 -19
- 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-onramp-checkout-view/index.js +160 -152
- package/lib/commonjs/views/w3m-onramp-checkout-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/SelectPaymentModal.js +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/SelectPaymentModal.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-modal/index.js +155 -0
- package/lib/commonjs/views/w3m-swap-view/components/select-token-modal/index.js.map +1 -0
- package/lib/commonjs/views/w3m-swap-view/components/{select-token-view → select-token-modal}/styles.js +4 -2
- package/lib/commonjs/views/w3m-swap-view/components/select-token-modal/styles.js.map +1 -0
- package/lib/commonjs/views/w3m-swap-view/components/select-token-modal/utils.js.map +1 -0
- package/lib/commonjs/views/w3m-swap-view/index.js +4 -10
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/styles.js +0 -5
- package/lib/commonjs/views/w3m-swap-view/styles.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js +1 -2
- package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-view/styles.js +1 -1
- package/lib/module/AppKit.js +7 -5
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +1 -2
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/modal/w3m-modal/index.js +2 -7
- package/lib/module/modal/w3m-modal/index.js.map +1 -1
- package/lib/module/modal/w3m-router/index.js +7 -1
- package/lib/module/modal/w3m-router/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/components/Loading.js +8 -98
- package/lib/module/partials/w3m-all-wallets-list/components/Loading.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js +5 -4
- package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js +81 -0
- package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -0
- package/lib/module/partials/w3m-all-wallets-list/index.js +7 -41
- package/lib/module/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/styles.js +8 -4
- package/lib/module/partials/w3m-all-wallets-list/styles.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-search/index.js +8 -39
- package/lib/module/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-search/styles.js +2 -2
- package/lib/module/partials/w3m-all-wallets-search/styles.js.map +1 -1
- package/lib/module/partials/w3m-selector-modal/styles.js +1 -1
- package/lib/module/partials/w3m-selector-modal/styles.js.map +1 -1
- package/lib/module/views/w3m-all-wallets-view/index.js +3 -20
- 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-onramp-checkout-view/index.js +162 -154
- package/lib/module/views/w3m-onramp-checkout-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/SelectPaymentModal.js +1 -1
- package/lib/module/views/w3m-onramp-view/components/SelectPaymentModal.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-modal/index.js +150 -0
- package/lib/module/views/w3m-swap-view/components/select-token-modal/index.js.map +1 -0
- package/lib/module/views/w3m-swap-view/components/{select-token-view → select-token-modal}/styles.js +4 -2
- package/lib/module/views/w3m-swap-view/components/select-token-modal/styles.js.map +1 -0
- package/lib/module/views/w3m-swap-view/components/select-token-modal/utils.js.map +1 -0
- package/lib/module/views/w3m-swap-view/index.js +5 -11
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/styles.js +0 -5
- package/lib/module/views/w3m-swap-view/styles.js.map +1 -1
- package/lib/module/views/w3m-wallet-compatible-networks-view/index.js +1 -2
- package/lib/module/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-view/styles.js +1 -1
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/Loading.d.ts +2 -4
- package/lib/typescript/partials/w3m-all-wallets-list/components/Loading.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts +2 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts +12 -0
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts.map +1 -0
- package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts +1 -3
- package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/styles.d.ts +7 -3
- package/lib/typescript/partials/w3m-all-wallets-list/styles.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts +1 -4
- package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-search/styles.d.ts +1 -1
- package/lib/typescript/partials/w3m-selector-modal/styles.d.ts +1 -1
- package/lib/typescript/views/w3m-all-wallets-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-checkout-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/{select-token-view → select-token-modal}/index.d.ts +2 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-modal/index.d.ts.map +1 -0
- package/lib/typescript/views/w3m-swap-view/components/{select-token-view → select-token-modal}/styles.d.ts +4 -2
- package/lib/typescript/views/w3m-swap-view/components/{select-token-view → select-token-modal}/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-modal/utils.d.ts.map +1 -0
- package/lib/typescript/views/w3m-swap-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/styles.d.ts +0 -5
- package/lib/typescript/views/w3m-swap-view/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-view/styles.d.ts +1 -1
- package/package.json +5 -5
- package/src/AppKit.ts +13 -5
- package/src/connectors/WalletConnectConnector.ts +2 -2
- package/src/modal/w3m-modal/index.tsx +2 -3
- package/src/modal/w3m-router/index.tsx +3 -1
- package/src/partials/w3m-all-wallets-list/components/Loading.tsx +4 -35
- package/src/partials/w3m-all-wallets-list/components/WalletItem.tsx +5 -3
- package/src/partials/w3m-all-wallets-list/components/WalletList.tsx +92 -0
- package/src/partials/w3m-all-wallets-list/index.tsx +7 -38
- package/src/partials/w3m-all-wallets-list/styles.ts +8 -4
- package/src/partials/w3m-all-wallets-search/index.tsx +6 -43
- package/src/partials/w3m-all-wallets-search/styles.ts +2 -2
- package/src/partials/w3m-selector-modal/styles.ts +1 -1
- package/src/views/w3m-all-wallets-view/index.tsx +2 -29
- package/src/views/w3m-connect-view/index.tsx +1 -1
- package/src/views/w3m-onramp-checkout-view/index.tsx +147 -143
- package/src/views/w3m-onramp-view/components/SelectPaymentModal.tsx +1 -1
- package/src/views/w3m-swap-view/components/select-token-modal/index.tsx +182 -0
- package/src/views/w3m-swap-view/components/{select-token-view → select-token-modal}/styles.ts +4 -2
- package/src/views/w3m-swap-view/index.tsx +3 -5
- package/src/views/w3m-swap-view/styles.ts +1 -5
- package/src/views/w3m-wallet-compatible-networks-view/index.tsx +1 -1
- package/src/views/w3m-wallet-send-view/styles.ts +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js +0 -145
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js.map +0 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/styles.js.map +0 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/utils.js.map +0 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js +0 -140
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js.map +0 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/styles.js.map +0 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/utils.js.map +0 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts.map +0 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/utils.d.ts.map +0 -1
- package/src/views/w3m-swap-view/components/select-token-view/index.tsx +0 -176
- /package/lib/commonjs/views/w3m-swap-view/components/{select-token-view → select-token-modal}/utils.js +0 -0
- /package/lib/module/views/w3m-swap-view/components/{select-token-view → select-token-modal}/utils.js +0 -0
- /package/lib/typescript/views/w3m-swap-view/components/{select-token-view → select-token-modal}/utils.d.ts +0 -0
- /package/src/views/w3m-swap-view/components/{select-token-view → select-token-modal}/utils.ts +0 -0
|
@@ -15,14 +15,16 @@ import {
|
|
|
15
15
|
Spacing,
|
|
16
16
|
Text,
|
|
17
17
|
Toggle,
|
|
18
|
+
useCustomDimensions,
|
|
18
19
|
useTheme
|
|
19
20
|
} from '@reown/appkit-ui-react-native';
|
|
20
|
-
import { StyleSheet } from 'react-native';
|
|
21
|
+
import { ScrollView, StyleSheet } from 'react-native';
|
|
21
22
|
import { useSnapshot } from 'valtio';
|
|
22
23
|
import { NumberUtil, StringUtil } from '@reown/appkit-common-react-native';
|
|
23
24
|
|
|
24
25
|
export function OnRampCheckoutView() {
|
|
25
26
|
const Theme = useTheme();
|
|
27
|
+
const { padding } = useCustomDimensions();
|
|
26
28
|
const { themeMode } = useSnapshot(ThemeController.state);
|
|
27
29
|
const { networkImages } = useSnapshot(AssetController.state);
|
|
28
30
|
const { selectedQuote, selectedPaymentMethod, purchaseCurrency } = useSnapshot(
|
|
@@ -49,164 +51,166 @@ export function OnRampCheckoutView() {
|
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
return (
|
|
52
|
-
<
|
|
53
|
-
<FlexView
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
<ScrollView style={{ paddingHorizontal: padding }}>
|
|
55
|
+
<FlexView padding={['2xl', 'l', '4xl', 'l']}>
|
|
56
|
+
<FlexView alignItems="center">
|
|
57
|
+
<Text color="fg-200">You Buy</Text>
|
|
58
|
+
<FlexView flexDirection="row" alignItems="center">
|
|
59
|
+
<Text style={[styles.amount, { color: Theme['fg-100'] }]}>{value}</Text>
|
|
60
|
+
<Text variant="paragraph-400" color="fg-200">
|
|
61
|
+
{symbol?.split('_')[0] ?? symbol ?? ''}
|
|
62
|
+
</Text>
|
|
63
|
+
</FlexView>
|
|
64
|
+
<FlexView flexDirection="row" alignItems="center" justifyContent="center">
|
|
65
|
+
<Text color="fg-200">via </Text>
|
|
66
|
+
{providerImage ? <Image source={providerImage} style={styles.providerImage} /> : null}
|
|
67
|
+
<Text color="fg-200">{StringUtil.capitalize(selectedQuote?.serviceProvider)}</Text>
|
|
68
|
+
</FlexView>
|
|
65
69
|
</FlexView>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<Text color="fg-200">You Pay</Text>
|
|
75
|
-
<Text>
|
|
76
|
-
{selectedQuote?.sourceAmount} {selectedQuote?.sourceCurrencyCode}
|
|
77
|
-
</Text>
|
|
78
|
-
</FlexView>
|
|
79
|
-
<FlexView
|
|
80
|
-
padding={['xs', 's', 'xs', 's']}
|
|
81
|
-
flexDirection="row"
|
|
82
|
-
justifyContent="space-between"
|
|
83
|
-
alignItems="center"
|
|
84
|
-
>
|
|
85
|
-
<Text color="fg-200">You Receive</Text>
|
|
86
|
-
<FlexView flexDirection="row" alignItems="center">
|
|
70
|
+
<Separator style={styles.separator} color="gray-glass-010" />
|
|
71
|
+
<FlexView
|
|
72
|
+
padding={['s', 's', 'xs', 's']}
|
|
73
|
+
flexDirection="row"
|
|
74
|
+
justifyContent="space-between"
|
|
75
|
+
alignItems="center"
|
|
76
|
+
>
|
|
77
|
+
<Text color="fg-200">You Pay</Text>
|
|
87
78
|
<Text>
|
|
88
|
-
{
|
|
79
|
+
{selectedQuote?.sourceAmount} {selectedQuote?.sourceCurrencyCode}
|
|
89
80
|
</Text>
|
|
90
|
-
{purchaseCurrency?.symbolImageUrl ? (
|
|
91
|
-
<Image
|
|
92
|
-
source={purchaseCurrency?.symbolImageUrl}
|
|
93
|
-
style={[styles.tokenImage, { borderColor: Theme['gray-glass-010'] }]}
|
|
94
|
-
/>
|
|
95
|
-
) : null}
|
|
96
81
|
</FlexView>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
82
|
+
<FlexView
|
|
83
|
+
padding={['xs', 's', 'xs', 's']}
|
|
84
|
+
flexDirection="row"
|
|
85
|
+
justifyContent="space-between"
|
|
86
|
+
alignItems="center"
|
|
87
|
+
>
|
|
88
|
+
<Text color="fg-200">You Receive</Text>
|
|
89
|
+
<FlexView flexDirection="row" alignItems="center">
|
|
90
|
+
<Text>
|
|
91
|
+
{value} {symbol?.split('_')[0] ?? ''}
|
|
92
|
+
</Text>
|
|
93
|
+
{purchaseCurrency?.symbolImageUrl ? (
|
|
94
|
+
<Image
|
|
95
|
+
source={purchaseCurrency?.symbolImageUrl}
|
|
96
|
+
style={[styles.tokenImage, { borderColor: Theme['gray-glass-010'] }]}
|
|
97
|
+
/>
|
|
98
|
+
) : null}
|
|
99
|
+
</FlexView>
|
|
107
100
|
</FlexView>
|
|
108
|
-
</FlexView>
|
|
109
|
-
<FlexView
|
|
110
|
-
padding={['xs', 's', 'm', 's']}
|
|
111
|
-
flexDirection="row"
|
|
112
|
-
alignItems="center"
|
|
113
|
-
justifyContent="space-between"
|
|
114
|
-
>
|
|
115
|
-
<Text color="fg-200">Pay with</Text>
|
|
116
101
|
<FlexView
|
|
102
|
+
padding={['xs', 's', 'xs', 's']}
|
|
117
103
|
flexDirection="row"
|
|
118
104
|
alignItems="center"
|
|
119
|
-
|
|
105
|
+
justifyContent="space-between"
|
|
120
106
|
>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
107
|
+
<Text color="fg-200">Network</Text>
|
|
108
|
+
<FlexView flexDirection="row" alignItems="center">
|
|
109
|
+
<Text>{purchaseCurrency?.chainName}</Text>
|
|
110
|
+
</FlexView>
|
|
111
|
+
</FlexView>
|
|
112
|
+
<FlexView
|
|
113
|
+
padding={['xs', 's', 'm', 's']}
|
|
114
|
+
flexDirection="row"
|
|
115
|
+
alignItems="center"
|
|
116
|
+
justifyContent="space-between"
|
|
117
|
+
>
|
|
118
|
+
<Text color="fg-200">Pay with</Text>
|
|
119
|
+
<FlexView
|
|
120
|
+
flexDirection="row"
|
|
121
|
+
alignItems="center"
|
|
122
|
+
style={[styles.paymentMethodContainer, { borderColor: Theme['gray-glass-020'] }]}
|
|
123
|
+
>
|
|
124
|
+
{paymentLogo ? (
|
|
125
|
+
<Image
|
|
126
|
+
source={paymentLogo}
|
|
127
|
+
style={styles.paymentMethodImage}
|
|
128
|
+
tintColor={Theme['fg-150']}
|
|
129
|
+
/>
|
|
130
|
+
) : null}
|
|
131
|
+
<Text variant="small-600" color="fg-150">
|
|
132
|
+
{selectedPaymentMethod?.name}
|
|
133
|
+
</Text>
|
|
134
|
+
</FlexView>
|
|
131
135
|
</FlexView>
|
|
132
|
-
</FlexView>
|
|
133
136
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
{showFees ? (
|
|
138
|
+
<Toggle
|
|
139
|
+
title={
|
|
140
|
+
<>
|
|
141
|
+
<Text variant="paragraph-400" color="fg-200">
|
|
142
|
+
Fees{' '}
|
|
143
|
+
{showTotalFee ? (
|
|
144
|
+
<Text variant="paragraph-400">
|
|
145
|
+
{selectedQuote?.totalFee} {selectedQuote?.sourceCurrencyCode}
|
|
146
|
+
</Text>
|
|
147
|
+
) : null}
|
|
148
|
+
</Text>
|
|
149
|
+
</>
|
|
150
|
+
}
|
|
151
|
+
style={[styles.feesToggle, { backgroundColor: Theme['gray-glass-002'] }]}
|
|
152
|
+
contentContainerStyle={styles.feesToggleContent}
|
|
153
|
+
>
|
|
154
|
+
{showNetworkFee ? (
|
|
155
|
+
<FlexView
|
|
156
|
+
flexDirection="row"
|
|
157
|
+
justifyContent="space-between"
|
|
158
|
+
style={[styles.toggleItem, { backgroundColor: Theme['gray-glass-002'] }]}
|
|
159
|
+
margin={['0', '0', 'xs', '0']}
|
|
160
|
+
>
|
|
161
|
+
<Text variant="small-500" color="fg-150">
|
|
162
|
+
Network Fees
|
|
163
|
+
</Text>
|
|
164
|
+
<FlexView flexDirection="row" alignItems="center">
|
|
165
|
+
{networkImage ? (
|
|
166
|
+
<Image
|
|
167
|
+
source={networkImage}
|
|
168
|
+
style={[styles.networkImage, { borderColor: Theme['gray-glass-010'] }]}
|
|
169
|
+
/>
|
|
170
|
+
) : null}
|
|
171
|
+
<Text variant="small-400">
|
|
172
|
+
{selectedQuote?.networkFee} {selectedQuote?.sourceCurrencyCode}
|
|
143
173
|
</Text>
|
|
144
|
-
|
|
145
|
-
</
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
margin={['0', '0', 'xs', '0']}
|
|
157
|
-
>
|
|
158
|
-
<Text variant="small-500" color="fg-150">
|
|
159
|
-
Network Fees
|
|
160
|
-
</Text>
|
|
161
|
-
<FlexView flexDirection="row" alignItems="center">
|
|
162
|
-
{networkImage ? (
|
|
163
|
-
<Image
|
|
164
|
-
source={networkImage}
|
|
165
|
-
style={[styles.networkImage, { borderColor: Theme['gray-glass-010'] }]}
|
|
166
|
-
/>
|
|
167
|
-
) : null}
|
|
174
|
+
</FlexView>
|
|
175
|
+
</FlexView>
|
|
176
|
+
) : null}
|
|
177
|
+
{showTransactionFee ? (
|
|
178
|
+
<FlexView
|
|
179
|
+
flexDirection="row"
|
|
180
|
+
justifyContent="space-between"
|
|
181
|
+
style={[styles.toggleItem, { backgroundColor: Theme['gray-glass-002'] }]}
|
|
182
|
+
>
|
|
183
|
+
<Text variant="small-500" color="fg-150">
|
|
184
|
+
Transaction Fees
|
|
185
|
+
</Text>
|
|
168
186
|
<Text variant="small-400">
|
|
169
|
-
{selectedQuote
|
|
187
|
+
{selectedQuote.transactionFee} {selectedQuote?.sourceCurrencyCode}
|
|
170
188
|
</Text>
|
|
171
189
|
</FlexView>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
style={styles.cancelButton}
|
|
195
|
-
onPress={RouterController.goBack}
|
|
196
|
-
>
|
|
197
|
-
Back
|
|
198
|
-
</Button>
|
|
199
|
-
<Button
|
|
200
|
-
variant="fill"
|
|
201
|
-
size="md"
|
|
202
|
-
style={styles.confirmButton}
|
|
203
|
-
onPress={onConfirm}
|
|
204
|
-
testID="button-confirm"
|
|
205
|
-
>
|
|
206
|
-
Confirm
|
|
207
|
-
</Button>
|
|
190
|
+
) : null}
|
|
191
|
+
</Toggle>
|
|
192
|
+
) : null}
|
|
193
|
+
<FlexView flexDirection="row" justifyContent="space-between" margin={['xl', '0', '0', '0']}>
|
|
194
|
+
<Button
|
|
195
|
+
variant="shade"
|
|
196
|
+
size="md"
|
|
197
|
+
style={styles.cancelButton}
|
|
198
|
+
onPress={RouterController.goBack}
|
|
199
|
+
>
|
|
200
|
+
Back
|
|
201
|
+
</Button>
|
|
202
|
+
<Button
|
|
203
|
+
variant="fill"
|
|
204
|
+
size="md"
|
|
205
|
+
style={styles.confirmButton}
|
|
206
|
+
onPress={onConfirm}
|
|
207
|
+
testID="button-confirm"
|
|
208
|
+
>
|
|
209
|
+
Confirm
|
|
210
|
+
</Button>
|
|
211
|
+
</FlexView>
|
|
208
212
|
</FlexView>
|
|
209
|
-
</
|
|
213
|
+
</ScrollView>
|
|
210
214
|
);
|
|
211
215
|
}
|
|
212
216
|
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useSnapshot } from 'valtio';
|
|
3
|
+
import {
|
|
4
|
+
Modal,
|
|
5
|
+
ScrollView,
|
|
6
|
+
SectionList,
|
|
7
|
+
View,
|
|
8
|
+
type SectionListData,
|
|
9
|
+
type StyleProp,
|
|
10
|
+
type ViewStyle
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import {
|
|
13
|
+
FlexView,
|
|
14
|
+
IconLink,
|
|
15
|
+
InputText,
|
|
16
|
+
ListToken,
|
|
17
|
+
ListTokenTotalHeight,
|
|
18
|
+
Separator,
|
|
19
|
+
Text,
|
|
20
|
+
TokenButton,
|
|
21
|
+
useTheme,
|
|
22
|
+
useCustomDimensions
|
|
23
|
+
} from '@reown/appkit-ui-react-native';
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
AssetController,
|
|
27
|
+
AssetUtil,
|
|
28
|
+
ConnectionsController,
|
|
29
|
+
SwapController,
|
|
30
|
+
type SwapControllerState
|
|
31
|
+
} from '@reown/appkit-core-react-native';
|
|
32
|
+
|
|
33
|
+
import { type SwapInputTarget, type SwapTokenWithBalance } from '@reown/appkit-common-react-native';
|
|
34
|
+
|
|
35
|
+
import { Placeholder } from '../../../../partials/w3m-placeholder';
|
|
36
|
+
import styles from './styles';
|
|
37
|
+
import { createSections } from './utils';
|
|
38
|
+
|
|
39
|
+
interface Props {
|
|
40
|
+
onClose: () => void;
|
|
41
|
+
visible: boolean;
|
|
42
|
+
type?: SwapInputTarget;
|
|
43
|
+
style?: StyleProp<ViewStyle>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function SwapSelectTokenModal({ onClose, type, style, visible }: Props) {
|
|
47
|
+
const { padding } = useCustomDimensions();
|
|
48
|
+
const Theme = useTheme();
|
|
49
|
+
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
50
|
+
const { networkImages } = useSnapshot(AssetController.state);
|
|
51
|
+
const { sourceToken, suggestedTokens, myTokensWithBalance } = useSnapshot(
|
|
52
|
+
SwapController.state
|
|
53
|
+
) as SwapControllerState;
|
|
54
|
+
|
|
55
|
+
const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
|
|
56
|
+
const [tokenSearch, setTokenSearch] = useState<string>('');
|
|
57
|
+
const isSourceToken = type === 'sourceToken';
|
|
58
|
+
|
|
59
|
+
const [filteredTokens, setFilteredTokens] = useState(
|
|
60
|
+
createSections(isSourceToken, tokenSearch, myTokensWithBalance)
|
|
61
|
+
);
|
|
62
|
+
const suggestedList = suggestedTokens
|
|
63
|
+
?.filter(token => token.address !== SwapController.state.sourceToken?.address)
|
|
64
|
+
.slice(0, 8);
|
|
65
|
+
|
|
66
|
+
const onSearchChange = (value: string) => {
|
|
67
|
+
setTokenSearch(value);
|
|
68
|
+
setFilteredTokens(createSections(isSourceToken, value, myTokensWithBalance));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const onTokenPress = (token: SwapTokenWithBalance) => {
|
|
72
|
+
if (isSourceToken) {
|
|
73
|
+
SwapController.setSourceToken(token);
|
|
74
|
+
} else {
|
|
75
|
+
SwapController.setToToken(token);
|
|
76
|
+
if (SwapController.state.sourceToken && SwapController.state.sourceTokenAmount) {
|
|
77
|
+
SwapController.swapTokens();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
onClose();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Modal visible={visible} transparent animationType="slide" onRequestClose={onClose}>
|
|
85
|
+
<FlexView
|
|
86
|
+
padding={['xl', '0', '0', '0']}
|
|
87
|
+
style={[
|
|
88
|
+
styles.container,
|
|
89
|
+
{
|
|
90
|
+
paddingHorizontal: padding,
|
|
91
|
+
backgroundColor: Theme['bg-100']
|
|
92
|
+
},
|
|
93
|
+
style
|
|
94
|
+
]}
|
|
95
|
+
>
|
|
96
|
+
<FlexView
|
|
97
|
+
flexDirection="row"
|
|
98
|
+
justifyContent="space-between"
|
|
99
|
+
alignItems="center"
|
|
100
|
+
padding={['0', 'm', 'm', 'm']}
|
|
101
|
+
>
|
|
102
|
+
<IconLink icon="chevronLeft" size="md" onPress={onClose} />
|
|
103
|
+
<Text variant="paragraph-600">Select token</Text>
|
|
104
|
+
<View style={styles.iconPlaceholder} />
|
|
105
|
+
</FlexView>
|
|
106
|
+
<FlexView margin={['0', '0', 'xs', '0']}>
|
|
107
|
+
<InputText
|
|
108
|
+
value={tokenSearch}
|
|
109
|
+
icon="search"
|
|
110
|
+
placeholder="Search token"
|
|
111
|
+
onChangeText={onSearchChange}
|
|
112
|
+
clearButtonMode="while-editing"
|
|
113
|
+
style={styles.input}
|
|
114
|
+
/>
|
|
115
|
+
{!isSourceToken && (
|
|
116
|
+
<>
|
|
117
|
+
<ScrollView
|
|
118
|
+
horizontal
|
|
119
|
+
showsHorizontalScrollIndicator={false}
|
|
120
|
+
bounces={false}
|
|
121
|
+
fadingEdgeLength={20}
|
|
122
|
+
style={styles.suggestedList}
|
|
123
|
+
contentContainerStyle={styles.suggestedListContent}
|
|
124
|
+
>
|
|
125
|
+
{suggestedList?.map((token, index) => (
|
|
126
|
+
<TokenButton
|
|
127
|
+
key={token.name}
|
|
128
|
+
text={token.symbol}
|
|
129
|
+
imageUrl={token.logoUri}
|
|
130
|
+
onPress={() => onTokenPress(token)}
|
|
131
|
+
style={index !== suggestedList.length - 1 ? styles.suggestedToken : undefined}
|
|
132
|
+
/>
|
|
133
|
+
))}
|
|
134
|
+
</ScrollView>
|
|
135
|
+
<Separator style={styles.suggestedSeparator} color="gray-glass-005" />
|
|
136
|
+
</>
|
|
137
|
+
)}
|
|
138
|
+
</FlexView>
|
|
139
|
+
<SectionList
|
|
140
|
+
sections={filteredTokens as SectionListData<SwapTokenWithBalance>[]}
|
|
141
|
+
bounces={false}
|
|
142
|
+
fadingEdgeLength={20}
|
|
143
|
+
contentContainerStyle={styles.tokenList}
|
|
144
|
+
renderSectionHeader={({ section: { title } }) => (
|
|
145
|
+
<Text
|
|
146
|
+
variant="paragraph-500"
|
|
147
|
+
color="fg-200"
|
|
148
|
+
style={[{ backgroundColor: Theme['bg-100'] }, styles.title]}
|
|
149
|
+
>
|
|
150
|
+
{title}
|
|
151
|
+
</Text>
|
|
152
|
+
)}
|
|
153
|
+
ListEmptyComponent={
|
|
154
|
+
<Placeholder
|
|
155
|
+
icon="coinPlaceholder"
|
|
156
|
+
title="No tokens found"
|
|
157
|
+
description="Your tokens will appear here"
|
|
158
|
+
/>
|
|
159
|
+
}
|
|
160
|
+
getItemLayout={(_, index) => ({
|
|
161
|
+
length: ListTokenTotalHeight,
|
|
162
|
+
offset: ListTokenTotalHeight * index,
|
|
163
|
+
index
|
|
164
|
+
})}
|
|
165
|
+
renderItem={({ item }) => (
|
|
166
|
+
<ListToken
|
|
167
|
+
key={item.name}
|
|
168
|
+
name={item.name}
|
|
169
|
+
imageSrc={item.logoUri}
|
|
170
|
+
networkSrc={networkImage}
|
|
171
|
+
value={item.value}
|
|
172
|
+
amount={item.quantity.numeric}
|
|
173
|
+
currency={item.symbol}
|
|
174
|
+
onPress={() => onTokenPress(item)}
|
|
175
|
+
disabled={item.address === sourceToken?.address}
|
|
176
|
+
/>
|
|
177
|
+
)}
|
|
178
|
+
/>
|
|
179
|
+
</FlexView>
|
|
180
|
+
</Modal>
|
|
181
|
+
);
|
|
182
|
+
}
|
package/src/views/w3m-swap-view/components/{select-token-view → select-token-modal}/styles.ts
RENAMED
|
@@ -8,7 +8,9 @@ export default StyleSheet.create({
|
|
|
8
8
|
borderBottomLeftRadius: 0,
|
|
9
9
|
borderBottomRightRadius: 0,
|
|
10
10
|
overflow: 'hidden',
|
|
11
|
-
|
|
11
|
+
margin: 0,
|
|
12
|
+
flex: 1,
|
|
13
|
+
justifyContent: 'flex-end'
|
|
12
14
|
},
|
|
13
15
|
title: {
|
|
14
16
|
paddingTop: Spacing['2xs']
|
|
@@ -29,7 +31,7 @@ export default StyleSheet.create({
|
|
|
29
31
|
marginRight: Spacing.s
|
|
30
32
|
},
|
|
31
33
|
suggestedSeparator: {
|
|
32
|
-
|
|
34
|
+
marginTop: Spacing.s
|
|
33
35
|
},
|
|
34
36
|
iconPlaceholder: {
|
|
35
37
|
height: 32,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import { ScrollView
|
|
3
|
+
import { ScrollView } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
ConnectionsController,
|
|
6
6
|
ConstantsUtil,
|
|
@@ -22,7 +22,7 @@ import { SwapInput } from '../../partials/w3m-swap-input';
|
|
|
22
22
|
import { useDebounceCallback } from '../../hooks/useDebounceCallback';
|
|
23
23
|
import { SwapDetails } from '../../partials/w3m-swap-details';
|
|
24
24
|
import styles from './styles';
|
|
25
|
-
import {
|
|
25
|
+
import { SwapSelectTokenModal } from './components/select-token-modal';
|
|
26
26
|
|
|
27
27
|
export function SwapView() {
|
|
28
28
|
const {
|
|
@@ -208,9 +208,7 @@ export function SwapView() {
|
|
|
208
208
|
</Button>
|
|
209
209
|
</FlexView>
|
|
210
210
|
</ScrollView>
|
|
211
|
-
<
|
|
212
|
-
<SwapSelectTokenView style={styles.modalContent} onClose={onModalClose} type={showModal} />
|
|
213
|
-
</Modal>
|
|
211
|
+
<SwapSelectTokenModal visible={!!showModal} onClose={onModalClose} type={showModal} />
|
|
214
212
|
</>
|
|
215
213
|
);
|
|
216
214
|
}
|
|
@@ -31,7 +31,7 @@ export function WalletCompatibleNetworks() {
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<ScrollView bounces={false} style={{ paddingHorizontal: padding }} fadingEdgeLength={20}>
|
|
34
|
-
<FlexView padding={['xl', 's', '
|
|
34
|
+
<FlexView padding={['xl', 's', 's', 's']}>
|
|
35
35
|
<Banner icon="warningCircle" text="You can only receive assets on these networks." />
|
|
36
36
|
{approvedNetworks.map((network, index) => (
|
|
37
37
|
<FlexView
|