@reown/appkit-react-native 0.0.0-fix-height-calc-20250815174808 → 0.0.0-fix-height-calc-20250815195135
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/partials/w3m-all-wallets-list/components/Loading.js +113 -0
- package/lib/commonjs/partials/w3m-all-wallets-list/components/Loading.js.map +1 -0
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js +46 -0
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -0
- package/lib/commonjs/partials/w3m-all-wallets-list/index.js +15 -54
- package/lib/commonjs/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js +15 -46
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +1 -1
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-view/index.js +0 -2
- package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/components/Loading.js +109 -0
- package/lib/module/partials/w3m-all-wallets-list/components/Loading.js.map +1 -0
- package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js +41 -0
- package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -0
- package/lib/module/partials/w3m-all-wallets-list/index.js +18 -57
- package/lib/module/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-search/index.js +18 -49
- package/lib/module/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +1 -1
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-view/index.js +0 -2
- package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/Loading.d.ts +10 -0
- package/lib/typescript/partials/w3m-all-wallets-list/components/Loading.d.ts.map +1 -0
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts +14 -0
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts.map +1 -0
- package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/partials/w3m-all-wallets-list/components/Loading.tsx +47 -0
- package/src/partials/w3m-all-wallets-list/components/WalletItem.tsx +45 -0
- package/src/partials/w3m-all-wallets-list/index.tsx +16 -60
- package/src/partials/w3m-all-wallets-search/index.tsx +18 -57
- package/src/partials/w3m-header/index.tsx +1 -1
- package/src/views/w3m-connecting-view/index.tsx +0 -2
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CardSelectLoader, FlexView, useCustomDimensions } from '@reown/appkit-ui-react-native';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
4
|
+
|
|
5
|
+
interface LoadingProps {
|
|
6
|
+
itemWidth?: number;
|
|
7
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function _Loading({ itemWidth, containerStyle }: LoadingProps) {
|
|
11
|
+
const { maxWidth, maxHeight } = useCustomDimensions();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<FlexView
|
|
15
|
+
flexDirection="row"
|
|
16
|
+
flexWrap="wrap"
|
|
17
|
+
alignSelf="center"
|
|
18
|
+
padding={['0', '0', 's', 'xs']}
|
|
19
|
+
style={{ maxWidth, maxHeight }}
|
|
20
|
+
>
|
|
21
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
22
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
23
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
24
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
25
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
26
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
27
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
28
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
29
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
30
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
31
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
32
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
33
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
34
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
35
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
36
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
37
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
38
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
39
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
40
|
+
<CardSelectLoader style={[containerStyle, { width: itemWidth }]} />
|
|
41
|
+
</FlexView>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Loading = memo(_Loading, () => {
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useSnapshot } from 'valtio';
|
|
2
|
+
import { ApiController, AssetController, AssetUtil } from '@reown/appkit-core-react-native';
|
|
3
|
+
import { CardSelect, CardSelectLoader } from '@reown/appkit-ui-react-native';
|
|
4
|
+
import type { WcWallet } from '@reown/appkit-common-react-native';
|
|
5
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
|
|
8
|
+
interface WalletItemProps {
|
|
9
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
10
|
+
item: WcWallet;
|
|
11
|
+
itemWidth?: number;
|
|
12
|
+
imageHeaders?: Record<string, string>;
|
|
13
|
+
onItemPress: (wallet: WcWallet) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function WalletItem({
|
|
17
|
+
containerStyle,
|
|
18
|
+
item,
|
|
19
|
+
itemWidth,
|
|
20
|
+
imageHeaders,
|
|
21
|
+
onItemPress
|
|
22
|
+
}: WalletItemProps) {
|
|
23
|
+
const { walletImages } = useSnapshot(AssetController.state);
|
|
24
|
+
const isInstalled = ApiController.state.installed.find(wallet => wallet?.id === item?.id);
|
|
25
|
+
const imageSrc = AssetUtil.getWalletImage(item, walletImages);
|
|
26
|
+
|
|
27
|
+
if (!item?.id) {
|
|
28
|
+
return <CardSelectLoader style={[containerStyle, { width: itemWidth }]} />;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<CardSelect
|
|
33
|
+
imageSrc={imageSrc}
|
|
34
|
+
style={[containerStyle, { width: itemWidth }]}
|
|
35
|
+
imageHeaders={imageHeaders}
|
|
36
|
+
name={item?.name ?? 'Unknown'}
|
|
37
|
+
onPress={() => onItemPress(item)}
|
|
38
|
+
installed={!!isInstalled}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const MemoizedWalletItem = memo(WalletItem, (prevProps, nextProps) => {
|
|
44
|
+
return prevProps.item.id === nextProps.item.id;
|
|
45
|
+
});
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
|
-
import { FlatList
|
|
3
|
+
import { FlatList } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
ApiController,
|
|
6
|
-
AssetController,
|
|
7
|
-
AssetUtil,
|
|
8
6
|
OptionsController,
|
|
9
7
|
SnackController,
|
|
10
8
|
type OptionsControllerState
|
|
11
9
|
} from '@reown/appkit-core-react-native';
|
|
12
10
|
import { type WcWallet } from '@reown/appkit-common-react-native';
|
|
13
|
-
import {
|
|
14
|
-
CardSelect,
|
|
15
|
-
CardSelectLoader,
|
|
16
|
-
CardSelectHeight,
|
|
17
|
-
FlexView,
|
|
18
|
-
Spacing,
|
|
19
|
-
useCustomDimensions
|
|
20
|
-
} from '@reown/appkit-ui-react-native';
|
|
11
|
+
import { CardSelectHeight, Spacing, useCustomDimensions } from '@reown/appkit-ui-react-native';
|
|
21
12
|
import styles from './styles';
|
|
22
|
-
import { UiUtil } from '../../utils/UiUtil';
|
|
23
13
|
import { Placeholder } from '../w3m-placeholder';
|
|
14
|
+
import { Loading } from './components/Loading';
|
|
15
|
+
import { WalletItem } from './components/WalletItem';
|
|
24
16
|
|
|
25
17
|
interface AllWalletsListProps {
|
|
26
18
|
columns: number;
|
|
@@ -29,6 +21,8 @@ interface AllWalletsListProps {
|
|
|
29
21
|
headerHeight?: number;
|
|
30
22
|
}
|
|
31
23
|
|
|
24
|
+
const ITEM_HEIGHT = CardSelectHeight + Spacing.xs * 2;
|
|
25
|
+
|
|
32
26
|
export function AllWalletsList({
|
|
33
27
|
columns,
|
|
34
28
|
itemWidth,
|
|
@@ -38,9 +32,8 @@ export function AllWalletsList({
|
|
|
38
32
|
const [loading, setLoading] = useState<boolean>(ApiController.state.wallets.length === 0);
|
|
39
33
|
const [loadingError, setLoadingError] = useState<boolean>(false);
|
|
40
34
|
const [pageLoading, setPageLoading] = useState<boolean>(false);
|
|
41
|
-
const {
|
|
35
|
+
const { maxHeight, padding } = useCustomDimensions();
|
|
42
36
|
const { installed, featured, recommended, wallets } = useSnapshot(ApiController.state);
|
|
43
|
-
const { walletImages } = useSnapshot(AssetController.state);
|
|
44
37
|
const { customWallets } = useSnapshot(OptionsController.state) as OptionsControllerState;
|
|
45
38
|
const imageHeaders = ApiController._getApiHeaders();
|
|
46
39
|
const preloadedWallets = installed.length + featured.length + recommended.length;
|
|
@@ -64,55 +57,11 @@ export function AllWalletsList({
|
|
|
64
57
|
...(pageLoading ? (Array.from({ length: loadingItems }) as WcWallet[]) : [])
|
|
65
58
|
];
|
|
66
59
|
|
|
67
|
-
const ITEM_HEIGHT = CardSelectHeight + Spacing.xs * 2;
|
|
68
|
-
|
|
69
|
-
const loadingTemplate = (items: number) => {
|
|
70
|
-
return (
|
|
71
|
-
<FlexView
|
|
72
|
-
flexDirection="row"
|
|
73
|
-
flexWrap="wrap"
|
|
74
|
-
alignSelf="center"
|
|
75
|
-
padding={['0', '0', 's', 'xs']}
|
|
76
|
-
style={{ maxWidth, maxHeight }}
|
|
77
|
-
>
|
|
78
|
-
{Array.from({ length: items }).map((_, index) => (
|
|
79
|
-
<View key={index} style={[styles.itemContainer, { width: itemWidth }]}>
|
|
80
|
-
<CardSelectLoader />
|
|
81
|
-
</View>
|
|
82
|
-
))}
|
|
83
|
-
</FlexView>
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const walletTemplate = ({ item }: { item: WcWallet; index: number }) => {
|
|
88
|
-
const isInstalled = ApiController.state.installed.find(wallet => wallet?.id === item?.id);
|
|
89
|
-
if (!item?.id) {
|
|
90
|
-
return (
|
|
91
|
-
<View style={[styles.itemContainer, { width: itemWidth }]}>
|
|
92
|
-
<CardSelectLoader />
|
|
93
|
-
</View>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<View style={[styles.itemContainer, { width: itemWidth }]}>
|
|
99
|
-
<CardSelect
|
|
100
|
-
imageSrc={AssetUtil.getWalletImage(item, walletImages)}
|
|
101
|
-
imageHeaders={imageHeaders}
|
|
102
|
-
name={item?.name ?? 'Unknown'}
|
|
103
|
-
onPress={() => onItemPress(item)}
|
|
104
|
-
installed={!!isInstalled}
|
|
105
|
-
/>
|
|
106
|
-
</View>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
60
|
const initialFetch = async () => {
|
|
111
61
|
try {
|
|
112
62
|
setLoading(true);
|
|
113
63
|
setLoadingError(false);
|
|
114
64
|
await ApiController.fetchWallets({ page: 1 });
|
|
115
|
-
UiUtil.createViewTransition();
|
|
116
65
|
setLoading(false);
|
|
117
66
|
} catch (error) {
|
|
118
67
|
SnackController.showError('Failed to load wallets');
|
|
@@ -146,7 +95,7 @@ export function AllWalletsList({
|
|
|
146
95
|
}, []);
|
|
147
96
|
|
|
148
97
|
if (loading) {
|
|
149
|
-
return
|
|
98
|
+
return <Loading itemWidth={itemWidth} containerStyle={styles.itemContainer} />;
|
|
150
99
|
}
|
|
151
100
|
|
|
152
101
|
if (loadingError) {
|
|
@@ -171,7 +120,14 @@ export function AllWalletsList({
|
|
|
171
120
|
bounces={false}
|
|
172
121
|
numColumns={columns}
|
|
173
122
|
data={walletList}
|
|
174
|
-
renderItem={
|
|
123
|
+
renderItem={({ item }) => (
|
|
124
|
+
<WalletItem
|
|
125
|
+
item={item}
|
|
126
|
+
itemWidth={itemWidth}
|
|
127
|
+
imageHeaders={imageHeaders}
|
|
128
|
+
onItemPress={onItemPress}
|
|
129
|
+
/>
|
|
130
|
+
)}
|
|
175
131
|
style={{ maxHeight: maxHeight - headerHeight - Spacing['4xl'] }}
|
|
176
132
|
contentContainerStyle={[styles.contentContainer, { paddingHorizontal: padding + Spacing.xs }]}
|
|
177
133
|
onEndReached={fetchNextPage}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import { FlatList
|
|
3
|
-
import {
|
|
4
|
-
ApiController,
|
|
5
|
-
AssetController,
|
|
6
|
-
AssetUtil,
|
|
7
|
-
SnackController
|
|
8
|
-
} from '@reown/appkit-core-react-native';
|
|
2
|
+
import { FlatList } from 'react-native';
|
|
3
|
+
import { ApiController, SnackController } from '@reown/appkit-core-react-native';
|
|
9
4
|
import { type WcWallet } from '@reown/appkit-common-react-native';
|
|
10
|
-
import {
|
|
11
|
-
CardSelect,
|
|
12
|
-
CardSelectHeight,
|
|
13
|
-
CardSelectLoader,
|
|
14
|
-
FlexView,
|
|
15
|
-
Spacing,
|
|
16
|
-
useCustomDimensions
|
|
17
|
-
} from '@reown/appkit-ui-react-native';
|
|
5
|
+
import { CardSelectHeight, Spacing, useCustomDimensions } from '@reown/appkit-ui-react-native';
|
|
18
6
|
import { Placeholder } from '../w3m-placeholder';
|
|
19
7
|
import styles from './styles';
|
|
20
|
-
|
|
8
|
+
|
|
9
|
+
import { Loading } from '../w3m-all-wallets-list/components/Loading';
|
|
10
|
+
import { WalletItem } from '../w3m-all-wallets-list/components/WalletItem';
|
|
21
11
|
|
|
22
12
|
export interface AllWalletsSearchProps {
|
|
23
13
|
columns: number;
|
|
@@ -27,6 +17,8 @@ export interface AllWalletsSearchProps {
|
|
|
27
17
|
headerHeight?: number;
|
|
28
18
|
}
|
|
29
19
|
|
|
20
|
+
const ITEM_HEIGHT = CardSelectHeight + Spacing.xs * 2;
|
|
21
|
+
|
|
30
22
|
export function AllWalletsSearch({
|
|
31
23
|
searchQuery,
|
|
32
24
|
columns,
|
|
@@ -38,45 +30,7 @@ export function AllWalletsSearch({
|
|
|
38
30
|
const [loadingError, setLoadingError] = useState<boolean>(false);
|
|
39
31
|
const [prevSearchQuery, setPrevSearchQuery] = useState<string>('');
|
|
40
32
|
const imageHeaders = ApiController._getApiHeaders();
|
|
41
|
-
const {
|
|
42
|
-
const { walletImages } = useSnapshot(AssetController.state);
|
|
43
|
-
|
|
44
|
-
const ITEM_HEIGHT = CardSelectHeight + Spacing.xs * 2;
|
|
45
|
-
|
|
46
|
-
const walletTemplate = ({ item }: { item: WcWallet }) => {
|
|
47
|
-
const isInstalled = ApiController.state.installed.find(wallet => wallet?.id === item?.id);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<View key={item?.id} style={[styles.itemContainer, { width: itemWidth }]}>
|
|
51
|
-
<CardSelect
|
|
52
|
-
imageSrc={AssetUtil.getWalletImage(item, walletImages)}
|
|
53
|
-
imageHeaders={imageHeaders}
|
|
54
|
-
name={item?.name ?? 'Unknown'}
|
|
55
|
-
onPress={() => onItemPress(item)}
|
|
56
|
-
installed={!!isInstalled}
|
|
57
|
-
testID={`wallet-search-item-${item?.id}`}
|
|
58
|
-
/>
|
|
59
|
-
</View>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const loadingTemplate = (items: number) => {
|
|
64
|
-
return (
|
|
65
|
-
<FlexView
|
|
66
|
-
flexDirection="row"
|
|
67
|
-
flexWrap="wrap"
|
|
68
|
-
alignSelf="center"
|
|
69
|
-
padding={['0', '0', 's', 'xs']}
|
|
70
|
-
style={{ maxWidth, maxHeight: maxHeight - headerHeight }}
|
|
71
|
-
>
|
|
72
|
-
{Array.from({ length: items }).map((_, index) => (
|
|
73
|
-
<View key={index} style={[styles.itemContainer, { width: itemWidth }]}>
|
|
74
|
-
<CardSelectLoader />
|
|
75
|
-
</View>
|
|
76
|
-
))}
|
|
77
|
-
</FlexView>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
33
|
+
const { maxHeight, padding, isLandscape } = useCustomDimensions();
|
|
80
34
|
|
|
81
35
|
const emptyTemplate = () => {
|
|
82
36
|
return (
|
|
@@ -109,7 +63,7 @@ export function AllWalletsSearch({
|
|
|
109
63
|
}, [searchQuery, prevSearchQuery, searchFetch]);
|
|
110
64
|
|
|
111
65
|
if (loading) {
|
|
112
|
-
return
|
|
66
|
+
return <Loading itemWidth={itemWidth} containerStyle={styles.itemContainer} />;
|
|
113
67
|
}
|
|
114
68
|
|
|
115
69
|
if (loadingError) {
|
|
@@ -138,7 +92,14 @@ export function AllWalletsSearch({
|
|
|
138
92
|
bounces={false}
|
|
139
93
|
numColumns={columns}
|
|
140
94
|
data={ApiController.state.search}
|
|
141
|
-
renderItem={
|
|
95
|
+
renderItem={({ item }) => (
|
|
96
|
+
<WalletItem
|
|
97
|
+
item={item}
|
|
98
|
+
itemWidth={itemWidth}
|
|
99
|
+
imageHeaders={imageHeaders}
|
|
100
|
+
onItemPress={onItemPress}
|
|
101
|
+
/>
|
|
102
|
+
)}
|
|
142
103
|
style={{ maxHeight: maxHeight - headerHeight - Spacing['2xl'] }}
|
|
143
104
|
contentContainerStyle={[styles.contentContainer, { paddingHorizontal: padding + Spacing.xs }]}
|
|
144
105
|
keyExtractor={item => item.id}
|
|
@@ -14,7 +14,7 @@ export function Header() {
|
|
|
14
14
|
const { close, back } = useInternalAppKit();
|
|
15
15
|
const { data, view } = useSnapshot(RouterController.state);
|
|
16
16
|
const onHelpPress = () => {
|
|
17
|
-
RouterController.push('WhatIsAWallet');
|
|
17
|
+
RouterController.push('WhatIsAWallet', undefined, 'backward');
|
|
18
18
|
EventsController.sendEvent({ type: 'track', event: 'CLICK_WALLET_HELP' });
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -15,7 +15,6 @@ import { ConnectingQrCode } from '../../partials/w3m-connecting-qrcode';
|
|
|
15
15
|
import { ConnectingMobile } from '../../partials/w3m-connecting-mobile';
|
|
16
16
|
import { ConnectingWeb } from '../../partials/w3m-connecting-web';
|
|
17
17
|
import { ConnectingHeader } from '../../partials/w3m-connecting-header';
|
|
18
|
-
import { UiUtil } from '../../utils/UiUtil';
|
|
19
18
|
import { type Platform } from '@reown/appkit-common-react-native';
|
|
20
19
|
|
|
21
20
|
export function ConnectingView() {
|
|
@@ -77,7 +76,6 @@ export function ConnectingView() {
|
|
|
77
76
|
};
|
|
78
77
|
|
|
79
78
|
const onSelectPlatform = (tab: Platform) => {
|
|
80
|
-
UiUtil.createViewTransition();
|
|
81
79
|
setPlatform(tab);
|
|
82
80
|
};
|
|
83
81
|
|