react-native-gesture-handler: becomes unresponsive when used within a List

Description

Using a RectButton in a List component (FlatList/SectionList) will become unresponsive in certain scenarios. I am not sure whether this is an incorrect usage of this library or it’s something new with RN. This wasn’t an issue in production before.

  • It’s observed that the event handler is not called when it’s unresponsive
  • It’s observed that when RectButton is unresponsive, it’s also unresponsive to swipe up to close the android app
  • It’s observed that using the same example, it cannot be reproduced on Snack
  • Finally, setting shouldActivateOnStart=true on RectButton seems to solve the issue
  • Additionally, I initially thought it’s because I’m not using RectButton inside RNGH’s ScrollView so I’ve added a SectionList export via patch-package. This also seems to solve the issue other than setting shouldActivateOnStart=true.

Platforms

  • iOS
  • Android
  • Web

Screenshots

https://user-images.githubusercontent.com/23186058/183584450-ceebbea3-9298-4fb4-abcf-b0bf30b29cd5.mov

https://user-images.githubusercontent.com/23186058/183584650-a8e130da-a4db-4100-94f3-fcbbed814f91.mov

Steps To Reproduce

Using RN’s SectionList

  1. Scroll multiple times to the bottom of the list
  2. All <RectButton> instances become unresponsive
  3. Navigate to “Solution” by pressing the button in Header
  4. All <RectButton shouldActivateOnStart> instances are still responsive (however the ripple effect is gone)
  5. Exit and reload the app and navigate straight to “Solution” and repeat Step 1
  6. Everything works fine

Using re-exported SectionList by overriding its ScrollViewComponent with RNGH’s ScrollView via renderScrollComponent

  1. Apply the package by running yarn patch-package
  2. Scroll multiple times to the bottom of the list
  3. Everything works fine

Expected behavior

  • RectButton does not become unresponsive when used within a List component on Android

Actual behavior

  • RectButton becomes unresponsive when used within a List component Android

Snack or minimal code example

https://github.com/nujhong/RNGH-RectButton-In-a-List

Package versions

  • React: 18.0.0
  • React Native: 0.69.1
  • React Native Gesture Handler: 2.5.0
  • React Native Reanimated: 2.9.1

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 18 (4 by maintainers)

Commits related to this issue

Most upvoted comments

An update that is hopefully useful @j-piasecki

This seems to be a problem specific to react-native-gesture-handler@2.5.0 + Android 12, without regards to react-native, as Expo SDK 46 also bumped it from 2.2.0 to 2.5.0.

For the peers, we eventually downgraded it to 2.3.2 and it works for us without any workarounds now.

@itsramiel yes, in my example, you can also see that I can’t even press the top right header button. It was only working when I added shouldActivateOnStart. I’m back to business now, I will try to pull in the draft to see if that resolves the issue.

This is not an issue only with lists. I am experiencing the same problem. Basically the four buttons shown in a non list component, neither a ScrollView nor a Flatlist. The whole app is wrapped using GestureHandlerRootView yet this is the result

One of the buttons was not responsive after numerous tries, then another became responsive. Coming to first pressed button is again responsive.

  • Android 12 only

https://user-images.githubusercontent.com/80689446/189156842-83aced93-c84a-46fe-8467-48773e1f219a.mp4

Hi! At the first glance it might be related to the overscroll animation introduced in Android 12, however when you want to use gestures or components from Gesture Handler in a list, you should use the ScrollView exported from Gesture Handler. Using renderScrollComponent to override the default ScrollView is the correct solution in my opinion.