question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scrolling on android appears to get stuck between views unless moved slowly

See original GitHub issue

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 ([]).)

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}
          />

https://user-images.githubusercontent.com/83917938/140102710-343fc1d4-5cc4-450a-8041-dd1ebec5324f.mp4

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…

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:28
  • Comments:14

github_iconTop GitHub Comments

73reactions
Isaccobosiocommented, Nov 8, 2021

Hi, as it said in their guide, you should put those props

...
enableMomentum={true}
decelerationRate={0.9}
...

Hope it helps. This is how I fix this problem

7reactions
Bruce-Mingcommented, Jan 27, 2022

yes, react native 0.63.4 is ok,but 0.66.3 is broken it is react native version problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Android Phone scrolling problem-Carlcare
Here are the simple solutions to fix Android phone scrolling problem by yourself! You can try to update system, turn off developer options...
Read more >
Slow rendering - Android Developers
If your app suffers from slow UI rendering, then the system is forced to skip frames and the user will perceive stuttering in...
Read more >
Android RecyclerView Scrolling Performance - Stack Overflow
RecyclerView will attempt to synthesize visible structural change events for adapters that report that they have stable IDs when this method is used....
Read more >
Common bugs in React Native ScrollView and how to fix them
React Native's ScrollView component is ubiquitous, but its implementation can sometimes lead to mistakes. Learn what to look out for here.
Read more >
RecyclerView within NestedScrollView Scrolling Issue - Medium
Solution: The solution for this is we need to use nestedScrollView instead of scrollview like the below code snippet:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found