meliorence / meliorence/react-native-snap-carousel
firstItem doesn't work reliably
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?
(Check the step you've followed - put an x character between the square brackets ([]).)
- 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?
It's reproducible on both platforms but has slightly different behaviour on each. On iOS index 14 is shown, on Android, index 6 is shown, when firstItem is 30.
Is the bug reproducible in a production environment (not a debug one)?
Yes
Environment
Here's a snack which reproduces the behaviour: https://snack.expo.io/@thekevinbrown/snap-carousel-first-item-bug
That environment's details:
react-native-snap-carousel: 3.8.0
Expo v33.0.0
Expected Behavior
Expected carousel to load with a green screen focused (slide index 30)
Actual Behavior
Carousel loads with slide index 14 focused or 6 focused depending on platform.
Reproducible Demo
https://snack.expo.io/@thekevinbrown/snap-carousel-first-item-bug
Steps to Reproduce
- Load more than a few pages of any type of slide into snap-carousel
- Set firstItem to a number > 14
- Carousel starts on various indexes which are not the one you passed in as a prop.
Other Notes
I commented with this snack on #496, but I don't think it was noticed, and is likely to be a different issue now that I read that issue more closely, so I figured I'd open a new one. Thanks for your help!
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 the carousel's handling of the firstItem prop, comparing the iOS and Android results for values above 14. Review issue #496 for related context, then verify that setting firstItem to 30 focuses slide 30 consistently on both platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100