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

Swipe event happening for both carousels #605

Open
rajesh-rt opened this issue May 9, 2024 · 1 comment
Open

Swipe event happening for both carousels #605

rajesh-rt opened this issue May 9, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rajesh-rt
Copy link

I'm using 2 carousels, one below the other that need to be scrolled horizontally. But when I swipe card of top carousel the below one is also scrolling.

@rajesh-rt rajesh-rt added the bug Something isn't working label May 9, 2024
Copy link

dosubot bot commented May 9, 2024

To address the issue of both carousels scrolling simultaneously when you swipe on one, ensure each carousel is managed as an independent component. This involves:

  1. Separate State Management: Use distinct instances of the Carousel component for each carousel to maintain separate states. This prevents actions on one carousel from affecting the other.

  2. Isolated Gesture Handlers: Implement gesture handlers like scrollViewGestureOnScrollStart and scrollViewGestureOnScrollEnd for each carousel. This ensures gestures on one carousel do not trigger actions on another.

  3. Unique ref for Each Carousel: Assign a unique ref to each carousel to control them independently, allowing for separate navigation actions (next, prev, scrollTo) without interference.

  4. Dedicated Props: Provide each carousel with its own set of props, including data arrays and configurations (loop, autoplay), to manage their behavior individually.

  5. GestureHandlerRootView: Ensure the Carousel component is correctly wrapped in a GestureHandlerRootView to handle gestures properly in React Native. Avoid nesting these views in a way that could affect gesture recognition.

By following these steps, you can achieve independent scrolling for each carousel, ensuring that swiping on one does not affect the other.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants