react-native - 到达 ListFooterComponent 末尾时调用 React Native FlatList onEndReached
问题描述
我正在使用 aFlatList
来显示无限滚动的项目列表。onEndReached
使用道具到达列表末尾时会加载更多数据。但是,列表下方是更多使用ListFooterComponent
. 这会导致onEndReached
在到达页脚末尾时调用,而不是实际列表的末尾。可以稍微配置一下,onEndReachedThreshold
但页脚的高度可能会定期变化,所以这不是一个好的解决方案。
<FlatList
data={[0, 1, 2, 3, 4, 5, 6, 7, 8]}
renderItem={() => (
<View style={{ backgroundColor: "#f00", height: 300 }} />
)}
ListFooterComponent={
<View style={{ backgroundColor: "#0f0", height: 3000 }} />
}
onEndReached={() => console.log("will be called when end of ListFooterComponent is reached")}
/>
这是一个错误还是应该这样工作?有人有解决方法的想法吗?
解决方案
推荐阅读
- c++-cli - GCHandles 数组
- javascript - React 组件的状态,响应中数组中对象的错误顺序
- java - 如何使用 VSCODE 将 YML 文件添加到我的项目中?
- java-time - Java 时间是否正确处理密歇根的时区/夏令时历史?
- python - 嵌套循环以删除列表中的项目
- c# - 在 SkiaSharp 中重新映射任意灰度颜色
- django - localhost 未从 pgadmin 表中获取数据
- haxe - 如何从宏/评估中获取“haxe.exe”的路径?
- sql - 如何在 SQL 中修改/重命名数据库名称?
- scala - 为什么 spark 总是尝试连接到 localhost:9042?