mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 03:50:11 +08:00
Add visible-password for TextInput.keyboardType on Android
Summary:
`visible-password` represents a very basic keyboard, typically only
letters and numbers. Backed by InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD,
it is useful for things like password and code entry fields. It can also be more
effective than autoCorrect={false} for disabling autocompletion on some keyboards
(like Gboard).
Note `secureTextEntry` also affects `TYPE_TEXT_VARIATION_*` flags internally, so there
may be some undefined behavior when combining `secureTextEntry` with
`keyboardType="visible-password"`
Also, while here, improve the documentation on TextInput to explicitly enumerate
which keyboardType applies to Android vs. iOS (since this is the first android-specific)
Reviewed By: shergin
Differential Revision: D6005353
fbshipit-source-id: 13af90c96353f714c0e106dd0fde90184a476533
This commit is contained in:
committed by
Facebook Github Bot
parent
7b575d669d
commit
752b68857c
@@ -77,6 +77,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_PHONE_PAD = "phone-pad";
|
||||
private static final String KEYBOARD_TYPE_VISIBLE_PASSWORD = "visible-password";
|
||||
private static final InputFilter[] EMPTY_FILTERS = new InputFilter[0];
|
||||
private static final int UNSET = -1;
|
||||
|
||||
@@ -528,6 +529,8 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
flagsToSet = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_CLASS_TEXT;
|
||||
} else if (KEYBOARD_TYPE_PHONE_PAD.equalsIgnoreCase(keyboardType)) {
|
||||
flagsToSet = InputType.TYPE_CLASS_PHONE;
|
||||
} else if (KEYBOARD_TYPE_VISIBLE_PASSWORD.equalsIgnoreCase(keyboardType)) {
|
||||
flagsToSet = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
|
||||
}
|
||||
updateStagedInputTypeFlag(
|
||||
view,
|
||||
|
||||
Reference in New Issue
Block a user