Skip to content

Fix autoCapitalize bitmask collision with numeric inputType flags#55786

Open
lukeharvey wants to merge 2 commits intofacebook:mainfrom
lukeharvey:fix/autocapitalize-numeric-bitmask-collision
Open

Fix autoCapitalize bitmask collision with numeric inputType flags#55786
lukeharvey wants to merge 2 commits intofacebook:mainfrom
lukeharvey:fix/autocapitalize-numeric-bitmask-collision

Conversation

@lukeharvey
Copy link

Summary:

setAutoCapitalize applies AUTOCAPITALIZE_FLAGS (0x7000) to all input types, but this mask overlaps TYPE_NUMBER_FLAG_SIGNED (0x1000) and TYPE_NUMBER_FLAG_DECIMAL (0x2000). On every Fabric re-render, this strips the signed/decimal flags from numeric inputs, causing commitStagedInputType to call setInputType() with corrupted flags, which restarts the IME and breaks composing-based input (e.g. Samsung keyboards' shared ./- key).

The fix skips setAutoCapitalize for TYPE_CLASS_NUMBER inputs, where autocapitalize is meaningless.

Changelog:

[Android] [Fixed] - Fix setAutoCapitalize stripping numeric TextInput flags (TYPE_NUMBER_FLAG_SIGNED/DECIMAL), affecting minus sign input on Samsung keyboards

Test Plan:

A unit test was added to ReactTextInputPropertyTest.kt that verifies setAutoCapitalize does not strip TYPE_NUMBER_FLAG_SIGNED or TYPE_NUMBER_FLAG_DECIMAL when the input type class is TYPE_CLASS_NUMBER.

@meta-cla
Copy link

meta-cla bot commented Feb 26, 2026

Hi @lukeharvey!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link

meta-cla bot commented Feb 26, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 26, 2026
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 26, 2026
@NickGerleman
Copy link
Contributor

Fix makes sense to me, but I think we would need to re-run this logic if keyboard type changes as well?

Maybe we can derive correct final InputType, from the different props onAfterUpdateTransaction().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants