React-responsive-carousel: autoPlay don't work with my code i use map

Created on 23 May 2020  路  4Comments  路  Source: leandrowd/react-responsive-carousel

<Carousel autoPlay> {slideImages.map((image) => { return ( <div> <img src={image.link} alt="" /> </div> ); })} </Carousel>

wontfix

Most helpful comment

@spk-cpsamut perhaps slideImages is empty on initial render.

I fixed this issue by ensuring Carousel isn't rendered until slides are populated, see the example usage:

<div>
  {(slideImages && slideImages.length > 0) && (
    <Carousel
      {...carouselProps}
    >
      {slideImages.map(item => { return <div>...</div>; })}
    </Carousel>
  )}
</div>

All 4 comments

autoPlay={true}

-I have the same issue

@spk-cpsamut perhaps slideImages is empty on initial render.

I fixed this issue by ensuring Carousel isn't rendered until slides are populated, see the example usage:

<div>
  {(slideImages && slideImages.length > 0) && (
    <Carousel
      {...carouselProps}
    >
      {slideImages.map(item => { return <div>...</div>; })}
    </Carousel>
  )}
</div>

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeopoldLerch picture LeopoldLerch  路  5Comments

adomoshe picture adomoshe  路  5Comments

PatrikKozak picture PatrikKozak  路  3Comments

kartikeyb picture kartikeyb  路  5Comments

anoush-soghomonyan picture anoush-soghomonyan  路  6Comments