Closed TheMikeyRoss closed 8 months ago
After some additional research I noticed from here I should just pass the plugins as a prop .
So I did it like this
const classNamesOptions = { dragging: "", draggable: "" };
const [emblaRef, emblaApi] = useEmblaCarousel(
{ loop: false, dragFree: true },
[ClassNames(classNamesOptions)]
);
and it seems that the dragging is still enabled. My goal here is to disable dragging altogether
Here's a codesandbox with a reproducible issue https://codesandbox.io/s/embla-carousel-github-issue-622-forked-ww6s5j?file=/src/js/EmblaCarousel.js
Hi @TheMikeyRoss,
Thanks for your bug report. This is not a bug. I’m not sure where you got the initial way of adding plugins from because there’s no example anywhere suggesting that.
Here’s the official way of adding plugins in the docs. Just switch to the React tab if you’re using React.
And it seems that the dragging is still enabled. My goal here is to disable dragging altogether
I would suggest you to search the docs first when you want to achieve something:
Following that search suggestion, disabling dragging entirely is done by setting the watchDrag option to false like so watchDrag: false
.
Best, David
Thanks @davidjerleke
Bug is related to
Embla Carousel version
Describe the bug
It seems that using plugins doesn't when when using the
useEmblaCarousel
hookSteps to reproduce
embla-carousel-react
andembla-carousel-class-names
useEmblaCarousel
hook andClassNames
useEmblaCarousel
hook and try to add the plugins argumentif you're using Typescript you'll see this warning:![image](https://github.com/davidjerleke/embla-carousel/assets/97709651/dc1d4ab6-aeb2-46af-806e-a73611adeb56)
Expected behavior
The classname should be applied, in my case the draggable should be disabled since I passed an empty string to it.