react-currency-input
react-currency-input copied to clipboard
Issue adding zero running on iOS 9 with Safari
There's a bug in this lib when running on iOS 9 with Safari where if you have 0.03
in the input, pressing 0
with the cursor at the end doesn't get you 0.30
.
After hours looking into the source code, I've found the cause: toLocaleString
is not supported by iOS 9. I had to patch-package
the node module like this to make it work:
- initialValue = Number(initialValue).toLocaleString(undefined, {
- style : 'decimal',
- minimumFractionDigits: props.precision,
- maximumFractionDigits: props.precision
- });
+ initialValue = Number(initialValue).toFixed(props.precision);
Hope it helps.