From 41e31375ddeb676148a8aba5689cc6d0e132ee41 Mon Sep 17 00:00:00 2001 From: Christian Andolf Date: Wed, 23 Oct 2024 15:27:43 +0200 Subject: [PATCH] fix(SW-382): now validating phone input on input rather than blur --- components/TempDesignSystem/Form/Phone/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/TempDesignSystem/Form/Phone/index.tsx b/components/TempDesignSystem/Form/Phone/index.tsx index d09598296..d27e31986 100644 --- a/components/TempDesignSystem/Form/Phone/index.tsx +++ b/components/TempDesignSystem/Form/Phone/index.tsx @@ -37,7 +37,7 @@ export default function Phone({ }, }: PhoneProps) { const { formatMessage } = useIntl() - const { control, setValue } = useFormContext() + const { control, setValue, trigger } = useFormContext() const phone = useWatch({ name }) const { field, fieldState, formState } = useController({ @@ -59,6 +59,7 @@ export default function Phone({ value: phone, onChange: (value) => { setValue(name, value.phone) + trigger(name) }, })