With the latest version of React-Slick, 0.14.6, if we update a Carousel's autoplay property to false the carousel does one more slide before stopping autoplay. Then, if we update the autoplay property again to true the slider's autoplay functionality no longer works.
pause button. Wait at least an additional 2000ms, and observe that the carousel does one more slide before stopping. play button and observe that the carousel's autoplay doesn't start up again. This bug was introduced in https://github.com/akiran/react-slick/pull/526, when autoplay was changed from setInterval to setTimeout.
I forked the library and fixed this bug. I will submit a PR and reference this issue.
Merged #651
@akiran , can we publish the latest release to npm package? We need this fix of autocycle in our code. Thank you!
Still doesn't work.
@akiran
It doesn't work even in 0.25.2
quick hack:
componentDidUpdate(prevProps, prevState) {
if (!prevState.isAutoplayOn && this.state.isAutoplayOn) {
this.slider.slickPlay()
}
}
setSliderRef = (c) => {
this.slider = c
}
<Slider
ref={this.setSliderRef}
...
idea from https://github.com/akiran/react-slick/pull/651#issuecomment-304287662
Most helpful comment
Still doesn't work.