Open jfeferman opened 6 years ago
Calling playNext() on the slider resolves the issue.
Same issue. It seems that only happens with infinite: true + fade: true. I'm also using it in one of two sliders connected with asNavFor, but I could not reproduce the issue with this code: https://react-slick.neostack.com/docs/example/as-nav-for/ (adding fade to one of them) 🤔 Anyway, I applied the hack suggested by jfeferman to fix it and it works 👍
In my case, adding 1 empty slide into Slider solved the issue.
renderSlide () {
if (this.images.length === 0){
return (
<Slide key="0" />
)
}
return this.images.map((url, index) =>
(
<Slide
key={index}
src={url}
/>
)
)
}
It looks like async fetching data makes this happen.
In my case, adding 1 empty slide into Slider solved the issue.
renderSlide () { if (this.images.length === 0){ return ( <Slide key="0" /> ) } return this.images.map((url, index) => ( <Slide key={index} src={url} /> ) ) }
It looks like async fetching data makes this happen.
This worked....
When the
fade
setting istrue
, the current slide is only set after the time defined inautoplaySpeed
.Here is my configuration:
By inspecting the DOM, I can verify that no slider is set as
slick-current
until the time elapsed in the configuration. Since all sliders haveopacity:0
and no current is selected, the slider does not show any images when loaded.As a quick hack to prevent an empty slider, I force the opacity of the first slide.
This is less than ideal since on load, the first slide displays for twice the time as other slides.
Thanks.