From e0773a746edd464d54f8a85234b904f2d8d69ad7 Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Mon, 12 Oct 2026 21:37:11 +0300 Subject: [PATCH] Fix Android visible-password keyboard input type keyboardType="visible-password" sets TYPE_TEXT_VARIATION_VISIBLE_PASSWORD with no input class, and setKeyboardType applies its flags with TYPE_MASK_CLASS as the mask to clear, so the field is committed with class TYPE_NULL, which Android documents as not editable. The url arm had the same omission until #58505; this gives visible-password the TYPE_CLASS_TEXT the email-address and url arms already set. The test masked its reading with generalKeyboardTypeFlags, which excludes TYPE_TEXT_VARIATION_PASSWORD, so it compared 0x10 and passed with the class missing. It now asserts the class and the variation exactly. --- .../react/views/textinput/ReactTextInputManager.kt | 2 +- .../react/views/textinput/ReactTextInputPropertyTest.kt | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt index 2830fc92a9f0..82e5abd361bd 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt @@ -758,7 +758,7 @@ public open class ReactTextInputManager public constructor() : } else if (KEYBOARD_TYPE_VISIBLE_PASSWORD.equals(keyboardType, ignoreCase = true)) { // This will supersede secureTextEntry={false}. If it doesn't, due to the way // the flags work out, the underlying field will end up a URI-type field. - flagsToSet = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD + flagsToSet = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD } else if (KEYBOARD_TYPE_URI.equals(keyboardType, ignoreCase = true)) { flagsToSet = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_URI } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.kt index 216dd5522be9..82ec014eb89e 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.kt @@ -386,12 +386,9 @@ class ReactTextInputPropertyTest { @Test fun testKeyboardTypeVisiblePassword() { - val passwordVisibilityFlag = - InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD and - InputType.TYPE_TEXT_VARIATION_PASSWORD.inv() - manager.updateProperties(view, buildStyles("keyboardType", "visible-password")) - assertThat(view.inputType and generalKeyboardTypeFlags).isEqualTo(passwordVisibilityFlag) + assertThat(view.inputType and (InputType.TYPE_MASK_CLASS or InputType.TYPE_MASK_VARIATION)) + .isEqualTo(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) } @Test