akiran / react-slick

React carousel component
http://react-slick.neostack.com/
MIT License
11.62k stars 2.09k forks source link

WaitForAnimate: Animates opposite way #2353

Open TomLien opened 4 months ago

TomLien commented 4 months ago

Hello!

When setting waitForAnimate to false the slider slides the opposite way when navigating through the first or last index before the animation has finished.

Issue can be replicated here: https://codesandbox.io/p/sandbox/react-slick-playground-forked-q362j4?file=%2Findex.js%3A19%2C31 https://codesandbox.io/p/sandbox/react-slick-carousel-forked-pfz8h8?file=%2Fsrc%2FApp.js%3A12%2C23

Replication steps: Stand on first index Press previous arrow once Press previous arrow a second time before animation has ended

Same behaviour other way around: Stand on last index Press next arrow once Press next arrow a second time before animation has ended

Both these scenarios will result in the slider sliding the opposite way.

nguyendang197 commented 2 months ago

This behaviour also happens in the original slick-carousel when waitForAnimate is true. You can take a look at the answer of this question: https://stackoverflow.com/questions/65601881/unable-to-set-waitforanimate-to-true-for-slick-js-carousel

I did check and it seemed that fixing this would require a new rendering logic for the carousel and also affect other features.