use-mask-input icon indicating copy to clipboard operation
use-mask-input copied to clipboard

Integrate with react-hook-form `control`

Open hanza93 opened this issue 1 year ago • 3 comments

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

hanza93 avatar Oct 09 '23 06:10 hanza93

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

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

alysonvilela avatar Oct 11 '23 22:10 alysonvilela

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

eduardoborges avatar Oct 16 '23 14:10 eduardoborges

@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

adrianwilk89 avatar Oct 23 '23 23:10 adrianwilk89