Repository navigation
Keep an email field's cursor hidden on Xiaomi Android 10 when caretHidden changes - #59124
Open
YevheniiKotyrlo wants to merge 1 commit into
Open
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
…dden changes setCaretHidden left an email field alone only when its staged input type equalled TYPE_TEXT_VARIATION_EMAIL_ADDRESS, which an email field's type, carrying TYPE_CLASS_TEXT too, never does, so any caretHidden update showed the cursor the react#27204 workaround hides. The cursor is now set once per update, in onAfterUpdateTransaction after the input type is committed, from caretHidden and the committed type's class and variation.
Contributor
Author
Device evidence — before / afterUNFIXED — After FIXED — The cursor stays hidden.
Xiaomi Mi MIX 3, Android 10 (API 29), MIUI 12: RNTester release builds of |
YevheniiKotyrlo
marked this pull request as ready for review
October 16, 2026 01:40
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary:
On Xiaomi devices running Android 10, React Native hides the cursor of an
email-addressTextInput, a workaround for a crash in MIUI (#27204). Any later update ofcaretHidden,caretHidden={false}included, undoes it and the cursor comes back.setCaretHiddenis meant to leave the workaround alone, and checksview.stagedInputType == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS.setKeyboardTypestages the variation together withTYPE_CLASS_TEXT, so the check never holds. Whether the cursor comes back also depends on the order the two props are applied in, since the check reads a staged type the keyboard type may not have reached yet.Whether the cursor shows is one decision over two props, so this makes it once.
setCaretHiddenonly stages its value (stagedCaretHidden, besidestagedAutoCapitalize),setKeyboardTypeno longer touches the cursor, andonAfterUpdateTransactionsetsisCursorVisibleafter the input type is committed: visible unlesscaretHidden, or unless the committed type is a text field with the email variation on Xiaomi Android 10, read throughTYPE_MASK_CLASSandTYPE_MASK_VARIATION.Changelog:
[ANDROID] [FIXED] - Keep an
email-addressTextInput's cursor hidden on Xiaomi Android 10 whencaretHiddenchangesTest Plan:
ReactTextInputPropertyTestgains three cases:caretHiddenhides and shows the cursor; on Xiaomi Android 10 (@Config(sdk = [Q])withShadowBuild.setManufacturer("Xiaomi")) an email field's cursor stays hidden after acaretHiddenupdate, which fails onmain(expected false but was true); andcaretHiddenstill applies to a non-email field there. The ReactAndroid unit suite and ktfmt pass.On a Xiaomi Mi MIX 3 (Android 10, API 29, MIUI 12), with RNTester release builds of
mainand of this PR running the Playground below: focus the field, typea, then press the button twice. Withmainthe cursor is drawn again and blinks (2 different images of the field in 10 screenshots); with this PR it stays hidden (1). Two runs of each agree, and the captures and readings are in this comment. Typing@afterwards crashed neither build on this MIUI version, so the crash in #27204 itself did not reproduce here.packages/rn-tester/js/examples/Playground/RNTesterPlayground.js