react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Quickly scrolling to the top of ScrollViews on Android 14 can result in negative offsets

Open LegendEffects opened this issue 2 years ago • 7 comments

Description

On Android 14, quickly scrolling to the top of a ScrollView can result in a negative offset. See snack and attached video.

This bug is still present without the code to display the offset.

https://github.com/facebook/react-native/assets/25408153/2815525e-7bbe-46a1-8b16-ae6f28c74318

React Native Version

0.72.6

Output of npx react-native info

System:
  OS: macOS 14.0
  CPU: (8) arm64 Apple M1
  Memory: 271.27 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.5.1
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.8.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2023.08.14.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK:
    API Levels:
      - "26"
      - "30"
      - "31"
      - "33"
    Build Tools:
      - 29.0.2
      - 29.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 34.0.0
    System Images:
      - android-26 | Google APIs ARM 64 v8a
      - android-27 | Google APIs ARM 64 v8a
      - android-28 | Google APIs ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

  1. Create a scroll view with enough content for it to scroll
  2. Scroll down a bit and then scroll quickly to the top

Snack, screenshot, or link to a repository

https://snack.expo.dev/@evanb/android-scroll-view-bug

https://github.com/facebook/react-native/assets/25408153/2815525e-7bbe-46a1-8b16-ae6f28c74318

LegendEffects avatar Oct 17 '23 15:10 LegendEffects

Hello, is there anything that can be done to get this moving? I noticed that this issue hasn't been marked as having a repro despite the expo snack, is it invalid or something?

LegendEffects avatar Oct 27 '23 09:10 LegendEffects

Seems to be an issue with the overscroll effect in Android 14. https://issuetracker.google.com/issues/286422637

I reproduced it in an Android app without React Native.

DevMassive avatar Nov 02 '23 03:11 DevMassive

Seems to be an issue with the overscroll effect in Android 14. https://issuetracker.google.com/issues/286422637

I reproduced it in an Android app without React Native.

Can confirm that this seems to be an issue with Android itself, I managed to find it present in the Fitbit app which I doubt is made in React Native. Concerning that the linked issue was submitted during the beta phase and is marked as fixed when it's present in the production build.

I'll leave this open unless someone else closes it, just for people currently finding this issue.

LegendEffects avatar Nov 02 '23 13:11 LegendEffects

google pixel 7 pro with android version 14 still have this bug.

"react-native": "0.72.4"

krmao avatar Nov 07 '23 11:11 krmao

I have same problem. I noticed this happens on IOS and Android 12. It's as if VirtualizedList/ScrollView/FlatList tries to correct the initial position when I scroll to the top.

cyberkaidev avatar Jan 04 '24 02:01 cyberkaidev

two more reports:

  1. mine just now, here on github https://github.com/facebook/react-native/issues/43736.
  2. on stackoverflow back in november.

robinplace avatar Apr 01 '24 07:04 robinplace

another reproducer is also here https://github.com/facebook/react-native/issues/43736#issue-2217674960

cortinico avatar Apr 02 '24 08:04 cortinico