When typing a number usually you go from left to right which means you first type the thousands then a decimal separator ( . or , ) and then decimals, right now it isn't letting me use decimal separator if i don't have a number before it
example:
123 (i can add a separator between 2 and 3 but i can't add one after 3)
this is the config of my NumberFormat (currently using version: 3.0.0-beta2)
onValueChange={values => onValueChange(values.floatValue)}
thousandSeparator={"."}
decimalSeparator={","}
decimalScale={8}
/>
Float value cannot have a number ending with decimal without post decimal numbers. Use formattedValue / value instead.
<NumberFormat
value={value}
onValueChange={values => onValueChange(values.formattedValue)}
thousandSeparator={"."}
decimalSeparator={","}
decimalScale={8}
/>
Note: If you using values.value do provide isNumericString prop to true
ty, worked!
Well, I have digit the comma and I don't catch floatValue, so... How I fixed this?
References: https://github.com/s-yadav/react-number-format/issues/114
@s-yadav Only problem with passing isNumericString={true} is that an empty value (value = '') adds a zero (0) to the input.
What is the best way to keep the input empty like an empty string? Thanks! Would love to contribute to this if it needs it.
Fixed it on 3.3.1
Awesome! Thank you!
@s-yadav Another question for you: Is there a way to start an input value with a decimal? For example .66 instead of 0.66? Thanks!
Most helpful comment
Fixed it on 3.3.1