Skip to content

Commit d22cc4f

Browse files
safaiyehalloy
authored andcommittedMar 5, 2020
Fix setting keyboardType from breaking autoCapitalize (#27523)
Summary: Fix for #27510. Setting the `InputType.TYPE_CLASS_TEXT` flag when `keyboardType` is null or default breaks autoCapitalize. Handle the case when `keyboardType` is null, default, or invalid type. ## Changelog [Android] [Fixed] - Fix setting keyboardType from breaking autoCapitalize Pull Request resolved: #27523 Test Plan: Added keyboardType prop to RNTester as so ``` <TextInput autoCapitalize="words" keyboardType="default" style={styles.default} /> ``` ![fixedKeyboardType](https://user-images.githubusercontent.com/8675043/70872892-c96dec80-1f5f-11ea-8e33-714a67eff581.gif) Reviewed By: makovkastar Differential Revision: D19132261 Pulled By: JoshuaGross fbshipit-source-id: be66f0317ed305425ebcff32046ad4bff06d367f
1 parent dfa8fed commit d22cc4f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java

+4
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,10 @@ public void setKeyboardType(ReactEditText view, @Nullable String keyboardType) {
731731
// This will supercede secureTextEntry={false}. If it doesn't, due to the way
732732
// the flags work out, the underlying field will end up a URI-type field.
733733
flagsToSet = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
734+
} else {
735+
// This prevents KEYBOARD_TYPE_FLAGS from being set when the keyboardType is
736+
// default, unsupported or null. Setting of this flag breaks the autoCapitalize functionality.
737+
return;
734738
}
735739
updateStagedInputTypeFlag(view, KEYBOARD_TYPE_FLAGS, flagsToSet);
736740
checkPasswordType(view);

0 commit comments

Comments
 (0)
Please sign in to comment.