Skip to content

ScrollView weird behaviour when there are less items #42874

@shreyanshgoel9

Description

@shreyanshgoel9

Description

When the scrollview container is bigger than total item width, on scroll the items start sticking on right on android.
Tested on physical device as well

Screen.Recording.2024-02-05.at.8.20.01.PM.mov

Steps to reproduce

  1. Installed React Native macOs, android simulator

  2. Write this code
    <ScrollView horizontal={true} style={{backgroundColor: 'green'}}> <View style={{ height: 40, width: 50, marginRight: 20, backgroundColor: 'red', }} /> <View style={{ height: 40, width: 50, marginRight: 20, backgroundColor: 'red', }} /> </ScrollView>

  3. Scroll horizontal to reproduce

React Native Version

0.73.3

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.1.2
  CPU: (8) arm64 Apple M1 Pro
  Memory: 87.98 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.12.1
    path: ~/.nvm/versions/node/v18.12.1/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v18.12.1/bin/yarn
  npm:
    version: 8.19.2
    path: ~/.nvm/versions/node/v18.12.1/bin/npm
  Watchman:
    version: 2023.08.14.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.2
    path: /opt/homebrew/opt/ruby/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.2
    path: /opt/homebrew/opt/openjdk/bin/javac
  Ruby:
    version: 3.2.2
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.3
    wanted: 0.73.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

-

Reproducer

snack.expo.dev/@uvrubel/rn-scrollview-horizontal

Screenshots and Videos

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions