[Android] v3 `ReanimatedSwipeable` takes over a vertical scroll in a React Native list once the finger drifts 10 dp sideways

Đang mở
#4,670 6 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@JaydeepAgravat đang làm issue này rồi.

Từ ngày 6/11/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, react-native, typescript
Lĩnh vực
backend, mobile

Hướng nghiên cứu

Start by tracing RNGestureHandlerRootHelper.requestDisallowInterceptTouchEvent() and GestureHandlerOrchestrator.cancelAllLegacyHandlers(), then check how v3 detector action types are handled alongside the deferred cancellation from #4441. Reproduce with the linked example on Android using a vertical drag with sideways drift. Done when the React Native list keeps scrolling without opening a swipeable row, while existing gesture cancellation behavior still works.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Platform: Android
Description

On Android, a ReanimatedSwipeable row inside a React Native FlatList / SectionList / ScrollView can take the touch away from a scroll that has already started. A vertical scroll with any slight sideways drift (a normal thumb arc) gets cancelled, and the row under the finger swipes open instead. iOS doesn't have the problem: once UIScrollView's pan has recognized, the row can't activate.

The cause looks like the same gap as #4432, this time for gestures created with the v3 hooks:

  • When React Native's ScrollView starts dragging, it calls requestDisallowInterceptTouchEvent(true). RNGestureHandlerRootHelper.requestDisallowInterceptTouchEvent() responds with GestureHandlerOrchestrator.cancelAllLegacyHandlers(), which only cancels handlers whose action type is JS_FUNCTION_OLD_API, JS_FUNCTION_NEW_API, REANIMATED_WORKLET or NATIVE_ANIMATED_EVENT.
  • ReanimatedSwipeable now uses usePanGesture with the v3 GestureDetector, so its pan is attached with ACTION_TYPE_NATIVE_DETECTOR. That type isn't in the list above.
  • #4441 added deferred cancellation (cancelHandlersOnNativeTouchGrab), but it only covers NativeViewGestureHandlers that opt in (buttons).

As a result the scroll view's touch grab doesn't cancel the swipeable's pan. The pan keeps tracking for the rest of the scroll and activates as soon as the total horizontal movement passes activeOffsetX (10 dp by default). The root then intercepts and cancels the ScrollView mid-scroll.

The v2 Swipeable and the v2 Gesture.Pan() API didn't have this problem, because their action types are in cancelAllLegacyHandlers, so this is a regression for anyone moving to v3.

Workaround: use gesture-handler's ScrollView as the list's scroll view (renderScrollComponent={(props) => <ScrollView {...props} />}) together with gesture-handler's RefreshControl. The scroll then takes part in the orchestrator's normal arbitration and wins once it's active.

Steps to reproduce
  1. Render a vertical React Native FlatList (not gesture-handler's) of ReanimatedSwipeable rows with renderRightActions.
  2. On an Android device, drag upward about 900 px with roughly 250 px of leftward drift (about 15° off vertical).
  3. The list barely scrolls, and the row under the finger swipes open to its right actions.
  4. Drag straight up the same distance: the list scrolls normally.
  5. Switch the list to gesture-handler's FlatList (or pass gesture-handler's ScrollView via renderScrollComponent) and repeat step 2: the list scrolls and no row opens.
import { FlatList, Text, View } from 'react-native';
import ReanimatedSwipeable from 'react-native-gesture-handler/ReanimatedSwipeable';

const data = Array.from({ length: 50 }, (_, i) => String(i));

export default function App() {
  return (
    <FlatList
      data={data}
      keyExtractor={(item) => item}
      renderItem={({ item }) => (
        <ReanimatedSwipeable
          renderRightActions={() => <View style={{ width: 80, backgroundColor: 'red' }} />}
        >
          <View style={{ height: 72, justifyContent: 'center', padding: 16, backgroundColor: '#eee' }}>
            <Text>Row {item}</Text>
          </View>
        </ReanimatedSwipeable>
      )}
    />
  );
}

Suggested fix: include ACTION_TYPE_NATIVE_DETECTOR (and ACTION_TYPE_VIRTUAL_DETECTOR, if it applies) in the handlers cancelled when a native view grabs the touch mid-gesture, or give them the deferred grabbedMidGesture treatment from #4441.

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

https://github.com/IGx89/rngh-swipeable-scroll-repro

Gesture Handler version

3.3.0 (code unchanged on main / 3.4.0)

React Native version

0.88.1

Platforms

Android

JavaScript runtime

Hermes

Workflow

Using Expo Prebuild or an Expo development build

Build type

Debug mode

Device

Real device

Device model

Samsung Galaxy XCover Pro (SM-G715U), Android 13

Acknowledgements

Yes

Ngôn ngữ chính
TypeScript
Star
6.8k
Fork
1.1k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của software-mansion/react-native-gesture-handler

Tất cả issue của software-mansion/react-native-gesture-handler

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.