s-yadav / react-number-format

React component to format numbers in an input or as a text.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot input scientific notation numbers

lorenzoa7 opened this issue · comments

I can't type scientific notations with react number format input, like "2e10". Without this lib, if we create an input with type number, it accepts scientific notations like that. Is there a way to get through this? Didn't find anything related in the docs.

"Tested with NumericFormat"

image

  • [ X ] Chrome
  • Chrome (Android)
  • Safari (OSX)
  • Safari (iOS)
  • Firefox
  • Firefox (Android)

The library doesn't allow to type exponential number, but do allow passing exponential value like this. As NumericFormat is not rendered as <input type="number" /> as it has to support format characters as well.

<NumericFormat  value={2e10}/>

Note the value is type number here.

You might be able to implement it using customization though.
https://s-yadav.github.io/react-number-format/docs/customization

The library doesn't allow to type exponential number, but do allow passing exponential value like this. As NumericFormat is not rendered as <input type="number" /> as it has to support format characters as well.

<NumericFormat  value={2e10}/>

Note the value is type number here.

You might be able to implement it using customization though. https://s-yadav.github.io/react-number-format/docs/customization

How can I achieve this? Because NumericFormat input doesn't allow me to type the letter "e". I searched into this Customization docs but didn't understand how to do it. Can you help me?