meliorence / react-native-snap-carousel

Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.
BSD 3-Clause "New" or "Revised" License
10.25k stars 2.26k forks source link

renderItem is called for entire list in data #697

Open elchicofrommo opened 4 years ago

elchicofrommo commented 4 years ago

Question

Maybe I"m not understanding the documentation. I thought that renderItem would only get called sparingly, but it seems it's getting called for every item in my list which is killing my performance. Is there some way to minimize the render to a local area around the active index?

cretumarius commented 4 years ago

I'm also not able to access the item index, or data length using renderItem. It's always displaying item 1/3 on each slide.

abhatia-lix commented 4 years ago

@elchicofrommo you should set shouldComponent update in your renderItem component and update the only item that you want to update

bd-arc commented 4 years ago

@elchicofrommo Are you using the default setup or a specific layout?

Might want to give version 4.0.0-beta.4 a try.

dohooo commented 2 years ago

Sorry, please allow me to advertise for my open source library! ~ I think this library react-native-reanimated-carousel will solve your problem. It is a high performance and very simple component, complete with React-Native reanimated 2