Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libs/actions/BankAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof ONYXKEYS.BANK_ACCOUNT_LIST | typeof ONYXKEYS.NVP_LAST_PAYMENT_METHOD> = {
Expand Down
1 change: 1 addition & 0 deletions src/pages/settings/Wallet/PaymentMethodList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ function PaymentMethodList({
isMethodActive,
iconRight: itemIconRight ?? expensifyIcons.ThreeDots,
shouldShowRightIcon,
canDismissError: true,
};
});
return combinedPaymentMethods;
Expand Down
7 changes: 4 additions & 3 deletions src/pages/settings/Wallet/PaymentMethodListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 & {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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}
>
<MenuItem
onPress={handleRowPress}
Expand Down
3 changes: 3 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5629,6 +5629,9 @@ const staticStyles = (theme: ThemeColors) =>
width: 179,
height: 180,
},
paymentMethodErrorRow: {
paddingHorizontal: variables.iconSizeMenuItem + variables.iconSizeNormal / 2,
},
}) satisfies StaticStyles;

const dynamicStyles = (theme: ThemeColors) =>
Expand Down
Loading