react-hook-form

๐Ÿ“‹ React Hooks for form state management and validation (Web + React Native)

MIT License

Downloads
25.6M
Stars
39.4K
Committers
318

Bot releases are hidden (Show)

react-hook-form - Version 5.0.2

Published by bluebill1049 over 4 years ago

๐Ÿž fix #1172 issue around remove with useFieldArray (#1173)
โค๏ธ improve types of Controller's onChange and onBlur (#1169)

react-hook-form - Version 5.0.1

Published by bluebill1049 over 4 years ago

๐Ÿž fix #1167 issue around watch multiple values with array (#1168)

react-hook-form - Version 5.0.0

Published by bluebill1049 over 4 years ago

Breaking change on Controller

Controller: onChange will only evaluate payload as event like object. eg: react-select will no longer need the extra onChange method at Controller.

Before:

import { TextInput } from 'react-native';

<Controller
  as={<TextInput style={{ borderWidth: 2, borderColor: 'black'}} />}
  name="text"
  control={args => ({
    value: args[0].nativeEvent.text,
  })}
  onChange={onChange}
/>

now:

import { TextInput } from 'react-native';

<Controller
  as={<TextInput style={{ borderWidth: 2, borderColor: 'black'}} />}
  name="text"
  control={args => args[0].nativeEvent.text}
  onChange={onChange}
/>
react-hook-form - Version 4.10.2

Published by bluebill1049 over 4 years ago

Happy 1st birthday!

