react-currency-input icon indicating copy to clipboard operation
react-currency-input copied to clipboard

Issue adding zero running on iOS 9 with Safari

Open gustavopch opened this issue 6 years ago • 0 comments

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.

gustavopch avatar Feb 08 '19 05:02 gustavopch