From 9ad14e22c439fc4614f94ee52265c19f0c6c26f0 Mon Sep 17 00:00:00 2001 From: lazerg Date: Fri, 11 Sep 2026 03:02:06 +0500 Subject: [PATCH] Only claim the TextInput responder while a touch is active --- .../Libraries/Components/TextInput/TextInput.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index ee48b398c125..de80e817fd29 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -161,7 +161,10 @@ type LastNativeSelection = { mostRecentEventCount: number, }; -const emptyFunctionThatReturnsTrue = () => true; +// Claiming the responder on a selection change with no active touch leaves the +// input holding it with no matching touch event to release it. +const hasActiveTouch = (event: GestureResponderEvent) => + event.touchHistory.numberActiveTouches > 0; /** * This hook handles the synchronization between the state of the text input @@ -604,7 +607,7 @@ function InternalTextInput(props: TextInputProps): React.Node { onFocus={_onFocus} onScroll={_onScroll} onSelectionChange={_onSelectionChange} - onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue} + onSelectionChangeShouldSetResponder={hasActiveTouch} selection={selection} selectionColor={selectionColor} style={StyleSheet.compose(