Skip to content

Commit

Permalink
fix: Taxes - Tax exceeding limit is saved instead of showing error in…
Browse files Browse the repository at this point in the history
… tax input editor.

Signed-off-by: Krishna Gupta <[email protected]>
  • Loading branch information
Krishna2323 committed Apr 29, 2024
1 parent ce75ab8 commit 0b0427b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pages/iou/MoneyRequestAmountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function MoneyRequestAmountForm(

const textInput = useRef<BaseTextInputRef | null>(null);
const moneyRequestAmountInput = useRef<MoneyRequestAmountInputRef | null>(null);
const isTaxAmountForm = Navigation.getActiveRoute().includes('taxAmount');

const [formError, setFormError] = useState<MaybePhraseKey>('');
const [shouldUpdateSelection, setShouldUpdateSelection] = useState(true);
Expand Down Expand Up @@ -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))) {
Expand All @@ -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(() => {
Expand Down

0 comments on commit 0b0427b

Please sign in to comment.