-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Hi folks,
I'm not only submitting this issue as a feature request, but also as "poor mans documentation" offering a solution to others looking for a similar issue.
I'm developing an app where I want the user to be able to enter a PIN code, so only numbers. I thought I'd use the number keyboard type on Android and phone on iOS. Android is fine, but I wanted to get rid of the characters in the lower left corner on iOS:
Since the {N} KeyboardType enum doesn't contain the numberPad type I did this ({N}-Angular):
@ViewChild("pincodeField") pincodeField: ElementRef;
this.pincodeField.nativeElement.ios.keyboardType = Constants.IOS_KEYBOARD_TYPES.numberPad;Where Constants.IOS_KEYBOARD_TYPES.numberPad is just a custom property that resolves to 4.
This gives me a nice and clean PIN entry keyboard 🎉
Note that there's also a sweet decimalPad, constant value is 8 which renders this keyboard which I'm using for entering fractions (like payments):
Wouldn't it be nice if I can use this to achieve the same thing?
<TextField #pincodeField keyboardType="numberPad"></TextField>
<TextField #amountField keyboardType="decimalPad"></TextField>Surely these properties are iOS-specific but differentiating between iOS and Android is quite easy in {N}'s views anyway. Or we can tie the [keyboardType]="keyboardType" to a property of the component. We can also just use the closest Android keyboard so users don't even need to bother specifying that seperaterly.
Thanks for considering!
Eddy
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.


