Skip to content

Add support for more keyboard types #3303

Open
@EddyVerbruggen

Description

@EddyVerbruggen

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:

keyboardtype phone

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 🎉

keyboardtype numberpad

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):

keyboardtype decimalpad

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions