ScrollView with centerContent={true} is not working properly
未关闭
还没有人认领这个 Issue。
Component: ScrollView
Issue: Author Provided Repro
Resolution: PR Submitted
Type: New Architecture
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
- On ScreenViewScreen1, the contentCenter={true} property
- On ScreenViewScreen2, the contentCenter={false} property
- On ScreenViewScreen2, the content remains centered during ternary screen swapping
Testing was performed on 3 versions of React Native:
- 0.79.1
- 0.78.2
- 0.77.2
Detailed problem result in README.md in the repository.
Steps to reproduce
- In the repository go to the desired version of React Native
- Install dependencies and run the project following the instructions in README.md of the project
- Try to change the parameters in src/App.tsx
React Native Version
0.79.1
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
System:
OS: macOS 15.4.1
CPU: (8) arm64 Apple M1 Pro
Memory: 117.52 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.14.0
path: ~/.nvm/versions/node/v22.14.0/bin/node
Yarn: Not Found
npm:
version: 11.2.0
path: ~/.nvm/versions/node/v22.14.0/bin/npm
Watchman:
version: 2025.04.07.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.4
- iOS 18.4
- macOS 15.4
- tvOS 18.4
- visionOS 2.4
- watchOS 11.4
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23726.103.2422.13103373
Xcode:
version: 16.3/16E140
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.14
path: /usr/bin/javac
Ruby:
version: 2.7.8
path: /Users/alex/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: 18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.1
wanted: 0.79.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
-
Reproducer
https://github.com/astrahov/React-Native-ScrollView-contentCenter-bug
Screenshots and Videos
https://github.com/user-attachments/assets/1b08fd74-2f07-4d64-a795-8a3fc0a2f7fd
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 reproducer 开始,按照其 README.md 中的设置说明操作,并检查 src/App.tsx。在列出的 React Native 版本中比较 centerContent={true} 和 centerContent={false} 两种情况,包括三元屏幕切换;当观察到的 iOS ScrollView 行为与预期设置一致时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react-native, typescript
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 30/100