- Fix bug where
form.defaultValuesandform.valuesgot overwritten when using utility functions inuseArrayListener.
- Fix crash when comparing Date with null Date field.
- Fix crash on undefined/null array when using useArrayField.
innerRefprop onFieldandFieldError- Removed
FormState.setDefaultValues-> merged withFormState.setValues
- Support
errorClassName,dirtyClassName,dirtyStyle,errorStyleon 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
defaultSerializeranddefaultDeserializerto the user.
- Moved
yupValidatorto 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
nameprop 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
useFormstate change, because this can cause confusion. form.handleSubmithelper function.- Fix:
form.setStatecausing doubleform.setStatecall.
- 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.setErrorsshould 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"