From 0b0427b94d1e3115b913469785df6fd5c95fe4c1 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Tue, 30 Apr 2024 04:04:51 +0530 Subject: [PATCH] fix: Taxes - Tax exceeding limit is saved instead of showing error in tax input editor. Signed-off-by: Krishna Gupta --- src/pages/iou/MoneyRequestAmountForm.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/MoneyRequestAmountForm.tsx b/src/pages/iou/MoneyRequestAmountForm.tsx index f6055a271388..46bd34006550 100644 --- a/src/pages/iou/MoneyRequestAmountForm.tsx +++ b/src/pages/iou/MoneyRequestAmountForm.tsx @@ -97,7 +97,6 @@ function MoneyRequestAmountForm( const textInput = useRef(null); const moneyRequestAmountInput = useRef(null); - const isTaxAmountForm = Navigation.getActiveRoute().includes('taxAmount'); const [formError, setFormError] = useState(''); const [shouldUpdateSelection, setShouldUpdateSelection] = useState(true); @@ -205,6 +204,8 @@ function MoneyRequestAmountForm( */ const submitAndNavigateToNextPage = useCallback( (iouPaymentType?: PaymentMethodType | undefined) => { + const isTaxAmountForm = Navigation.getActiveRoute().includes('taxAmount'); + // Skip the check for tax amount form as 0 is a valid input const currentAmount = moneyRequestAmountInput.current?.getAmount() ?? ''; if (!currentAmount.length || (!isTaxAmountForm && isAmountInvalid(currentAmount))) { @@ -224,7 +225,7 @@ function MoneyRequestAmountForm( onSubmitButtonPress({amount: currentAmount, currency, paymentMethod: iouPaymentType}); }, - [taxAmount, isTaxAmountForm, onSubmitButtonPress, currency, formattedTaxAmount, initializeAmount], + [taxAmount, onSubmitButtonPress, currency, formattedTaxAmount, initializeAmount], ); const buttonText: string = useMemo(() => {