fix(SW-382): now validating phone input on input rather than blur
This commit is contained in:
committed by
Christian Andolf
parent
fb863d63f7
commit
41e31375dd
@@ -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)
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user