Skip to content

Commit 30bb031

Browse files
committed
add panGestureHandlerProps to Carousel props
1 parent 94e7103 commit 30bb031

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Carousel.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import type { FlexStyle, ViewStyle } from 'react-native';
33
import {
44
PanGestureHandler,
5+
PanGestureHandlerProps,
56
PanGestureHandlerGestureEvent,
67
} from 'react-native-gesture-handler';
78
import Animated, {
@@ -97,6 +98,10 @@ export interface ICarouselProps<T extends unknown> {
9798
* On scroll end
9899
*/
99100
onScrollEnd?: (previous: number, current: number) => void;
101+
/**
102+
* PanGestureHandler props
103+
*/
104+
handlerProps?: Omit<PanGestureHandlerProps, 'onHandlerStateChange'>;
100105
}
101106

102107
export interface ICarouselInstance {
@@ -138,6 +143,7 @@ function Carousel<T extends unknown = any>(
138143
onSnapToItem,
139144
style,
140145
timingConfig = defaultTimingConfig,
146+
handlerProps,
141147
} = props;
142148
const lockController = useLockController();
143149
const handlerOffsetX = useSharedValue<number>(0);
@@ -363,7 +369,10 @@ function Carousel<T extends unknown = any>(
363369
]);
364370

365371
return (
366-
<PanGestureHandler onHandlerStateChange={animatedListScrollHandler}>
372+
<PanGestureHandler
373+
onHandlerStateChange={animatedListScrollHandler}
374+
{...handlerProps}
375+
>
367376
<Animated.View
368377
style={[
369378
// eslint-disable-next-line react-native/no-inline-styles

0 commit comments

Comments
 (0)