Allow decimalChar ',' insted '.'


#1

Hi guys.

How i can change the keyboardType=‘number’ in a or , to allow decimalChar == ‘,’ (Locale PT_BR or nl_NL) instead default ‘.’ ?
I tried to change the field in TS to String, tried to change locale in app.module (LOCALE_ID),
tried to install plugin , without success.

Thank’s!
Jaime


#2

I don’t think you can modify a specific key in keyboard but just use the set of options provided by platform. At least in Android these are the available input types, may I know which one you are looking for?


#3

Thank’s for reply, manojdcoder.

I’ve tried that, but Android only permit user to press ‘.’ button. When press ‘,’ button, the numericKeyboard ignores the value. In pt_BR locale, char ‘,’ is used as decimal part from Number.

On another Angular 2 WebApp, have solved this using component (ng2-currency-mask, URL https://www.npmjs.com/package/ng2-currency-mask).

I think if is possible change the locale in Nativescript Core, this can be solved.

Anyway, we are using full keyboard, users claim to change to NumericKeyboard, in the future, perhaps ?

Thanks


#4

In that case you can use the same masked textfield in NativeScript - https://market.nativescript.org/plugins/nativescript-masked-text-field :sunglasses: