Only claim the TextInput responder while a touch is active - #58477
Open
lazerg wants to merge 1 commit into
Open
Conversation
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:
TextInputpassesonSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}, so it takes the JS responder on any selection change the responder system walks. That walk is gated ontrackedTouchCount > 0, and the counter counts events rather than touches: press two fingers down separately, lift them together, and it never comes back down, since two starts arrive as two events and the lift arrives as one. From then on every keystroke-driven selection change hands the responder to the focused input with no touch behind it, and the next tap elsewhere is dropped, because negotiation dispatches from the lowest common ancestor of the responder and the new target and so never reaches the new target's ownonStartShouldSetResponder.Claim it only while
touchHistory.numberActiveTouches > 0, which is read fromtouches.lengthon every start and end and does track the real state. Drag selection keeps working, since a finger is down for the whole gesture.Fixes #58445. RNTester reproducer in #58449.
Changelog:
[IOS] [FIXED] - TextInput no longer takes the touch responder on a selection change with no active touch
Test Plan:
yarn lintandyarn flow-checkclean,yarn test packages/react-native/Libraries/Componentspasses