Skip to content

[Android] Touchable inside Gesture Handler's ScrollView still fires onPress when the touch only stops a fling (3.3.0) #4547

Description

@janicduplessis

Description

On Android, a v3 Touchable inside Gesture Handler's own scroll components (FlatList/ScrollView from react-native-gesture-handler, or a SectionList whose renderScrollComponent returns RNGH's ScrollView) fires onPress when the touch only stops a fling: fling the list, put a finger down to stop it, lift without moving, and the row under the finger fires onPress.

Expected: the tap only stops the fling and no onPress fires. That is what happens with React Native's ScrollView/FlatList since #4432 was fixed by #4441 in 3.3.0.

Rows Scroll container RNGH Result
RN Pressable RN SectionList 3.2.1 no press
Touchable RNGH ScrollView via renderScrollComponent 3.2.1 phantom onPress
Touchable RNGH ScrollView via renderScrollComponent 3.3.0 phantom onPress
Touchable RN SectionList 3.3.0 no press
Touchable (minimal repro) RNGH FlatList 3.3.0 phantom onPress, 5/5 trials
Touchable (minimal repro) RN FlatList 3.3.0 no press, 0/5 trials

The first four rows are from our app (two trials each, same emulator and build); the last two are from the minimal repro below. Without the tap, the same fling scrolls to the end of the list, so the tap lands while the list is still moving. A tap on a list at rest fires onPress with both lists. The fling and tap were driven with adb shell input.

Recording of the minimal repro: first half RNGH FlatList (the counter goes 0 -> 1 -> 2), second half RN FlatList (the counter stays at 0).

rngh4547.mp4

Steps to reproduce

  1. Create the app from the gist below: npx create-expo-app@latest rngh4547 --template blank-typescript@sdk-57, npm install react-native-gesture-handler@3.3.0, replace App.tsx, npx expo run:android. It renders 30 Touchable rows in RNGH's FlatList and shows a press counter.
  2. On an Android emulator (1080x2400), scroll to the top: adb shell "input swipe 540 800 540 2200 100; input swipe 540 800 540 2200 100; input swipe 540 800 540 2200 100".
  3. Fling and tap while the list is still moving: adb shell "input swipe 540 2000 540 900 40; input tap 540 1400".
  4. The counter increments: the row under the tap fired onPress.
  5. Tap the gray button at the top to switch to React Native's FlatList and repeat steps 2-3. The tap only stops the list and the counter stays at 0.

A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.

https://gist.github.com/janicduplessis/80f4ac8a40f128c7d68c101e20110dd5

Gesture Handler version

3.3.0 (also reproduced in our app on 3.2.1)

React Native version

0.86.3 in the minimal repro; first seen in our app on 0.88.0-rc.1

Versions of related libraries

  • Minimal repro: expo 57.0.25 only. Reanimated, Worklets and Screens are not installed, and the bug still reproduces.
  • Our app: react-native-reanimated 4.7.0, react-native-worklets 0.13.0, react-native-screens 4.28.0, expo 58.0.0-preview.7

Platforms

Android. iOS not verified.

JavaScript runtime

Hermes

Workflow

Using Expo Prebuild or an Expo development build

Architecture

New Architecture (Fabric)

Build type

Debug mode

Device

Android emulator

Device model

sdk_gphone64_arm64 (Android 16, API 36), gesture navigation

Acknowledgements

Yes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions