eduardoborges / use-mask-input

✏️ A react Hook for build elegant input masks. Compatible with React Hook Form
https://npmjs.com/package/use-mask-input
265 stars 13 forks source link

Integrate with react-hook-form `control` #59

Open hanza93 opened 11 months ago

hanza93 commented 11 months ago

We are using the controlled version for react-hook-form by using useControl hook. it would be awesome if we can use useHookFormMask with control too

alysonvilela commented 11 months ago

You can use it. Just re-subscribing ref value using withMask function

<Controller
  name="test"
  render={({ field }) => {
    return <input {...field} ref={withMask('9999-9999')}/>; // ✅
  }}
/>
eduardoborges commented 11 months ago

Hey @hanza93 im working on it, but for now you can use withMask like @alysonvilela demostrate above. <3

adrianwilk89 commented 10 months ago

@alysonvilela is problem with this solution because if you pass withMask as ref then primary functionality that scroll and focus element with errors stop working i mean if you set shouldFocusError to true