Skip to content

Commit b7c54c5

Browse files
committed
wip flash list
1 parent 7873c62 commit b7c54c5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

app/components/UI/AccountSelectorList/AccountSelectorList.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Third party dependencies.
22
import React, { useCallback, useRef } from 'react';
3-
import { Alert, ListRenderItem, View, ViewStyle } from 'react-native';
4-
import { FlatList } from 'react-native-gesture-handler';
3+
import { Alert, View, ViewStyle } from 'react-native';
54
import { useSelector } from 'react-redux';
65
import { useNavigation } from '@react-navigation/native';
76
import { KeyringTypes } from '@metamask/keyring-controller';
@@ -31,6 +30,7 @@ import { Account, Assets } from '../../hooks/useAccounts';
3130
import Engine from '../../../core/Engine';
3231
import { removeAccountsFromPermissions } from '../../../core/Permissions';
3332
import Routes from '../../../constants/navigation/Routes';
33+
import { FlashList, type ListRenderItem } from '@shopify/flash-list';
3434

3535
// Internal dependencies.
3636
import { AccountSelectorListProps } from './AccountSelectorList.types';
@@ -299,14 +299,15 @@ const AccountSelectorList = ({
299299
}, [accounts, selectedAddresses, isAutoScrollEnabled]);
300300

301301
return (
302-
<FlatList
302+
<FlashList
303303
ref={accountListRef}
304304
onContentSizeChange={onContentSizeChanged}
305305
data={accounts}
306306
keyExtractor={getKeyExtractor}
307307
renderItem={renderAccountItem}
308+
estimatedItemSize={80}
308309
// Increasing number of items at initial render fixes scroll issue.
309-
initialNumToRender={999}
310+
// initialNumToRender={999}
310311
{...props}
311312
/>
312313
);

app/components/UI/AccountSelectorList/AccountSelectorList.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Third party dependencies.
22
import React from 'react';
3-
import { FlatListProps } from 'react-native';
3+
import { FlashListProps } from '@shopify/flash-list';
44

55
// External dependencies.
66
import { Account, UseAccounts } from '../../hooks/useAccounts';
@@ -9,7 +9,7 @@ import { Account, UseAccounts } from '../../hooks/useAccounts';
99
* AccountSelectorList props.
1010
*/
1111
export interface AccountSelectorListProps
12-
extends Partial<FlatListProps<Account>>,
12+
extends Partial<FlashListProps<Account>>,
1313
Omit<UseAccounts, 'evmAccounts'> {
1414
/**
1515
* Optional callback to trigger when account is selected.

0 commit comments

Comments
 (0)