From 3f4b9940b538f08aded672070a0942f3feecc20b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 26 May 2026 14:10:35 +0000 Subject: [PATCH] fix(send): trigger validation on Max so Review enables immediately MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The form uses react-hook-form's onChange mode, which only re-runs the Zod schema when the Controller's TextInput fires onChange. handleMaxPress just calls setValue('amount', maxAmount), which writes the value but doesn't run validation, so isValid stays at its prior value (false if the user hadn't typed first) and the Review button remains disabled. Call trigger('amount') after setValue — matches the pattern already used in CardRepayForm and RegularWithdrawForm for the same problem. --- components/Send/SendForm.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/Send/SendForm.tsx b/components/Send/SendForm.tsx index 1a44624f..87df25a2 100644 --- a/components/Send/SendForm.tsx +++ b/components/Send/SendForm.tsx @@ -113,6 +113,7 @@ const SendForm: React.FC = ({ onNext }) => { handleSubmit, formState: { errors, isValid }, setValue, + trigger, } = useForm({ resolver: zodResolver(sendSchema), mode: Platform.OS === 'web' ? 'onChange' : undefined, @@ -155,7 +156,12 @@ const SendForm: React.FC = ({ onNext }) => { const maxAmount = formatUnits(balanceWei, liveToken.contractDecimals); setAmount(maxAmount); setValue('amount', maxAmount); - }, [setAmount, setValue, liveToken, balanceWei]); + // RHF's onChange mode validates on the Controller's input change event, + // not on programmatic setValue. Without an explicit trigger, isValid + // stays at its prior value and Review stays disabled when the user + // hits Max without typing first. + trigger('amount'); + }, [setAmount, setValue, trigger, liveToken, balanceWei]); const onSubmit = useCallback( (data: any) => {