Skip to content

Commit

Permalink
[FEATURE] add number-pad type to android
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeransori committed Mar 13, 2018
1 parent 7a1c618 commit b638847
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ const TextInput = createReactClass({
*
* - `default`
* - `numeric`
* - `number-pad`
* - `email-address`
* - `phone-pad`
*
Expand All @@ -254,7 +255,6 @@ const TextInput = createReactClass({
* - `ascii-capable`
* - `numbers-and-punctuation`
* - `url`
* - `number-pad`
* - `name-phone-pad`
* - `decimal-pad`
* - `twitter`
Expand All @@ -272,11 +272,11 @@ const TextInput = createReactClass({
'email-address',
'numeric',
'phone-pad',
'number-pad',
// iOS-only
'ascii-capable',
'numbers-and-punctuation',
'url',
'number-pad',
'name-phone-pad',
'decimal-pad',
'twitter',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
private static final int INPUT_TYPE_KEYBOARD_NUMBERED =
InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL |
InputType.TYPE_NUMBER_FLAG_SIGNED;
private static final int INPUT_TYPE_KEYBOARD_NUMBER_PAD = InputType.TYPE_CLASS_NUMBER;
private static final int PASSWORD_VISIBILITY_FLAG = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD &
~InputType.TYPE_TEXT_VARIATION_PASSWORD;
private static final int KEYBOARD_TYPE_FLAGS = INPUT_TYPE_KEYBOARD_NUMBERED |
Expand All @@ -80,6 +81,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout

private static final String KEYBOARD_TYPE_EMAIL_ADDRESS = "email-address";
private static final String KEYBOARD_TYPE_NUMERIC = "numeric";
private static final String KEYBOARD_TYPE_NUMBER_PAD = "number-pad";
private static final String KEYBOARD_TYPE_PHONE_PAD = "phone-pad";
private static final String KEYBOARD_TYPE_VISIBLE_PASSWORD = "visible-password";
private static final InputFilter[] EMPTY_FILTERS = new InputFilter[0];
Expand Down Expand Up @@ -557,6 +559,8 @@ public void setKeyboardType(ReactEditText view, @Nullable String keyboardType) {
int flagsToSet = InputType.TYPE_CLASS_TEXT;
if (KEYBOARD_TYPE_NUMERIC.equalsIgnoreCase(keyboardType)) {
flagsToSet = INPUT_TYPE_KEYBOARD_NUMBERED;
} else if (KEYBOARD_TYPE_NUMBER_PAD.equalsIgnoreCase(keyboardType)) {
flagsToSet = INPUT_TYPE_KEYBOARD_NUMBER_PAD;
} else if (KEYBOARD_TYPE_EMAIL_ADDRESS.equalsIgnoreCase(keyboardType)) {
flagsToSet = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_CLASS_TEXT;
} else if (KEYBOARD_TYPE_PHONE_PAD.equalsIgnoreCase(keyboardType)) {
Expand Down

0 comments on commit b638847

Please sign in to comment.