Skip to content

Commit

Permalink
US-1973 Moved logic outside component and in handleAmountChange
Browse files Browse the repository at this point in the history
  • Loading branch information
Freshenext committed Oct 11, 2023
1 parent c5b6f8e commit 14a43ec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/screens/send/TransactionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -320,9 +323,7 @@ export const TransactionForm = ({
onSwap={onSwapBalance}
editable
handleAmountChange={value => {
if (Number(value) <= maxAmount) {
handleAmountChange(value, balanceInverted)
}
handleAmountChange(value, balanceInverted)
}}
/>
<Input
Expand Down

0 comments on commit 14a43ec

Please sign in to comment.