react-number-format
react-number-format copied to clipboard
[UX] Starting with '-' for decimal values sets field to 0
Negative numbers do not seem supported as the negative sign does not display for an empty field.
<NumberFormat
allowNegative={true}
decimalScale={2}
onValueChange={handleChange}
value={value}
/>
- Select the content of the input
- Press the
-
key
- Expected: The field displays
-
- Actual: The field displays
0
A user would expect the field to display the minus sign and wait for the rest of the number, setting the value to 0 makes it seem like negative numbers are not supported.
Note: An additional press on -
sets the field to -0
.
Well, I don't know what I did but it seems to be working now. Would you have any idea what caused the above? The only difference I have in my production code is an isAllowed
property checking whether the number is within the min and max values, when set. And they're not set.
I'm running into the same problem. Can you explain what you mean by "an isAllowed
property"