All Versions
177
Latest Version
Avg Release Cycle
10 days
Latest Release
603 days ago

Changelog History
Page 13

  • v4.9.1 Changes

    February 09, 2020

    🍱 🎮 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])

  • v4.9.0

    February 09, 2020
  • v4.8.2 Changes

    February 03, 2020
    • 🛠 fix issue around watch API with nest set to true
  • v4.8.1 Changes

    February 03, 2020

    🍱 🐞 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)

  • v4.8.0 Changes

    January 31, 2020

    🐎 🏁 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)

  • v4.7.3-next.0 Changes

    January 30, 2020
    • get watch() API to work with
    • 🛠 fix errors and touched fields position with useFieldArray
  • v4.7.2 Changes

    January 29, 2020

    🍱 🐞 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" />

  • v4.7.2-next.0

    January 29, 2020
  • v4.7.1 Changes

    January 26, 2020

    🍱 🐞 patch on remove api with last item (#909)

  • v4.7.0 Changes

    January 25, 2020

    🍱 😭 fix use field array (#896)

    • ✂ remove mapID of each render
      IMPORTANT: for native input you will have to use register({}) to trigger ref callback
    • 🛠 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)