fix: prevent phone input from running validation on mount when empty
This commit is contained in:
@@ -58,8 +58,14 @@ export default function Phone({
|
||||
forceDialCode: true,
|
||||
value: phone,
|
||||
onChange: (value) => {
|
||||
setValue(name, value.phone)
|
||||
trigger(name)
|
||||
// If not checked trigger(name) forces validation on mount
|
||||
// which shows error message before user even can see the form
|
||||
if (value.inputValue) {
|
||||
setValue(name, value.phone)
|
||||
trigger(name)
|
||||
} else {
|
||||
setValue(name, "")
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user