Onclick of item in carousel
rogueturnip opened this issue · 1 comments
rogueturnip commented
I have a very simple carousel implementation. I'm having an issue where the items inside all have an o'clock handler to open up an overlay. When I swipe on the carousel if it happens I grab on an item it opens up when the drag stops.
Is there a setting to disable this?
<Carousel
responsive={responsive}
ssr
removeArrowOnDeviceType={["tablet", "mobile"]}
>
{items.map((item) => (
<ItemCard
key={item.id}
title={item.title}
thumbnail={item.thumbnail}
onItemClick={() => onItemClick(item)}
/>
))}
</Carousel>
wormkunr commented
const [isDragging, setIsDragging] = useState(false);
....
// using props like this
afterChange={() => {
setIsDragging(false);
}}
beforeChange={() => {
setIsDragging(true);
}}