React-native-snap-carousel: Lazy loading

Created on 7 Sep 2017  路  2Comments  路  Source: meliorence/react-native-snap-carousel

Hi, at first good job with this package, it definitely simplifies the usage of a carousel without having to directly handle FlatList.

I have a question regarding the lazy loading of the items, does this package renders all the steps on the first render? or only when needed?

Thanks!

Most helpful comment

To implement lazy loading, I found this answer on SO.
And it works for me to render image lazily by adding both windowSize and initialNumToRender into props.

<Carousel
  data={data}
  initialNumToRender={3}
  windowSize={3}
  renderItem={this.renderItem}
  sliderWidth={window.width}
  itemWidth={window.width * 0.79}
/>

All 2 comments

Hey @asantos00, the package is build on top of a FlatList, with a windowSize, so the answer is no. It doesn't render them all at first.

To implement lazy loading, I found this answer on SO.
And it works for me to render image lazily by adding both windowSize and initialNumToRender into props.

<Carousel
  data={data}
  initialNumToRender={3}
  windowSize={3}
  renderItem={this.renderItem}
  sliderWidth={window.width}
  itemWidth={window.width * 0.79}
/>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

siderakis picture siderakis  路  3Comments

SnowDang picture SnowDang  路  4Comments

niloufarMakhzani picture niloufarMakhzani  路  4Comments

naffiq picture naffiq  路  5Comments

krisidmisso picture krisidmisso  路  4Comments