menu

React Hook Form

๐Ÿ“‹ Custom React hooks for form validation without the hassle

Channels
Team

React-Hook-Form watercooler

July 31, 2019 at 1:06am
Show previous messages

August 7, 2019 at 10:36am
it would be amazing to make it work tho, but i haven't got time to work on it. (spend most of my time on web atm)
  • reply
  • like
yeah, I know - might need to split out a native module to adapt to this without bloating the main. will keep you posted
like-fill
1
  • reply
  • like

August 11, 2019 at 10:54am
just asking, why is there a need to wrap the formState in an object? is it better if we could just spread it off just like other property? and why errors is not part of a formState?
  • reply
  • like

August 11, 2019 at 11:47pm
good question
  • reply
  • like
I guess errors should be part of formState
  • reply
  • like
that was a bad decision when i created the API
  • reply
  • like
What i should have done is group errors inside formState or like you said just flat them all.
  • reply
  • like
ah i do remember why i have decided to group them in formState, it was easier to document them in a group https://react-hook-form.com/api#formState at the time
  • reply
  • like
but yea i regret not having errors in there
  • reply
  • like
Yeah, I came from formik and I thought there was a confusion when you group them but not included errors in formState. Anyway, are you going to change that? just asking :)
  • reply
  • like

August 12, 2019 at 11:12am
hey probably not right now. it's going to be a breaking change. For now i will leave errors out there, until the next major release i will fix this issue
  • reply
  • like
thanks for picking this up tho ๐Ÿ™๐Ÿป
  • reply
  • like
plus pick up those other issues as well.
  • reply
  • like
hey probably not right now. it's going to be a breaking change. For now i will leave errors out there, until the next major release i will fix this issue
I will wait for that :)
like-fill
1
  • reply
  • like

August 15, 2019 at 2:42pm
hm, how do we do validation of customInputs? I'm stuck with react-select over here, will probably remove it at some point but would be great to have validation on it meanwhile. I'm using https://github.com/react-hook-form/react-hook-form/blob/master/examples/customInput.tsx as reference. however adding a validate function to register() does not seem to do anything. triggerValidation does not do anything either..
Edited
  • reply
  • like

September 21, 2019 at 1:50am
Would like to try to submit a PR with an idea that I have. Do you have a contribution guide somewhere?
  • reply
  • like

October 11, 2019 at 11:10am
Hello. In redux-form we had a convenient behavior where form becomes 'touched' only after losing the focus but is validated on any change. That prevents unnecessary error messaging on first enter - like there is no weird message about wrong email at least until the user has entered it for the first time. On the other hand, I can disable submit button if the form is invalid, so making button enabled shows the user that he can press it.
  • reply
  • like
Can I imitate that behavior in react-hook-form? If I use 'onBlur' the user need to lose the focus on all fields to run the final validation enabling the button or showing all errors - that's not good from UX point of view.
  • reply
  • like
Oh, there is PR for that case :)
  • reply
  • like