meliorence / meliorence/react-native-snap-carousel
Can not get the correct current index
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 - replace the space character between the square brackets ([]) by an x.)
- 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?
It wasn't React Native bug
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
I reproduce this issue on iOS 12.12
Is the bug reproductible in a production environment (not a debug one)?
Yes
Environment
Environment:
React: 16.6.3
React native: 0.57.7
react-native-snap-carousel: 3.7.5
Target Platform:
iOS (12.12)
Expected Behavior
Should get the correct current index.
Actual Behavior
Can not get the correct current index when item only leaves one.
Reproducible Demo
https://snack.expo.io/@kwguo/react-native-snap-carousel-currentindex-not-correct
Delete any item, and tap "Show current index", the current index will be wrong.
Steps to Reproduce
- Set loop prop are true.
- Delete item until one is left.
- Get current index from ref, the current index will be wrong.
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 Expo Snack reproducible demo and follow the listed steps with loop enabled, deleting items until one remains. Inspect how the current index is obtained from the carousel ref after the deletion. Done means the reported current index is correct when only one item remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100