Closed EngrTactics closed 1 year ago
Rather than setting slideIndex
to start from your first slide, how about rearranging the order of the slides themselves so your first slide appears in the slide(n-1) position? So if you have slides 1,2,3,4, you rearrange them to 2,3,4,1.
In code: If your original render logic looks like:
{slides.map(slide => /* ... render individual slides ... */)}
you could do this:
{[...slides.slice(1), slides[0]].map(slide => /* ... render individual slides ... */)}
Okay! but even after that, the carousel autoplay only once.
Add the wrapAround
prop to make it loop indefinitely.
Works now! Thanks a lot!
Bugs and Questions
Prerequisites
Describe Your Environment
Describe the Problem
Carousel doesn't autoplay when autoplayReverse is true and slideIndex={0}
Expected behavior:
I expect the carousels to autoplay from slide(0) to slide(n) and reverse either by starting from slide(0) again or by sliding back to slide(n-1) n=number of elements in the carousel.
Actual behavior
It works if autoplayreverse is not set to true and the slide index is not set but it sets the slide index to (n) by default
Additional Information