From 5bb2a0f9cb58b955300111424cec7f5a045626a9 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Wed, 11 Dec 2024 13:36:08 -0500 Subject: [PATCH] fix missing header height on the sheet (#6315) --- src/components/change-wallet/WalletList.tsx | 15 +++++++++------ src/screens/AddWalletSheet.tsx | 1 - src/screens/ChangeWalletSheet.tsx | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/change-wallet/WalletList.tsx b/src/components/change-wallet/WalletList.tsx index a49b70ad6ef..ba23599e224 100644 --- a/src/components/change-wallet/WalletList.tsx +++ b/src/components/change-wallet/WalletList.tsx @@ -27,7 +27,7 @@ import { useTheme } from '@/theme'; import { DEVICE_HEIGHT } from '@/utils/deviceUtils'; const listTopPadding = 7.5; -const rowHeight = 59; +const listBottomPadding = 9.5; const transitionDuration = 75; const RowTypes = { @@ -66,7 +66,7 @@ const EmptyWalletList = styled(EmptyAssetList).attrs({ const WalletFlatList: FlatList = styled(FlatList).attrs(({ showDividers }: { showDividers: boolean }) => ({ contentContainerStyle: { - paddingBottom: showDividers ? 9.5 : 0, + paddingBottom: showDividers ? listBottomPadding : 0, paddingTop: listTopPadding, }, getItemLayout, @@ -118,6 +118,7 @@ const EditButtonLabel = styled(Text).attrs(({ theme: { colors }, editMode }: { t height: 40, }); +const HEADER_HEIGHT = 40; const FOOTER_HEIGHT = getExperimetalFlag(HARDWARE_WALLETS) ? 100 : 60; const LIST_PADDING_BOTTOM = 6; export const MAX_LIST_HEIGHT = DEVICE_HEIGHT - 220; @@ -125,8 +126,10 @@ const WALLET_ROW_HEIGHT = 59; const WATCH_ONLY_BOTTOM_PADDING = IS_ANDROID ? 20 : 0; const getWalletListHeight = (numWallets: number, watchOnly: boolean) => { - const baseHeight = !watchOnly ? FOOTER_HEIGHT + LIST_PADDING_BOTTOM : WATCH_ONLY_BOTTOM_PADDING; - const calculatedHeight = baseHeight + numWallets * (WALLET_ROW_HEIGHT + 6); + const baseHeight = !watchOnly ? FOOTER_HEIGHT + LIST_PADDING_BOTTOM + HEADER_HEIGHT : WATCH_ONLY_BOTTOM_PADDING; + const paddingBetweenRows = 6 * (numWallets - 1); + const rowHeight = WALLET_ROW_HEIGHT * numWallets; + const calculatedHeight = baseHeight + rowHeight + paddingBetweenRows; return Math.min(calculatedHeight, MAX_LIST_HEIGHT); }; @@ -181,7 +184,7 @@ export default function WalletList({ const row = { ...account, editMode, - height: rowHeight, + height: WALLET_ROW_HEIGHT, id: account.address, isOnlyAddress: filteredAccounts.length === 1, isReadOnly: wallet.type === WalletTypes.readOnly, @@ -264,7 +267,7 @@ export default function WalletList({ return ( - + {lang.t('wallet.label')} diff --git a/src/screens/AddWalletSheet.tsx b/src/screens/AddWalletSheet.tsx index 6021f7ad295..4b010ff3f16 100644 --- a/src/screens/AddWalletSheet.tsx +++ b/src/screens/AddWalletSheet.tsx @@ -18,7 +18,6 @@ import CreateNewWallet from '@/assets/CreateNewWallet.png'; import PairHairwareWallet from '@/assets/PairHardwareWallet.png'; import ImportSecretPhraseOrPrivateKey from '@/assets/ImportSecretPhraseOrPrivateKey.png'; import WatchWalletIcon from '@/assets/watchWallet.png'; -import { captureException } from '@sentry/react-native'; import { useDispatch } from 'react-redux'; import { backupUserDataIntoCloud, diff --git a/src/screens/ChangeWalletSheet.tsx b/src/screens/ChangeWalletSheet.tsx index 9d59a858a3b..e58c9dda0d1 100644 --- a/src/screens/ChangeWalletSheet.tsx +++ b/src/screens/ChangeWalletSheet.tsx @@ -19,7 +19,6 @@ import { useTheme } from '@/theme'; import { EthereumAddress } from '@/entities'; import { getNotificationSettingsForWalletWithAddress } from '@/notifications/settings/storage'; import { remotePromoSheetsStore } from '@/state/remotePromoSheets/remotePromoSheets'; -import { DebugLayout } from '@/design-system'; export type EditWalletContextMenuActions = { edit: (walletId: string, address: EthereumAddress) => void;