react-dynamic-number
react-dynamic-number copied to clipboard
Fraction is error
Let's say I have 2 input fields. Both of them have fraction={1}
. When I input in first field 2.35
, in visual it is 2.3
and that's what I want. But when I move to second field, then I start to input some values, the first field's value become to 0
again. Then I reload page. Now, I input in first field 2.3
, then I move to second field and I start to input some values, the first field is fine with value 2.3
. I think there's something missed with fraction props. Is it possible to fix this?
Can confirm this happening Say you have a value of 1.66666 If the fraction prop is set to 2, the value will then be shown as 0.
Thank you guys for your feedback. @bmd-bentar I can't reproduce your case. Maybe it is somehow because you pass same variable as value or something like this. Can you prepare any working examples of this bug?
@DavidHooper your case is totally different. Actually it is even not a bug but it is just how it works. Going into details how this module works: you type something, library checks if it is according to module options (fraction part, decimal part etc.) if it is it remembers this correct state. Then transform it to correct javascript number. If you just paste wrong value it will check and decide that it is incorrect and return previous correct value 0. If your problem is different or you think that it should work differently please create separate topic.
Hi, there is a case with input value changes (<DynamicNumber fraction={2} />
):
input: 1.0
output: 1.0
->
input: 1.01
output: 1.01
->
input: 1.010
output: 0
@uhlryk could you please add some prop to not to set value as 0, but just simple to suppress subsequent characters (as link to @DavidHooper comment)
I mean that the last output should be 1.01
as well as the second one.