0

I have an issue with DecimalPad keyboard type for iOS in NativeScript. In eu locales it is common to use comma instead of dot for floating numbers so DecimalPad keyboard exposes comma character.

enter image description here

My app business logic requires to support US locale only despite locale of an actual device. So how can I override keyboard locale in my app to US fixed?

At any locale I want to have a dot character:

I would really appreciate a code snippet for NativeScript (Angular) though objective-c one also might help.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Daniel
  • 993
  • 2
  • 10
  • 23
  • What about leaving the comma (because users with such a locale are used to it) and transform every comma into points after (or even during) the input? – Zaphod Dec 14 '18 at 15:57
  • 1
    @Zaphod everywhere in the app we use us locale style to display floaing numbers so it would be inconsistent. It might sound strange, but it is as it is. – Daniel Dec 14 '18 at 15:59
  • I understand, but according to the guidelines displaying informations without using the Locale of the device is inconsistent for the global user experience, if you see what I mean. – Zaphod Dec 14 '18 at 16:03
  • 1
    I totally agree, but in current situation I have to achieve the effect I explained :) – Daniel Dec 14 '18 at 16:08

1 Answers1

0

Try the nativescript-numeric-keyboard plugin, it has the locale option to customise the decimal point.

<NumericKeyboardView locale="en_US" text="456.78"></NumericKeyboardView>
Manoj
  • 21,753
  • 3
  • 20
  • 41
  • I know this one, but it has not native look. – Daniel Dec 14 '18 at 16:58
  • Unfortunately you have to compromise on one or other issue, Apple won't allow you to customise the keyboard or it's locale so you have to build your own one which the plugin does for you. – Manoj Dec 14 '18 at 17:02