π React Hooks for form state management and validation (Web + React Native)
MIT License
Bot releases are visible (Hide)
Published by bluebill1049 almost 5 years ago
π sorry I broked custom register (patched) register
function now return unregister
to work closer with react-hook-form-input
on top of that you can unregister during useEffect
now
useEffect(() => {
const unregister = register({ name: 'test' });
return () => unregister;
}, [register])
π fix default watch value bug (#568)
Published by bluebill1049 almost 5 years ago
π fix #553 setValue issue with schema validation (#554)
βπ» make register return unregister (#556)
π₯ fix #555 support all primitive types for custom fields (#560)
Published by bluebill1049 almost 5 years ago
π fix #547 around isValid after reset (#552)
π₯ fix error message type (#544)
Published by bluebill1049 almost 5 years ago
π₯ improve setError during useEffect
as dependency (#520)
π
π» wrap render state update with isUnmount guard (#527)
πΉ fix #531 issue around lose input focus (#533)
π fix type on ValidateResult by remove promise
Published by bluebill1049 almost 5 years ago
π₯patch setError
type
Published by bluebill1049 almost 5 years ago
β¨ Feature: support multiple errors for single field (#430)
useForm({ validateCriteriaMode: 'all' })
<input name="test" ref={register({ required: true, minLength: 10, pattern: /\d+/gi })} />
all validation errors will display together when both valiation failed.
β¨ Feature/array of checkboxes (#500) Thanks to @ldanet β€οΈ
<input name="test" type="checkbox" value="a" />
<input name="test" type="checkbox" value="b" />
Finally, we can support checkbox with same name, check both values will return ['a', 'b']
π¨ validate
function return type to removed void
(This solve problem for error message due to type void
)
validate: value => { }; // you need to return string or boolean
β
validate: value => { return false; }
β
π close #516 make sure watch return consistent default value (#517)
π close #513 fix trigger validate error message (#514)
π close #510 reset bug with onChange (#512)
π¦ clean up types (#495)
π₯ Reset accepts partial FormValues (#482)
βοΈ remove API validationFields (#484)
validationFields
optional argument will no longer be supported and use unregister
instead
Published by bluebill1049 almost 5 years ago
β¨ New Feature: setErrors support multiple errors at once
const { setError } = useForm();
setError([
{
type: 'test',
name: 'input',
message: 'wow',
},
{
type: 'test1',
name: 'input1',
message: 'wow1',
},
])
π fix #456 fix setValue to re-render when necessary (read more here)
π fix #440 prevents field names from hanging around in the valid fields
π fix pattern/required issue (#474)
ππ» Improve handle submit with try-finally (#478)
Published by bluebill1049 almost 5 years ago
π patch #445 fix register cache issue (#444)
π patch #436 watch data inconsistent issue (#439)
π patch #440 use validation schema error instead of picking individual errors
π patch isValid computed incorrectly when dynamically adding required fields
π performance enhancement for setValue
and triggerValidation
by reduce re-rendering
π€ remove react-dom
from peer dependency #450
Published by bluebill1049 almost 5 years ago
πpatch issue around watch
API #436 #434
Published by bluebill1049 almost 5 years ago
ππ»ββοΈ Patch [React Native] Property 'Proxy' doesn't exist #433
β Patch build issue with typescript (#426)
Published by bluebill1049 almost 5 years ago
πfix dirty
and isValid
issue with onBlur mode (#417)
Published by bluebill1049 almost 5 years ago
π fix a bug on re-render when there is no validation rule attached to an input (further improve rendering)
Published by bluebill1049 almost 5 years ago
π₯ Massive performance enhancement! #407 thanks to @barrymay @JeromeDeLeon
with this minor version, if your form is not reading attributes from formState
, then your form should receive even less re-render and free performance boost. eg:
const { register, handleSbmit } = useform();
// by default your form will not get re-render at all until submit, because your validation is onSubmit and you are not reading any formState
π Properly nest getValues for defaultValue #410
Published by bluebill1049 almost 5 years ago
Important:
π Fix touched
to the only trigger during onBlur
event
π₯ I sincerely apologize to all the users, this is my bad understanding of touched
. This bug was introduced on day 1 when react-hook-form introduced formState
.
π Fix dependencies during useEffect
with register
and unregister
#394
π Fix isValid
issue with validationFields
#389
π Consistency with isValid
under onSubmit
mode
always return false
on form mount #389
π₯ Improve typescript support for react-native custom register
#381
πββοΈ Abort early for validate
function (consistency) #400
Published by bluebill1049 about 5 years ago
π Fix a bug with custom register when required: true
π Patch issue with react-native
#369
β€οΈ Type improvement #367 #368
Published by bluebill1049 about 5 years ago
β€οΈ Type improvement #358 #360
π€ New Feature on reValidateMode
#362
Default re-validate error is still onChange
, however now you can config how re-validate gets triggered:
useForm({
mode: 'onBlur',
reValidateMode: 'onBLur',
})
Published by bluebill1049 about 5 years ago
π close #344 fix schema validation with focus (#346)
π close #345 issue with watch
causing dirty
not update (#347)
Published by bluebill1049 about 5 years ago
π€π» improve react-native check for set value
Published by bluebill1049 about 5 years ago
π prevent crash on react native: can't find variable HTMLElement in ReactNative (#339)
Published by bluebill1049 about 5 years ago
π
sorry for the frequent patching, context API got me couple extra try to get it working
π patch on form context and only memo methods and not errors
and formState