Skip to content

[Android] Fix TextInput simultaneous relations#4169

Merged
m-bert merged 1 commit into
mainfrom
@mbert/text-input-scroll
May 13, 2026
Merged

[Android] Fix TextInput simultaneous relations#4169
m-bert merged 1 commit into
mainfrom
@mbert/text-input-scroll

Conversation

@m-bert
Copy link
Copy Markdown
Collaborator

@m-bert m-bert commented May 12, 2026

Description

shouldRecognizeSimultaneously hook method has three possible return values: true/false/null. Override in EditText hook states that:

(...) if other handler is NativeViewGestureHandler then don't override the default implementation

However, instead of null it returns ... && handler !is NativeViewGestureHandler, so there's no way of getting null value, which is used in Native gesture shouldRecognizeSimultaneously method.

Fixes #3520

Test plan

Tested on the following code:
import {
  GestureHandlerRootView,
  ScrollView,
  TextInput,
} from 'react-native-gesture-handler';

function Component() {
  return (
    <ScrollView>
      {Array.from({ length: 50 }).map((_, index) => (
        <TextInput
          key={index}
          placeholder={`${index}`}
          style={{
            height: 40,
            borderColor: 'gray',
            borderWidth: 1,
            marginBottom: 10,
          }}
        />
      ))}
    </ScrollView>
  );
}

export default function App() {
  return (
    <GestureHandlerRootView>
      <Component />
    </GestureHandlerRootView>
  );
}

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Android TextInput simultaneous-recognition behavior by allowing the EditText hook to return null from shouldRecognizeSimultaneously, so NativeViewGestureHandler can fall back to its default simultaneous-recognition logic when the peer handler is also a NativeViewGestureHandler.

Changes:

  • Update EditTextHook.shouldRecognizeSimultaneously to return null when the other handler is NativeViewGestureHandler (instead of always returning a boolean).
  • Keep explicit exclusion of RootViewGestureHandler from simultaneous recognition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m-bert m-bert requested a review from j-piasecki May 12, 2026 11:42
@m-bert m-bert merged commit 1f1e661 into main May 13, 2026
7 checks passed
@m-bert m-bert deleted the @mbert/text-input-scroll branch May 13, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ScrollView doesn't scroll when touch events occur inside TextInput from react-native-gesture-handler on Android

3 participants