Best way to wrap carousel in a touchable?
See original GitHub issueIs this a bug report, a feature request, or a question?
Question
I want my entire carousel to be touchable, while at the same letting users go through photos. I basically have a view with a carousel and a card in it, and I want that entire thing to be touchable.
so the code looks like
<TouchableOpacity>
<View>
<Carousel />
<Card />
</View>
</TouchableOpacity>
As soon as a touchable* is added, panning stops working on the carousel. If I swipe really fast the items are gone through, but otherwise the carousel is unresponsive.
Things I’ve tried:
- Setting
onMoveShouldSetResponder={ () => false }
on my TouchableOpacity - Setting
onMoveShouldSetResponder={() => true}
on the carousel - Setting
onStartShouldSetResponder={() => true}
on the carousel
Aside from completely ditching TouchableOpacity and setting up my own gesture detection using PanResponder, is there anything else I can do?
Thanks in advance for any help!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Best way to wrap carousel in a touchable? · Issue #423 - GitHub
I want my entire carousel to be touchable, while at the same letting users go through photos. I basically have a view with...
Read more >Creating responsive, touch-friendly carousels with Flickity
Scrolling through a carousel is less satisfying and more awkward that simply scrolling down a page. Basically, you can't flick through them.
Read more >Build a Touch Slider with HTML, CSS & JavaScript - YouTube
Build a full screen touch slider with HTML, CSS & JavaScriptFull Screen Touch ... How to OVER Engineer a Website // What is...
Read more >Creating an Accessible Image Carousel
Our carousel is looking much better! We can scroll the container horizontally either with pointer events (mouse/touch) or by tabbing to the ...
Read more >Carousel · Bootstrap v5.1
Disable touch swiping. Carousels support swiping left/right on touchscreen devices to move between slides. This can be disabled using the data-bs-touch ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is what I’ve found is working for me:
Basically you propagate the parent touchable onPress to the child and give it priority so it can be swiped as well
Sorry, please allow me to advertise for my open source library! ~ I think this library react-native-reanimated-carousel will solve your problem. It is a high performance and very simple component, complete with React-Native reanimated 2