SectionList's `onScrollToIndexFailed` does not catch requested sectionIndex & itemIndex
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
onScrollToIndexFailed returns index,heighestMeasuredIndex, and averageItemHeight, which is enough in FlatList.
but in sectionList it should return requested sectionIndex and itemIndex, and heighestMeasured section & item index in addition to flat index, because we have only scrollToLocation method available for sectionList and section and item index params are needed.
Steps to reproduce
run the snack, press on scroll to no where, you will see the alert
React Native Version
0.76.3
Affected Platforms
Runtime - Android, Runtime - iOS, Runtime - Web, Runtime - Desktop, Build - MacOS, Build - Windows, Build - Linux
Output of npx react-native info
System:
OS: Windows 11 10.0.22000
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 8.47 GB / 15.89 GB
Binaries:
Node:
version: 23.0.0
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.0
path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm:
version: 10.9.0
path: C:\Program Files\nodejs\npm.CMD
Watchman:
version: 20241027.093345.0
path: E:\Software\Watchman\bin\watchman.EXE
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Disabled
IDEs:
Android Studio: Not Found
Visual Studio: Not Found
Languages:
Java:
version: 21.0.3
path: /c/Program Files/Eclipse Adoptium/jdk-21.0.3.9-hotspot/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.2
wanted: 0.76.2
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
scroll to index failed
Reproducer
https://snack.expo.dev/@arasrezaie/sectionlist-example
Screenshots and Videos
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 Expo Snack 开始,使用 onScrollToIndexFailed 重现 SectionList 滚动失败的问题。跟踪 SectionList 的回调契约及其 scrollToLocation 输入,然后验证失败结果除了包含扁平索引、高度和平均项目高度之外,还包含请求的分区和项目索引,以及已测量的最高分区和项目索引。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react-native
- 领域
- mobile
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100