meliorence / meliorence/react-native-snap-carousel
More than 9 items in the data causes the Carousel to re-render all the items indefinitely
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
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
- Render a carousel with 9 items and console.log when the renderItem function is called.
- See that it only renders the items once, as it should.
- 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.

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided example and reproduce the behavior by comparing a carousel with nine items to one with ten, using the shown renderItem logging. Trace the carousel's rendering behavior during that reproduction; done means adding the tenth item no longer causes continuous rerendering of every item.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100