π React Hooks for form state management and validation (Web + React Native)
MIT License
Bot releases are hidden (Show)
Published by bluebill1049 almost 5 years ago
Published by bluebill1049 almost 5 years ago
fix #722 validation with schema validation (#723)
Published by bluebill1049 almost 5 years ago
β¨ add ErrorMessage component (#715) @kotarella1110
<ErrorMessage name="firstName" errors={errors} />
π fix Controller component props and event names (#718)
π¨π»βπ» fix #716 clear error object when it is empty (#717)
π fix #712 setValue path type (#714)
Published by bluebill1049 almost 5 years ago
π₯ fix #710 change touched from array to object (#711)
touched
from array to object with better type supportπ¨βπ« improve controller with inner props override rest props
Published by bluebill1049 almost 5 years ago
βοΈclose #700 improve controller with defaultValue
(#701)
πfix #704 only run validate schema when reading isValid state (#705)
Published by bluebill1049 almost 5 years ago
control
: this will be the prop pass to RHFInputwe probably can skip this hack too: https://github.com/react-hook-form/react-hook-form/pull/635
<RHF control={control} name="test" />
https://github.com/react-hook-form/react-hook-form-input/pull/45
RHFInput
into the main repo and rename it to Controller
https://github.com/react-hook-form/react-hook-form-input
<Controller control={control} name="test" />
(we will export all types as well)
import { useForm } from 'react-hook-form';
π¨import useForm from 'react-hook-form';
will no longer work
errors
object and better typescript supporttype form = {
yourDetail: {
firstName: string,
}
}
errors?.yourDetail?.firstName
π¨no more flat errors :-) better TS support
Object
, Object[]
to String
, String[]
triggerValidation('firstName');
triggerValidation(['firstName', 'lastName']);
π¨triggerValidation({ name: 'test', value: 'test' });
no longer work
{ nest: boolean }
watch(); // { 'test.firstName': 'bill' }
watch({ nest: true }); // { test: { firstName: 'bill' } }
register
register('test', { required: true });
π¨register({ name: 'test'})
=> register('test')
setError
support nested objectsetError('yourDetail.firstName', 'test');
errors.yourDetails.firstName;
π¨setError('yourDetail.firstName')
no longer output flat errors object
handleSubmit
no longer rerun array inputs contains undefined
or null
validationSchemaOption
: hardly anyone want to use validation with abort early, or change the config.Thanks to @JeromeDeLeon @kotarella1110 @umidbekkarimov @bopfer
Published by bluebill1049 almost 5 years ago
π₯ required attribute will check for boolean false (#682)
Published by bluebill1049 almost 5 years ago
π fix #670 reset issue with context (#673)
Published by bluebill1049 almost 5 years ago
π fix reset with default values (#667)
Published by bluebill1049 almost 5 years ago
βπ» close #637 isValid with reset (#663)
Published by bluebill1049 almost 5 years ago
π fix #646 fix re-render issue (#647)
π
π» fix #645 issue around zero in front of number (#649)
ππ» fixing checkbox dynamic rendering (#654)
π fix #650 reset all fields reference (#652)
π₯ fix isValid with reset api (#657)
π fix #655 nativeValidation register's value and message (#658)
Published by bluebill1049 almost 5 years ago
π₯ properly fixed isValid
formState with schema and build-in validation. (sorry this is a long dragged issue)
π Story:
The challenge for me was to track form valid
state during render
phase, because RHF embrace uncontrolled inputs, so users can provide default value during render phase and we need to track valid
on the fly, and this took me quite few attend to get it right.
β€οΈ Thanks:
@krnlde have been amazing on report issues and helping on testing. much appreciated your support!
@sergiors same thanks goes to you for helping on testing as well.
Published by bluebill1049 almost 5 years ago
π² improve attribute read (#634)
π fix #631 with revalidating submit mode (#632)
π close #579 fix typescript usage support (#630)
Published by bluebill1049 almost 5 years ago
βοΈ close #612 & Improve variable naming (#629)
π close #627 isValid with validation schema (#628)
Published by bluebill1049 almost 5 years ago
π fix scheme isValid (#626)
π close #617 fix validate function with cached ref (#622)
π register into field issue with isValid (#621)
ππ» fix isValid when there is no input validation (#614)
Published by bluebill1049 almost 5 years ago
π fix #603 isValid issue (#604)
π fix: fix async validate type (#602)
Published by bluebill1049 almost 5 years ago
π₯ Infer return type of watch method when possible (#590)
π fix default value with register input when node remove (#592)
βοΈ close #589 remove value and message for validate function (#595)
πͺ remove schema related react ref (#596)
π add handleSubmit back to the contextType
π fix invalid with custom error during handleSubmit (#601)
βοΈ remove delete keyword in the code base (#599)
Published by bluebill1049 almost 5 years ago
π close #587 issue with onBlur validation (#588)
π fix #575 triggerValidation typescript
Published by bluebill1049 almost 5 years ago
π₯ close #580 to support required with value and message
π fix #557 setValue re-render with schema validation (#574)
π fix #581 focus issue with checkbox and radio (#582)
π close #584 remove checkbox reference after removing (#586)
Published by bluebill1049 almost 5 years ago
π₯revert return unregister
function from register
, sorry it cause issue around register