- Fix bug where
form.defaultValues
andform.values
got overwritten when using utility functions inuseArrayListener
.
- Fix crash when comparing Date with null Date field.
- Fix crash on undefined/null array when using useArrayField.
innerRef
prop onField
andFieldError
- Removed
FormState.setDefaultValues
-> merged withFormState.setValues
- Support
errorClassName
,dirtyClassName
,dirtyStyle
,errorStyle
on Field component
- Rewrite FormInput -> Field component
- Rewrite FormError -> FieldError
- Removed FormInput, FormSelect, FormTextarea, FormError
- Better naming: renamed useArrayForm -> useArrayField, useChildForm -> useObjectField
- Update documentation links.
- It is now easier to create custom inputs by exposing
defaultSerializer
anddefaultDeserializer
to the user.
- Moved
yupValidator
to seperate packagetyped-react-form-yup
- Child/array forms name prop only allows object fields now.
- Pass FormEvent through
form.handleSubmit
- Allow string as argument to setErrors, which sets the error on the parent.
- Allow validators to return undefined.
- The
name
prop on FormTextArea and FormSelect did not get passed to their input element.
- Excluding *.modern.js files from build.
- Fix: return true when validate is called on a form which doesn't have a validator set.
- Do not reset values on
useForm
state change, because this can cause confusion. form.handleSubmit
helper function.- Fix:
form.setState
causing doubleform.setState
call.
- Fixed #2: operator short-circuiting caused only one error to be set when using
form.setErrors
. (#2)
-
Object constraint on form type parameter, string constraint on error type parameter. (
FormState<T extends object, State, Error extends string>
) -
React 17 support (#1)
-
form.setErrors
should now be working correctly. -
Custom error types are now correctly inferred from
useForm
:type Language = "error-email" | "error-password" const form = useForm({email: "test@gmail.com", password: ""}, yupValidator(schema, {}, (message) => message as Language)); form.setError("email", ...); // Must be "error-email" | "error-password"