From 48bd54f83c0fbea370954751bba1f1e48fc73d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Sat, 15 Nov 2025 14:55:18 +0100 Subject: [PATCH 1/2] Remove Pan Props --- .../ReanimatedSwipeableProps.ts | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts b/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts index 3aa66b9a2d..11dcafa6ec 100644 --- a/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts +++ b/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts @@ -1,26 +1,40 @@ import React from 'react'; -import type { PanGestureHandlerProps } from '../../handlers/PanGestureHandler'; import { SharedValue } from 'react-native-reanimated'; import { StyleProp, ViewStyle } from 'react-native'; import { RelationPropType } from '../utils'; - -type SwipeableExcludes = Exclude< - keyof PanGestureHandlerProps, - 'onGestureEvent' | 'onHandlerStateChange' ->; +import { HitSlop } from '../../handlers/gestureHandlerCommon'; export enum SwipeDirection { LEFT = 'left', RIGHT = 'right', } -export interface SwipeableProps - extends Pick { +export interface SwipeableProps { /** * */ ref?: React.RefObject; + /** + * + */ + testID?: string; + + /** + * + */ + children?: React.ReactNode; + + /** + * + */ + enabled?: boolean; + + /** + * + */ + hitSlop?: HitSlop; + /** * Enables two-finger gestures on supported devices, for example iPads with * trackpads. If not enabled the gesture will require click + drag, with From ab5a11700f5148d57e467a99d4f060a744ab8ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Sat, 15 Nov 2025 15:15:16 +0100 Subject: [PATCH 2/2] Hide pan props --- .../ReanimatedSwipeable/ReanimatedSwipeable.tsx | 3 ++- .../ReanimatedSwipeable/ReanimatedSwipeableProps.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx b/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx index d870c9adc1..a1c840e173 100644 --- a/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx +++ b/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx @@ -501,6 +501,7 @@ const Swipeable = (props: SwipeableProps) => { const panGesture = useMemo(() => { const pan = Gesture.Pan() .enabled(enabled !== false) + .hitSlop(hitSlop) .enableTrackpadTwoFingerGesture(enableTrackpadTwoFingerGesture) .activeOffsetX([-dragOffsetFromRightEdge, dragOffsetFromLeftEdge]) .onStart(updateElementWidths) @@ -547,6 +548,7 @@ const Swipeable = (props: SwipeableProps) => { return pan; }, [ enabled, + hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, @@ -576,7 +578,6 @@ const Swipeable = (props: SwipeableProps) => { {leftElement()} {rightElement()} diff --git a/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts b/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts index 11dcafa6ec..f81877d1b2 100644 --- a/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts +++ b/packages/react-native-gesture-handler/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts @@ -16,22 +16,22 @@ export interface SwipeableProps { ref?: React.RefObject; /** - * + * Sets a `testID` property, allowing for querying `ReanimatedSwipeable` for it in tests. */ testID?: string; - /** - * - */ children?: React.ReactNode; /** - * + * Indicates whether `ReanimatedSwipeable` should be analyzing stream of touch events or not. + * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#enabledvalue-boolean */ enabled?: boolean; /** - * + * This parameter enables control over what part of the connected view area can be used to begin recognizing the gesture. + * When a negative number is provided the bounds of the view will reduce the area by the given number of points in each of the sides evenly. + * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#hitslopsettings */ hitSlop?: HitSlop;