Skip to content

fix: Crash on Android 10 due to pointerIndex out of range in ReactScrollView with react-native-gesture-handler #3642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

buuhvprojects
Copy link

@buuhvprojects buuhvprojects commented Jul 26, 2025

WHAT IS THE DRIVING SCENARIO?

This crash, Fatal Exception: java.lang.IllegalArgumentException with message pointerIndex out of range , occurring in com.facebook.react.views.scroll.ReactScrollView.onTouchEvent , indicates a problem with how touch events are being handled in the Android native layer by the ReactScrollView component.
Given the information about react-native-gesture-handler and the forum post, the cause is an integration issue between ReactScrollView and react-native-gesture-handler , where intercepting the latter's event disrupts the former's expectations regarding pointer indices.

HOW TO REPRODUCE?

Use an Android 10 device.
Access a screen with ReactScrollView active.
End up with an input field activated with the keyboard showing. Repeatedly scrolling
The app may crash and close unexpectedly.

WHAT WAS DONE IN THIS PR?

Applied a mitigation patch related to the pointerIndex out of range issue, inspired by discussions and solutions in the react-native-gesture-handler repository

Ensured compatibility between ReactScrollView and react-native-gesture-handler to avoid conflicts in touch events.

Added additional protections in native handlers to prevent invalid pointer exceptions.

HOW TO TEST LOCALLY?

Run a production app because the issue doesn't occur with a debug app.
Install the app on a device with Android 10.
Keep an input field activated with the keyboard showing.
Keep scrolling up and down until it crashes.

@buuhvprojects buuhvprojects changed the title fix: Crash on Android 10 due to pointerIndex out of range in ReactScrollView with gesture-handler fix: Crash on Android 10 due to pointerIndex out of range in ReactScrollView with react-native-gesture-handler Jul 26, 2025
@m-bert
Copy link
Contributor

m-bert commented Jul 28, 2025

Hi @buuhvprojects! Thanks for submitting this patch. Could you please provide some example code that crashes. Also, does it occur only on Android 10 devices?

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.

2 participants