Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -547,6 +548,7 @@ const Swipeable = (props: SwipeableProps) => {
return pan;
}, [
enabled,
hitSlop,
enableTrackpadTwoFingerGesture,
dragOffsetFromRightEdge,
dragOffsetFromLeftEdge,
Expand Down Expand Up @@ -576,7 +578,6 @@ const Swipeable = (props: SwipeableProps) => {
<Animated.View
{...remainingProps}
onLayout={onRowLayout}
hitSlop={hitSlop ?? undefined}
style={[styles.container, containerStyle]}>
{leftElement()}
{rightElement()}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<PanGestureHandlerProps, SwipeableExcludes> {
export interface SwipeableProps {
/**
*
*/
ref?: React.RefObject<SwipeableMethods | null>;

/**
* 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;

/**
* Enables two-finger gestures on supported devices, for example iPads with
* trackpads. If not enabled the gesture will require click + drag, with
Expand Down
Loading