Git Product home page Git Product logo

Comments (5)

engylemure avatar engylemure commented on June 11, 2024 2

@eduardoborges This issue is related to the recreation of the register and the ref on re-renders of the component that uses the withMaskInput or the useHookFormMask, to fix this it could be necessary to create some kind of hook that will memorize it's usage using as dependencies only the parameters of it https://codesandbox.io/p/sandbox/misty-mountain-5fqg48?file=%2Fsrc%2FApp.tsx%3A39%2C31

from use-mask-input.

rafma0 avatar rafma0 commented on June 11, 2024 1

It seems like the cursor goes to the start of your active input on every rerender, also it freezes the mouse hover placeholder if its showing when a rerender happens

output.mp4

In this video I used a Joi validation for testing, like this

volume: Joi.number().min(50).max(100)

I hope this helps someone figure what's happening bc I have no clue 🤣
(and it's the only thing keeping me from using this lib in every project from now on)

My "solution" for now is setting in react-hook-form

reValidateMode: 'onSubmit'

from use-mask-input.

rafma0 avatar rafma0 commented on June 11, 2024 1

@eduardoborges maybe reopen this? revalidate onSubmit works but its different from the default behaviour from react-hook-form which is, after you submit the form, it start revalidating all fields on input change. For me, the default is still the preferred behaviour if we can make it work somehow.

from use-mask-input.

eduardoborges avatar eduardoborges commented on June 11, 2024

@Danane84 Uh, its a insteresting issue. I will investigate that!

from use-mask-input.

eduardoborges avatar eduardoborges commented on June 11, 2024

It seems like the cursor goes to the start of your active input on every rerender, also it freezes the mouse hover placeholder if its showing when a rerender happens

output.mp4
In this video I used a Joi validation for testing, like this

volume: Joi.number().min(50).max(100)

I hope this helps someone figure what's happening bc I have no clue 🤣 (and it's the only thing keeping me from using this lib in every project from now on)

My "solution" for now is setting in react-hook-form

reValidateMode: 'onSubmit'

Great solution!

from use-mask-input.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.