-
Notifications
You must be signed in to change notification settings - Fork 409
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
onValueChange not always fire #812
Comments
I also came across this issue today |
I have the same issues. This makes the onValueChange function unusable. Would it be possible to look into this? |
I have the same issue |
I also encounter this issue. It's quite unreliable since I perform a set of calculations when either the user changes the value or it's programmatically changed. Would be highly appreciated to look into this? |
I have created a minimum reproducible example in CodeSandbox. I have added two examples there, one using the I have added a few buttons that set the state with different values, this is to showcase the problem that comes from externally controlling the What worksTyping in the input will cause the What doesn't workChanging the value of If I alternate clicking the But there are a few occasions that the
Have in mind that the text not being updated is a symptom of the This shows that most of the times, 3 or less characters won't invoke the callback, it only does when the value goes from 4+ characters to 3 or less characters. While checking the documentation related to this prop, it is mentioned:
And although the mention of "prop change" is a bit vague, I assume that the My gut feeling is that the library only invoked the callback when there's a change in the separator, be it its position, its addition or its removal. |
@alexanderoskin your issue can be fixed if you stop using the |
How to use it in React Native with |
@alexanderoskin oh, I missed that you're using React Native. I'm not sure then, maybe you could also try to provide a custom input using the |
I have opened a PR with a possible fix for this. |
This is released on 5.4.0 |
Describe the issue and the actual behavior
We are trying to implement React Native support like this.
All is good, working as expected. But only with numbers longer than three characters. If you type for example 1234 onValueChange is fired. If you type 12 onValueChange is not fire.
Provide a CodeSandbox link illustrating the issue
Here is CodeSandbox reproduction with html input https://codesandbox.io/s/controlled-numeric-format-forked-k6q6mf?file=/src/App.js
Try to enter the following numbers
1 - onValueChange is NOT fire
12 - onValueChange is NOT fire
123 - onValueChange is NOT fire
1234 - onValueChange is fire
12345 - onValueChange is fire and so on
Try to remove last character from 12345 number
1234 - onValueChange is fire
123 - onValueChange is fire
12 - onValueChange is NOT fire
1 - onValueChange is NOT fire
clean - onValueChange is NOT fire
The text was updated successfully, but these errors were encountered: