Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with react-hook-form control #59

Open
hanza93 opened this issue Oct 9, 2023 · 3 comments
Open

Integrate with react-hook-form control #59

hanza93 opened this issue Oct 9, 2023 · 3 comments

Comments

@hanza93
Copy link

hanza93 commented Oct 9, 2023

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
Copy link

alysonvilela commented Oct 11, 2023

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
Copy link
Owner

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

@adrianwilk89
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants