ScrollView horizontal scrolling breaks (unable to scroll to end) when using minWidth instead of width: Math.max(minWidth, ...)
未关闭
还没有人认领这个 Issue。
Component: ScrollView
Issue: Author Provided Repro
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
When using minWidth on a horizontally scrolling ScrollView, the scrollable content does not allow scrolling all the way to the end. Replacing minWidth: 500 with a computed width: Math.max(width * 0.9, 500) resolves the issue, making the full content scrollable.
Steps to reproduce
- open the snack reproducer
- run on a device with viewport width < 500 (e.g. Pixel 8)
- try to scroll to the end to observe the last item being cut off
React Native Version
0.78.0
Affected Platforms
Runtime - iOS, Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 15.4.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 222.21 MB / 64.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 23.3.0
path: /usr/local/bin/node
Yarn: Not Found
npm:
version: 10.9.0
path: /usr/local/bin/npm
Watchman:
version: 2025.03.10.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.4
- iOS 18.4
- macOS 15.4
- tvOS 18.4
- visionOS 2.4
- watchOS 11.4
Android SDK:
API Levels:
- "34"
- "35"
Build Tools:
- 32.0.0
- 33.0.0
- 34.0.0
- 35.0.0
System Images:
- android-30 | Google Play Intel x86 Atom
- android-31 | Google APIs Intel x86_64 Atom
- android-33 | Google Play Intel x86_64 Atom
- android-34 | Intel x86_64 Atom
- android-34 | Google APIs Intel x86_64 Atom
- android-34 | Google Play Intel x86_64 Atom
- android-35 | ARM 64 v8a
- android-35 | Intel x86_64 Atom
- android-35 | Google APIs Intel x86_64 Atom
- android-35 | Google Play Intel x86_64 Atom
- android-36 | Pre-Release 16 KB Page Size Google Play Intel x86_64 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2024.3 AI-243.22562.218.2431.13114758
Xcode:
version: 16.3/16E140
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.13
path: /usr/bin/javac
Ruby:
version: 3.3.5
path: /usr/local/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.0.1
wanted: 15.0.1
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.78.0
wanted: 0.78.0
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
No crash/failure
MANDATORY Reproducer
https://snack.expo.dev/@alex_p8/calm-indigo-apples
Screenshots and Videos
Expected behavior (when scrolling to the end):
Actual behavior (when scrolling to the end):
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从必需的 Snack 复现步骤以及针对 Android 和 iOS 描述的 ScrollView 行为开始。比较使用 minWidth: 500 的水平滚动与使用计算宽度的变通方案,并在视口窄于 500 的设备上可以完全访问最后一项时,将 issue 视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100