react / react/react-native

regression: VirtualizedList scrolls infinitely on new item

未关闭
#38,907 0 条评论 13 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Component: VirtualizedList Impact: Regression Issue: Author Provided Repro
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

FlatList is behaving unexpectedly on React Native 0.71 for lists with dynamic height items.
I was able to create a repro pointing to React Native versions:

  • 0.69.8
  • 0.70.13
  • 0.71.12
  • 0.72.3

The issue starts to happen on 0.71, but it still happens on 0.72.
Bug happens both on Android and iOS.
I was not able to find the commit that introduced this bug.

React Native Version

0.72.3

Output of npx react-native info

System:
OS: macOS 13.0.1
CPU: (8) arm64 Apple M1 Pro
Memory: 88.42 MB / 16.00 GB
Shell:
version: 5.8.1
path: /bin/zsh
Binaries:
Node:
version: 18.15.0
path: ~/.nvm/versions/node/v18.15.0/bin/node
Yarn:
version: 1.22.19
path: /opt/homebrew/bin/yarn
npm:
version: 9.5.0
path: ~/.nvm/versions/node/v18.15.0/bin/npm
Watchman:
version: 2023.07.10.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.12.1
path: /Users/diegomello/.rvm/gems/ruby-2.7.7/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.1
- iOS 16.1
- macOS 13.0
- tvOS 16.1
- watchOS 9.1
Android SDK:
API Levels:
- "23"
- "28"
- "30"
- "31"
- "33"
Build Tools:
- 23.0.1
- 23.0.2
- 25.0.0
- 25.0.1
- 25.0.2
- 25.0.3
- 26.0.1
- 26.0.2
- 26.0.3
- 27.0.1
- 27.0.3
- 28.0.3
- 29.0.0
- 29.0.1
- 29.0.2
- 29.0.3
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
System Images:
- android-27 | Google APIs ARM 64 v8a
- android-27 | Google Play Intel x86 Atom
- android-30 | Google Play ARM 64 v8a
- android-30 | Google Play Intel x86 Atom
- android-31 | ARM 64 v8a
- android-31 | Google APIs Intel x86 Atom_64
- android-31 | Google Play ARM 64 v8a
Android NDK: 23.0.7344513-beta4
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9862592
Xcode:
version: 14.1/14B47b
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.18
path: /usr/bin/javac
Ruby:
version: 2.7.7
path: /Users/diegomello/.rvm/rubies/ruby-2.7.7/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.3
wanted: 0.72.3
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: false
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Steps to reproduce

See the video. The repro is very straightforward and it simulates a FlatList with dynamic height items.
It's all about scrolling until the list struggles to render the elements. (It's still stuck scrolling as I type the report)
I found it easier to scroll to around 800~1000 and tap Add item top, but it can be reproduced by just scrolling.

https://github.com/facebook/react-native/assets/804994/05787d61-dccf-4e36-8ee9-94a0c84236bd

(I trimmed the video to fit Github, but it was basically scrolling until it reached 1000 rows)

Snack, screenshot, or link to a repository

https://github.com/diegolmello/ReproListScroll

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 ReproListScroll 仓库开始,复现视频中描述的行为,并比较 React Native 0.70.13 与 0.71 和 0.72。完成的标准是:具有动态高度项目的 FlatList 在顶部附近添加项目后不再无限滚动或卡住。

由索引模型根据 Issue 内容生成。

评估

技术栈
react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。