Skip to content

Fix onSubmitEditing firing twice for hardware Enter in multiline TextInput on Android - #59000

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-58990-hardware-enter-double-submit
Open

lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-58990-hardware-enter-double-submit

Conversation

@lazerg

@lazerg lazerg commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Summary:

Fixes #58990.

When a hardware Enter key is pressed in a multiline TextInput with submitBehavior="submit", TextView calls the editor action listener on key down, and because the listener returns true it sets enterDown and calls the listener again on key up with the same IME_NULL action. Our listener doesn't look at the key event, so it dispatches onSubmitEditing both times. Single-line inputs don't hit this because ReactEditText.onKeyUp already consumes Enter before TextView sees it, and IME action buttons pass a null event.

The listener now ignores the key-up call and just keeps consuming it. TextView only calls the listener on key up after the key down was already handled, so nothing else changes.

Changelog:

[ANDROID] [FIXED] - Fix onSubmitEditing firing twice when pressing a hardware Enter key in a multiline TextInput with submitBehavior="submit"

Test Plan:

Added ReactTextInputSubmitEditingTest, which sends an Enter key down and key up to a multiline TextInput with submitBehavior="submit" and checks that only one submit event is dispatched. It fails on main (2 dispatches) and passes with this change.

./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests "com.facebook.react.views.textinput.*"

ReactTextInputPropertyTest (28) and the new test pass.

@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 Oct 12, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 12, 2026

This branch has not been deployed

No deployments
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.

[0.88.0-rc.4][Android] TextInput onSubmitEditing fires twice on Android with hardware keyboard

1 participant