meliorence / meliorence/react-native-snap-carousel
Scrolling on android appears to get stuck between views unless moved slowly
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?
Android
Is the bug reproductible in a production environment (not a debug one)?
I have confirmed this by building the android app with NODE_ENV=production in my env file, yes.
Environment
Environment:
React: 17.0.1
React native: 0.64.2
react-native-snap-carousel: 3.9.1
Target Platform:
Android (12.5.3)
Expected Behavior
Swiping between views on Android should snap to the next view when released.
Actual Behavior
If I swipe with some (pretty normal) momentum, the carousel will get stuck between 2 pages, and not call the onSnapToItem method.
If I swipe slowly and release about halfway, it perfectly snaps perfectly to the next page.
I am aware of the performance issues on android and have tried many props/settings and fixes found in various places on the internet and in the issues here, apologies if I've missed something very common.
Reproducible Demo
(Paste the link to a Snack example in which the issue can be reproduced. Please follow the guidelines for providing a Minimal, Complete, and Verifiable example.)
Steps to Reproduce
These are the current settings after all my efforts.
<Carousel
scrollEnabled={calendarState === CalendarState.Open}
firstItem={prevMonths}
data={monthData}
sliderWidth={calendarWidth}
itemWidth={calendarWidth}
inactiveSlideOpacity={0.5}
inactiveSlideScale={0.8}
inactiveSlideShift={0}
removeClippedSubviews={false}
lockScrollWhileSnapping={isAndroid}
enableMomentum={false}
disableIntervalMomentum
enableSnap
onSnapToItem={onMonthChanged}
renderItem={renderItem}
/>
I am using the carousel to create a calendar, each page is a "month" containing rows of weeks, containing 7 days, there is a lot of elements here when you consider we have potentially 42 "days" per month/page and in my case, up to 7 months at a time....
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
No source file or test is named. Start by reproducing the Android swipe behavior with the provided Carousel settings and video, then trace the carousel's snapping and momentum handling; done means a normal swipe consistently snaps to one view and calls onSnapToItem.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript, react-native
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100