question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More than 9 items in the data causes the Carousel to re-render all the items indefinitely

See original GitHub issue

Is this a bug report or a feature request?

Bug report

Have you read the guidelines regarding bug report?

Yes.

Have you read the documentation in its entirety?

Yes.

Have you made sure that your issue hasn’t already been reported/solved?

Yes.

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

I only have an iOS device so I am not sure.

Is the bug reproductible in a production environment (not a debug one)?

Yes.

Have you made sure that it wasn’t a React Native bug?

Yes

Have you been able to reproduce the bug in the provided example?

Yes

Environment

Environment: React: 16.2.0 React native: 0.49.0 react-native-snap-carousel: 3.7.0

Target Platform: iOS (8.0)

Steps to Reproduce

  1. Render a carousel with 9 items and console.log when the renderItem function is called.
  2. See that it only renders the items once, as it should.
  3. Then add a 10th item to the data array, and see how the renderItem methods is called indefinitely on every item.
<Carousel
                            data={[{a: '2'}, {a: '44'}, {a: '21'}, {a: '2'}, {a: '33'}, {a: '11'}, {a: '6'}, {a: '77'}, {a: '99'}, {a: '01'}]}
                            renderItem={({item, index}) => {
                                console.log('== RENDER ITEM == ' + index);
                                return <View />
                            }}
                            sliderWidth={Window.width}
                            itemWidth={Window.width}
                        />

Expected Behavior

I thought that I would only see render calls to the items that are visible and the rest would only be called ONCE they are visible.

Actual Behavior

The carousel constantly rerenders the items non stop.

image

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:21 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
UdaraJaycommented, Jul 25, 2018

I had the same issue and at-least in my case it turned out to be the case the issue was the content in the carousel component - the items were re-rendering continuously… which slowed down the carousel and made it very glitchy.

So I’d suggest taking a second look at the content you put in the carousel.

1reaction
sridhardcommented, Jul 24, 2018

This is same as #349 …Please check

Read more comments on GitHub >

github_iconTop Results From Across the Web

than 9 items in the data causes the Carousel to re-render ...
Render a carousel with 9 items and console.log when the renderItem function is called. See that it only renders the items once, as...
Read more >
reactjs - How to prevent Carousel from rerendering
I just simply cannot stop the rerender. Any idea on how to accomplish stoping the rerender or sorting the issue at all? reactjs....
Read more >
React re-renders guide: everything, all at once
Comprehensive guide on React re-renders. The guide explains what are re-renders, what is necessary and unnecessary re-render, ...
Read more >
Image Carousels and Sliders: Why You Shouldn't Use ...
Repeat after me: "Image sliders and carousels kill conversions." Yeah, you might like them. They look pretty. But they'll tank your conversions.
Read more >
archriss
More than 9 items in the data causes the Carousel to re-render all the items indefinitely $ 0. Created 4 years ago in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found