akiran / react-slick

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

slickPlay & slickPause not working #1209

Open intositeme opened 6 years ago

intositeme commented 6 years ago

https://codesandbox.io/s/v8rxn7qwp7

The slickPlay & slickPause does not seem to be working. Used the example codes from https://react-slick.neostack.com/docs/example/auto-play-methods

xlasserre commented 6 years ago

I'm experiencing the same behavior. Cannot pause the autoplay.

trivopr commented 6 years ago

I have the same issue, can not pause when autoplay

patmellon commented 6 years ago

I'm dealing with the same issue, but I found a potential solution:

play() {
  this.slider.innerSlider.autoPlay("play");
}
pause() {
  this.slider.innerSlider.pause("paused");
  this.slider.innerSlider.autoPlay("hovered"); 
// The above autoPlay function probably isn't necessary if you're using onClick events, 
// and it will only work if you keep the default prop pauseOnHover set to true.
}

Use the above functions in place of the ones from the docs example.

denishrana09 commented 5 years ago

try this:

setTimeout(() => {
        this.pause();
});

so that, after slider initialized, this will be called.