react / react/react-native

Flatlist with initialScrollIndex will cause missing items

未关闭
#54,409 21 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Component: FlatList Needs: Attention Needs: Repro
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

If i have the initialScrollIndex set and the list is not bigger than the view (they all fit) then the items before initialScrollIndex will not render , it only works if i set disableVirtualization={true} but the order on how they are rendered doesnt seem right , for example if i have 8 items (and they all fit in the view) and i have set initialScrollIndex to 6th item with disableVirtualization={true} it will render 6 - 7 item first then the 0 to 5, if i dont disable it then it will only render item 6 and 7, if i have more items than they can fit in the view then it seems to work as expected.

Steps to reproduce

Set initialScrollIndex to any item excluding first one on a list that fits to the view.

React Native Version

0.81.5

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info
expo  54.0.22
Stacktrace or Logs
nothing to show
MANDATORY Reproducer

/

Screenshots and Videos

No response

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先复现所描述的 Android 案例:一个项目能够容纳在视图中的 React Native FlatList,且其 initialScrollIndex 不为零。比较启用和不启用 disableVirtualization 时的渲染结果;当初始索引之前的项目无需禁用虚拟化即可按正确顺序渲染时,即表示完成。

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

评估

技术栈
react-native
领域
mobile
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
需要澄清
新手友好度
45/100

把新 issue 发到你的邮箱

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