跳到主要内容

ViewToken 对象类型

ViewToken object is returned as one of the properties in the onViewableItemsChanged callback (for example, in the FlatList component). It is exported by ViewabilityHelper.js.

示例​

JavaScript
{
item: {key: "key-12"},
key: "key-12",
index: 11,
isViewable: true
}

键和值​

index​

分配给数据元素的唯一数字标识符。

当可视元素不是数据数组中的数据项时,此属性可能为 null,例如 SectionList 的分区标题或分区页脚进入可视区域时。

类型可选
number是

isViewable​

指定列表元素的至少一部分是否在视口中可见。

类型可选
boolean否

item​

项目数据

类型可选
any否

key​

分配给数据元素并提取到顶层的键标识符。

类型可选
string否

section​

与 SectionList 一起使用时的项目分区数据。

类型可选
any是

使用它的组件​