From 0a17a4fe56ff2cabc3c7d1cc5b34bd3fdd032e59 Mon Sep 17 00:00:00 2001 From: "Michael Yoon (LAX)" Date: Wed, 4 Mar 2020 17:37:58 -0800 Subject: [PATCH] fix android TextInput transitions Summary: On Android, when changing the props on TextInput component, there are cases where behavior is incorrect. ex: there were two other PR requests to fix the following issues: 1) TextInput doesnt respect the autoCapitalize prop when keyboardType is set to "default" 2) Password visibility is broken But those PRs ended up breaking a transition from phone-pad to default Root cause - The issue is that the bits that Android defines to store the InputType flags are reused. - For example, the previous issue: TYPE_TEXT_FLAG_CAP_WORDS and TYPE_NUMBER_FLAG_DECIMAL are both using 0x00002000 bit. So when switching input types from phone-pad to default (text), it is not known if this bit should be cleared. It could have been set for capitalize or for indicating the num pad should be generic. the solution is to always unset the TYPE_CLASS flags before setting the keyboardType so the user has the correct keyboard. Changelog: [Fixed] TextInput transition from phone-pad to default Reviewed By: JoshuaGross Differential Revision: D20263334 fbshipit-source-id: 0b283fbd6314bf10b90f760917447d2439aaa147 --- .../views/textinput/ReactTextInputManager.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index af8cf64b9fc3db..1b681118d64729 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -97,12 +97,6 @@ public class ReactTextInputManager extends BaseViewManager