Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding props to the carousel to handle multiples gesture with react native gesture handler. #609

Open
ItsMeJules opened this issue May 13, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ItsMeJules
Copy link

Is your feature request related to a problem? Please describe.
I am always frustrated when, wanting to add new getures from react-native-gesture-handler to the carousel. I would like to do it easily. I tried wrapping each item rendered inside a <GestureDetector/> but it didn't work.

Describe the solution you'd like
As react-native-reanimated-carousel is using under the hood a <GestureDetector/> it could be great if we could provide props to the carousel component that are of the type of any gestures created with Gesture.Pan | Gesture.Fling | Gesture...

It could look like this :

return (
  <Carousel
    {...props}
    simultaneousGestures={pinchGesture}
    raceGesture={flingGesture}
  />
)

Describe alternatives you've considered
I tried specifying a gesture I created with :

const panRef = useRef<GestureType | undefined>(undefined);

const panGesture = Gesture.Pan().onEnd(({ translationX, translationY }) => {
  console.log('test');
}).withRef(panRef);
    
...

return (
  <Carousel
    {...props}
    panGestureHandlerProps={{
      simultaneousHandlers: panRef,
    }}
  />
)
@ItsMeJules ItsMeJules added the enhancement New feature or request label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants