-
Notifications
You must be signed in to change notification settings - Fork 721
Closed
Description
My use case needs an ability to set duration of the slide different for each i.e.
const images = [
{
original: "https://picsum.photos/id/1018/1000/600/",
thumbnail: "https://picsum.photos/id/1018/250/150/",
duration: 1000
},
{
original: "https://picsum.photos/id/1015/1000/600/",
thumbnail: "https://picsum.photos/id/1015/250/150/",
duration: 5000
}
]
So I tried setting the slideInterval prop dynamically in the onBeforeSlide prop callback like this using the slideInterval state variable
<ImageGallery
items={images}
slideInterval={slideInterval}
autoPlay={true}
onBeforeSlide={(nextIndex) => setSlideInterval(images[nextIndex].duration)}
/>
This does not apply the newly set slideInterval