From ec307e0167deca7f17640cd3c5a60f6be5f47b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Wed, 1 Jun 2022 18:48:38 -0700 Subject: [PATCH] Fix keyboard staying as email when switching between default and email (#33924) Summary: Right now, when we change the keyboardType on android between between default and email, the value keyboard type stays as email (specially noticeable with the key next to the spacebar, that changes between the comma (`,`) to the at sign (`@`)). This is because the mask we are using when updating the input is only taking into account the class, and not the flags nor the variations. We don't apply all masks because it may interfere with flags assigned by other props, like multiline or secure text entry. Therefore, we have created our own mask, taking into account all the variations and flags that the keyboardType prop may set. This may be hard to maintain, since whenever we add any other keyboard type, we have to take these flags into mind. The error I was trying to fix was in particular regarding going back and forward from email, but this fix may solve other similar issues with other keyboard styles. ## Changelog [Android] [Fixed] - Fix a bug where the keyboard, once set as email, won't change back to default. Pull Request resolved: https://github.com/facebook/react-native/pull/33924 Test Plan: In order to test this PR, any test code with a TextInput, and a way to change the value of the keyboardType should work. We should be able to see how the keyboard changes to the correct type without staying, for example, on the email state. Reviewed By: lunaleaps Differential Revision: D36784563 Pulled By: makovkastar fbshipit-source-id: 74d7b61b3c07feea4e4050d7a07603a68b98e835 --- .../react/views/textinput/ReactTextInputManager.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 f3134f9cb1dc8d..e798499be07d7b 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 @@ -148,6 +148,13 @@ public class ReactTextInputManager extends BaseViewManager