React-number-format: Problems with keyboard in mobile

Created on 7 Jun 2018  路  11Comments  路  Source: s-yadav/react-number-format

When send the props fixedDecimalScale, or prefix={'$'}, like has one example in demo, the keyboard in mobile has problem.

Select the input to open keyboard, change the keyboard mode to select numbers, when put the first number in input, the keyboard mode returns to letters.

It's like if when change the text of value internally the keyboard mode changes.

Most helpful comment

id="numberFormat"
decimalSeparator=","
thousandSeparator="."
inputMode="decimal"
pattern="[0-9]*" .../>

I used this code.

Android device screenshot:
Screen Shot 2019-03-13 at 11 02 33

IOS device screenshot:
Screen Shot 2019-03-13 at 11 14 28

If we can find a way to bring "," to the ios keyboard, the problem will be solved

Android is correct, but iOS not display "," comma..

Can you help me?

All 11 comments

So, I put the type='tel', but in iOS mobile no has the ',' and the '.' to digit decimal numbers, then i'm back to type text.

What I did to solve my problem, is ugly but work for me: In onFocus I change the state to render without props fixedDecimalScale and thousandSeparator, and in onBlur I change the state again to render with theese two props.

Two problems I solve this way:

  1. Mobile keyboard to not change the mode after users select number mode;
  2. When users digit too fast that select input goes to final and don't allow the users digit more without click in right position to permit digit more.

it would be more convenient if it support input type="number". changing keyboard in mobile to numbers are actually annoying when the input should get numbers only.
I hope they fix it

id="numberFormat"
decimalSeparator=","
thousandSeparator="."
inputMode="decimal"
pattern="[0-9]*" .../>

I used this code.

Android device screenshot:
Screen Shot 2019-03-13 at 11 02 33

IOS device screenshot:
Screen Shot 2019-03-13 at 11 14 28

If we can find a way to bring "," to the ios keyboard, the problem will be solved

Android is correct, but iOS not display "," comma..

Can you help me?

id="numberFormat"
decimalSeparator=","
thousandSeparator="."
inputMode="decimal"
pattern="[0-9]*" .../>

I used this code.

Android device screenshot:
Screen Shot 2019-03-13 at 11 02 33

IOS device screenshot:
Screen Shot 2019-03-13 at 11 14 28

If we can find a way to bring "," to the ios keyboard, the problem will be solved

Android is correct, but iOS not display "," comma..

Can you help me?

same with you.

id="numberFormat"
decimalSeparator=","
thousandSeparator="."
inputMode="decimal"
pattern="[0-9]*" .../>

I used this code.

here you can see unfortunately Firefox doesn't support "inputmode" attribute.

@s-yadav I think this commit (https://github.com/s-yadav/react-number-format/commit/1ade39ffc816da04b566387b3817e6512355ff9e) broke the functionality being discussed here: the iOS keyboard show up with the numeric keyboard that doesn't have the decimal point/comma key and there's no way to override it.

@dccarmo I will check this. This does says it will show correct input on inputmode="numeric"
https://css-tricks.com/everything-you-ever-wanted-to-know-about-inputmode/

In meanwhile you can still override it using.

<NumberFormat inputMode="decimal" />

or remove it using

<NumberFormat inputMode={false} />

@dccarmo Can you also share device and OS information.

@s-yadav That's great, I didn't know we could override it.

I'm testing on an iPhone XS Max on iOS 13.4.1.

@dccarmo The latest release removes inputmode on IOS device when decimals, minus characters are required.

@s-yadav Awesome, thank you! I think this issue can probably be closed (@nataliazanolli).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

everlasting-neverness picture everlasting-neverness  路  5Comments

rioarray picture rioarray  路  6Comments

cescoferraro picture cescoferraro  路  6Comments

luis-carlos-campos picture luis-carlos-campos  路  3Comments

leonardojobim picture leonardojobim  路  3Comments