From 14a43ecf5adf8a8c5d48936d704ec4bf0550c2bf Mon Sep 17 00:00:00 2001 From: Francis Rodriguez Date: Wed, 11 Oct 2023 11:39:34 -0300 Subject: [PATCH] US-1973 Moved logic outside component and in handleAmountChange --- src/screens/send/TransactionForm.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/screens/send/TransactionForm.tsx b/src/screens/send/TransactionForm.tsx index 1c639d5a7..7ef32f5be 100644 --- a/src/screens/send/TransactionForm.tsx +++ b/src/screens/send/TransactionForm.tsx @@ -165,6 +165,9 @@ export const TransactionForm = ({ const handleAmountChange = useCallback( (newAmount: string, _balanceInverted: boolean) => { const text = sanitizeMaxDecimalText(sanitizeDecimalText(newAmount)) + if (Number(text) >= maxAmount) { + return + } const numberAmount = Number(text) setFirstBalance(prev => ({ ...prev, @@ -320,9 +323,7 @@ export const TransactionForm = ({ onSwap={onSwapBalance} editable handleAmountChange={value => { - if (Number(value) <= maxAmount) { - handleAmountChange(value, balanceInverted) - } + handleAmountChange(value, balanceInverted) }} />