meliorence / meliorence/react-native-snap-carousel
[BUG] carousel not showing correct first item
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?
Yes, 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?
Yes
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
This is specific to both the platforms
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 (12.0)
iOS (15.5)
Expected Behavior
When using the carousel with enabling loop, and setting loopClonesPerSide to 1, the initial first item shown in expected to be the first item of data.

Actual Behavior
When component renders for the first time it is not showing the first item of the data prop.

Here I am passing exactly 2 item to each carousel. I want to show the first item first and then second item as per the image in the expected behaviour.
I tried setting firstItem to 0, 1, 2 but in all the case it is not working as expected.
Reproducible Demo
Carousel implementation:
<Carousel
ref={carouselRef}
data={carouselItemList}
loop={true}
loopClonesPerSide={1}
enableSnap={true}
renderItem={renderItem}
scrollEnabled={false}
onSnapToItem={handleOnSnapToItem}
/>
Steps to Reproduce
- Implement the carousel as I mentioned above.
- Give it exactly array of 2 items.
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 carousel implementation and reproduce it on Android or iOS using exactly two data items, loop enabled, and loopClonesPerSide set to 1. Trace the initial item selection and verify that the first data item is shown on the first render before the second 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
- Mostly clear
- Newbie friendliness
- 35/100