-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathAccountListCell.tsx
More file actions
56 lines (50 loc) · 1.6 KB
/
Copy pathAccountListCell.tsx
File metadata and controls
56 lines (50 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React, { memo, useCallback } from 'react';
import { View } from 'react-native';
import { useStyles } from '../../../../hooks';
import AccountCell from '../../AccountCell';
import createStyles from '../MultichainAccountSelectorList.styles';
import { AccountListCellProps } from './AccountListCell.types';
import Checkbox from '../../../../components/Checkbox';
import { ACCOUNT_LIST_CELL_TEST_IDS } from './AccountListCell.testIds';
const AccountListCell = memo(
({
accountGroup,
avatarAccountType,
isSelected,
onSelectAccount,
showCheckbox = false,
chainId,
hideMenu = false,
}: AccountListCellProps) => {
const { styles } = useStyles(createStyles, {
isSelected,
});
const handlePress = useCallback(() => {
onSelectAccount(accountGroup);
}, [accountGroup, onSelectAccount]);
return (
<View style={styles.accountItem}>
<View style={styles.accountCellWrapper}>
<AccountCell
startAccessory={
showCheckbox ? (
<View
testID={`${ACCOUNT_LIST_CELL_TEST_IDS.ACCOUNT_LIST_CELL}${accountGroup.id}`}
>
<Checkbox isChecked={isSelected} onPress={handlePress} />
</View>
) : undefined
}
accountGroup={accountGroup}
avatarAccountType={avatarAccountType}
chainId={chainId}
hideMenu={hideMenu}
onSelectAccount={handlePress}
/>
</View>
</View>
);
},
);
AccountListCell.displayName = 'AccountListCell';
export default AccountListCell;