diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts index 199387367fdc..1807ba8ccaca 100644 --- a/src/libs/actions/BankAccounts.ts +++ b/src/libs/actions/BankAccounts.ts @@ -393,7 +393,7 @@ function deletePaymentBankAccount(bankAccountID: number, personalPolicyID: strin const bankAccountFailureData = { ...bankAccount, errors: getMicroSecondOnyxErrorWithTranslationKey('bankAccount.error.deletePaymentBankAccount'), - pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, + pendingAction: null, }; const onyxData: OnyxData = { diff --git a/src/pages/settings/Wallet/PaymentMethodList.tsx b/src/pages/settings/Wallet/PaymentMethodList.tsx index 6b02aa0656cc..b85b203c3945 100644 --- a/src/pages/settings/Wallet/PaymentMethodList.tsx +++ b/src/pages/settings/Wallet/PaymentMethodList.tsx @@ -371,6 +371,7 @@ function PaymentMethodList({ isMethodActive, iconRight: itemIconRight ?? expensifyIcons.ThreeDots, shouldShowRightIcon, + canDismissError: true, }; }); return combinedPaymentMethods; diff --git a/src/pages/settings/Wallet/PaymentMethodListItem.tsx b/src/pages/settings/Wallet/PaymentMethodListItem.tsx index bca259a45b00..701473ec5cb2 100644 --- a/src/pages/settings/Wallet/PaymentMethodListItem.tsx +++ b/src/pages/settings/Wallet/PaymentMethodListItem.tsx @@ -17,6 +17,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type {BankIcon} from '@src/types/onyx/Bank'; import type {Errors} from '@src/types/onyx/OnyxCommon'; import type PaymentMethod from '@src/types/onyx/PaymentMethod'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type IconAsset from '@src/types/utils/IconAsset'; type PaymentMethodItem = PaymentMethod & { @@ -61,6 +62,7 @@ function dismissError(item: PaymentMethodItem) { return; } + const hasErrors = !isEmptyObject(item.errors); const isBankAccount = item.accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT; const paymentList = isBankAccount ? ONYXKEYS.BANK_ACCOUNT_LIST : ONYXKEYS.FUND_LIST; const paymentID = isBankAccount ? item.accountData?.bankAccountID : item.accountData?.fundID; @@ -70,7 +72,7 @@ function dismissError(item: PaymentMethodItem) { return; } - if (item.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) { + if (item.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || hasErrors) { clearDeletePaymentMethodError(paymentList, paymentID); if (!isBankAccount) { clearDeletePaymentMethodError(ONYXKEYS.FUND_LIST, paymentID); @@ -116,8 +118,7 @@ function PaymentMethodListItem({item, shouldShowDefaultBadge, threeDotsMenuItems onClose={item.canDismissError ? () => dismissError(item) : undefined} pendingAction={item.pendingAction} errors={item.errors} - errorRowStyles={styles.ph6} - shouldShowErrorMessages={false} + errorRowStyles={styles.paymentMethodErrorRow} > width: 179, height: 180, }, + paymentMethodErrorRow: { + paddingHorizontal: variables.iconSizeMenuItem + variables.iconSizeNormal / 2, + }, }) satisfies StaticStyles; const dynamicStyles = (theme: ThemeColors) =>