FormidableLabs / nuka-carousel

Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
https://commerce.nearform.com/open-source/nuka-carousel
Other
3.08k stars 595 forks source link

dragging:false is not working #106

Closed maheshambiga closed 7 years ago

maheshambiga commented 8 years ago

Passing prop {dragging:false} is not preventing dragging of slides on swipe.

aij commented 8 years ago

It works for me.

How are you passing the prop? Note that if you pass anything other than the boolean value false, it will be treated as true, including "false", null, and undefined. Can you use React devtools to make sure it's getting passed through as you expect?

mikestopcontinues commented 8 years ago

Actually, the problem is that onTouchMove doesn't check to see if dragging is enabled.

aij commented 8 years ago

Oh, I see. It does disable mouse swipe/dragging, but doesn't disable touch swipe/dragging.

kenwheeler commented 8 years ago

So does everyone think there should be a swiping prop to disable swiping?

mikestopcontinues commented 8 years ago

I think so. My use case was that users could only move in one direction, and only through button click. I was using it like a sales squeeze page. So it would have been great to be able to turn swipe off.

Mike

On Thu, Jul 7, 2016 at 10:44 AM, Ken Wheeler notifications@github.com wrote:

So does everyone think there should be a swiping prop to disable swiping?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kenwheeler/nuka-carousel/issues/106#issuecomment-231099351, or mute the thread https://github.com/notifications/unsubscribe/AAJLoilajMU7hquGuG5BpI1iLhEG6aUsks5qTRDQgaJpZM4I7jh1 .

maheshambiga commented 8 years ago

Here, {dragging:false} should disable touchMove as well. It does not make any sense have a separate prop to restrict swipe. Dragging is nothing but mouse drag as well as touchMove.

haxtrujillo commented 8 years ago

https://github.com/FormidableLabs/nuka-carousel/blob/master/lib/carousel.js#L221 adding if (this.props.dragging === false) { return null; } in /lib/carousel.js line 221 will work. I hope to see a solution on the next release.

warmhug commented 7 years ago

There should be a swiping prop to disable swiping. +1