React-id-swiper: Can't set initialSlide for dynamic content

Created on 7 Dec 2017  路  3Comments  路  Source: kidjp85/react-id-swiper

I've might missed something but whatever value I set for initialSlide on Swiper with dynamic content it always start with 0.

const params = {
      initialSlide: 2,
      direction: 'vertical',
      height: 300,
      threshold: 10,
      slidesPerView: 1,
      observer: true,
      shouldSwiperUpdate: true,
      keyboard: true,
    }
....

<Swiper
   {...params}
   ref={node => node ? this.swiper = node.swiper : null}
>
     {
       this.props.children
     }
</Swiper>

But it works well for static number of children 馃槓
What is wrong here?

Most helpful comment

@gareys can you please share code how you are initializing, I am not able to move the slider with activeIndex

All 3 comments

I've always initialized the swiper with an activeIndex of whichever slide I wish to start on. I've always worked with a dynamic number of slides and this has worked for me.

Thanks @gareys! now it works better)

@gareys can you please share code how you are initializing, I am not able to move the slider with activeIndex

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sergiokopplin picture sergiokopplin  路  4Comments

yuschick picture yuschick  路  5Comments

ositaka picture ositaka  路  4Comments

Sallywa picture Sallywa  路  5Comments

Pixel-Daze picture Pixel-Daze  路  4Comments