๐Ÿž fix validationResolver issue due to cache validationContext (#1132)
๐Ÿ’ƒ improve useFieldArray with useCallback for each methods (#1130)
๐Ÿž fix #1141 getValues return empty string (#1145)
๐Ÿ›Ž Add UMD build target (#1157)
๐Ÿž fix #1158 fix setValue not working with object array (#1160)
๐Ÿž fix #1154 controller onChange type check (#1162)
Important: The above is a breaking change, which I will release a major version by today. Controller: onChange will only evaluate payload as event like object. eg: react-select will no longer need extra onChange method at Controller.

react-hook-form - Version 4.10.1

Published by bluebill1049 over 4 years ago

๐Ÿž fix #1123 issue on radio input reference remove (#1124)

react-hook-form - Version 4.10.0

Published by bluebill1049 over 4 years ago

๐ŸŒ  support multiple setValues (#1056)
๐Ÿž close #1097 issue with useFieldArray formState (#1111)
๐Ÿ›Ž update ControllerProps type to improve DX (#217)
๐Ÿ˜Ž improve DX of register function (#1106)
๐Ÿž fix useFieldArray remove item error's order (#1103)
๐Ÿž fix useFieldArray clear error issue (#1099)
๐Ÿž fix #1094 Controller with SSR (#1095)
โ›ณ๏ธ close #1090 controller get value (#1092)
๐Ÿž fix #1086 issue with watch re-render caused by dirty attribute (#1087)

react-hook-form - Version 4.9.8

Published by bluebill1049 over 4 years ago

๐ŸŒšsupport IE11 (#1063)
๐Ÿžfix #1069 controller reset issue (#1071)
Note: inline defaultValue will overwrite data at Controller's defaultValues
๐Ÿฟclose #1060 support value as true/false for required validation rule
๐ŸŽข throw error when formContext is missing (#1054)

react-hook-form - Version 4.9.7

Published by bluebill1049 over 4 years ago

๐Ÿž fix #1062 re-render issue with useFieldArray (#1064)
โ›ฉ fix children prop type for ErrorMessage component (#1059)

react-hook-form - Version 4.9.4

Published by bluebill1049 over 4 years ago

๐Ÿ˜ญrevert IE 11 bundle changes

react-hook-form - Version 4.9.5

Published by bluebill1049 over 4 years ago

react-hook-form - Version 4.9.4

Published by bluebill1049 over 4 years ago

๐Ÿž fix #1036 check watch input against name
๐Ÿ’ซ fix/watch use field array (#1036)
๐ŸŒœ fix #1026 around build-in isValid with useFieldArray (#1034)
โ›ฉ fix #1033 props type for ErrorMessage
๐ŸŒš add ts-polyfill to solve ie11 issues (#1018)
๐Ÿž fix #1007 reset with react native
๐Ÿž fix #1020 issue around watch undefined input (#1023)
๐Ÿž fix type for validationResolver (#1017)
โœ๏ธ improve unset method (#1015)

react-hook-form - Version 4.9.3

Published by bluebill1049 over 4 years ago

๐Ÿž fix #1007 with Node Type check
๐ŸŒ  close #992 setValue with null and undefined (#1006)

react-hook-form - Version 4.9.1

Published by bluebill1049 over 4 years ago

๐ŸŽฎ feature/support custom schema validation (#974)

import React from "react";
import { useForm } from "react-hook-form";
import Joi from "@hapi/joi";

const validationSchema = Joi.object({
  username: Joi.string().required()
});

const resolver = (data: any, validationContext) => {
  const { error, value: values } = validationSchema.validate(data, {
    abortEarly: false
  });

  return {
    values: error ? {} : values,
    errors: error
      ? error.details.reduce((previous, currentError) => {
          return {
            ...previous,
            [currentError.path[0]]: currentError
          };
        }, {})
      : {}
  };
};

export default function App() {
  const { register, handleSubmit, errors } = useForm({
    validationResolver: resolver,
    validationContext: { test: "test" }
  });

  return (
    <form onSubmit={handleSubmit(d => console.log(d))}>
      <input type="text" name="username" ref={register} />
      <input type="submit" />
    </form>
  );
}

๐Ÿž close #954 fix type for ErrorMessage component props (#966)
๐Ÿž fix #967 issue around getValues with defaultValues (#968)
๐Ÿž fix #969 fields compare function
โœŒ๏ธ close #951 include keyName prop for custom id (#957)
โœŒ๐Ÿป improve type keyName for useFieldArray (#983)
๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป improve type for ref (#990)
๐Ÿ’‰ fix #988 isValid form state with useFieldArray schema (#991)
โ› fix #994 prevent useFieldArray items unregister (#995)
โŒจ๏ธ useFieldArray remove method support array of indexes (#980)
support remove([1,2,3])

react-hook-form - Version 4.8.2

Published by bluebill1049 over 4 years ago

๐Ÿžfix issue around watch API with nest set to true

react-hook-form - Version 4.8.1

Published by bluebill1049 over 4 years ago

๐Ÿž fix #670 reset empties the input
๐Ÿž fix #956 react native FileList not defined
๐Ÿž fix #955 field array dirty value compare
๐Ÿ›€ Remove deprecated field from options type. (#952)

react-hook-form - Version 4.8.0

Published by bluebill1049 over 4 years ago

๐Ÿ close #938 performance enhancement for watch (#939)
๐Ÿ•บ improve #938 watch perf with search array (#946)
๐Ÿ‘จโ€๐Ÿš’ fix #932 issue around delete file list object in FF (#944)
๐Ÿ‘‘ support rest props for ErrorMessage component (#941)

<ErrorMessage className="test" onClick={() => {}} errors={errors} name="test" />

โœŒ๏ธ assign non-object values to value property (#940)
๐Ÿž fix mutationWatcher in remove event listener function
๐Ÿคž #924 improvement over watch with field array (#930)

react-hook-form - Version 4.7.3-next.0

Published by bluebill1049 over 4 years ago

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป get watch() API to work with FieldArray
๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป fix errors and touched fields position with useFieldArray

react-hook-form - Version 4.7.2

Published by bluebill1049 over 4 years ago

๐Ÿž fix #927 formState read flag (#929)
๐Ÿฅ‚ support register method with optional first argument for useFieldArray
๐Ÿฅ‚ add support for array values in useFieldArray methods (#925)
๐Ÿฅ‚ ErrorMessage support message prop

eg:

<ErrorMessage errors={errors} name="test" message="message here" />

react-hook-form - Version 4.7.1

Published by bluebill1049 over 4 years ago

๐Ÿž patch on remove api with last item (#909)

react-hook-form - Version 4.7.0

Published by bluebill1049 over 4 years ago

๐Ÿ˜ญ fix useFieldArray (#896)

  • ๐ŸŽบIMPORTANT(only apply for useFieldArray): for register without validation you will have to use register({}) to trigger ref callback
  • remove mapID of each render
  • fix errors got removed after remove item
  • fix delete issue
  • fix dirty value
  • fix async reset with dirty value

๐Ÿž fix #903 errors type object comparison (#907)
๐Ÿž fix(Controller): Invoke onBlur method when mode is onBlur. (#902)
๐Ÿž fix #890 radio dynamic inject issue (#901)
๐Ÿž fix #893 trigger validation (#900)
๐Ÿž fix #881 issue around formState with reset (#891)
๐ŸŽ‰ make handleSubmit event optional (#885)