Comments (5)
@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.
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.
@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.
@Danane84 Uh, its a insteresting issue. I will investigate that!
from use-mask-input.
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 thisvolume: 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)
- Missing type=module in package.json HOT 11
- API-Options -> availability for "decimal"-mask? HOT 6
- error during installation HOT 2
- 'Usage with React Hook Forms' correction HOT 1
- Remove 'mask trace' HOT 3
- Still don't get auto completion for options after last update (?) HOT 2
- docs: datetime year autofill disable
- removeMaskOnSubmit doesn't seem to work on react-hook-form HOT 1
- Integrate with react-hook-form `control` HOT 3
- Accessing unmasked value from event
- Hide the mask HOT 8
- Using controlled component causes strange behavior HOT 3
- Dynamic mask HOT 1
- Bundle size question HOT 2
- Problems with mask behavior when using 'a' or '*' for the mask template. HOT 4
- IP mask does not work correctly when used with useState
- Type problem when using useHookFormMask with React Hook Form register HOT 1
- Heavy library HOT 2
- Type error when using the lib with @types/[email protected] and @types/[email protected] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from use-mask-input.