meliorence / meliorence/react-native-snap-carousel
renderItem per item is called 3 times on 1 Carousel render
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, a feature request, or a question?
Bug report
Have you followed the required steps before opening a bug report?
- I have read the guidelines regarding bug report.
- I have reviewed the documentation in its entirety, including the dedicated documentations 📚.
- I have searched for existing issues and made sure that the problem hasn't already been reported.
- I am using the latest plugin version.
- I am following the issue template closely in order to produce a useful bug report.
Have you made sure that it wasn't a React Native bug?
Not react native bug.
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
Not specific to any platform.
Is the bug reproductible in a production environment (not a debug one)?
Yes.
Environment
Environment:
React: 16.13.1
React native: 0.63.2
react-native-snap-carousel: 3.9.1
Target Platform:
Android (latest)
iOS (14.3)
Expected Behavior
On 1 Carousel render I expect each item to render once for improved performance.
Actual Behavior
- Carousel rendered once.
- Each initial item rendered once.
interpolatorsin state changed.- Each initial item rerendered 2nd time.
hideCarouselin state changed.- Each initial item rerendered 3rd time.
Comparing to regular Flatlist which caused CPU to go to 110%, with Carousel because of 3 rerenders it went to 270%.
Performance wise it is very problematic.
Reproducible Demo
https://snack.expo.io/@bolts/courageous-coffee
Steps to Reproduce
- On initial 1 render each
render itemconsole log is called 3 times
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 linked Snack reproduction and trace the Carousel's initial render along with the interpolators and hideCarousel state changes described in the report. Confirm the three render calls, then verify that each initial item renders once without regressing the reported Android and iOS behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- frontend, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100