在本机反应中创建双向重复/循环无限滚动视图 [英] Create a bidirectional repeating/looping infinite scrollView in react native
问题描述
我想创建一个不断重复的滚动条,即当我一直滚动到顶部时,我会到达最后一行,而当我滚动到底部时,我会再次到达第一行.
I want to create a scroll that repeats itself, again and again, i.e. when I keep scrolling to the top I reach the last row and when I scroll to the bottom I reach the first row again.
我尝试搜索相同的组件,但我能找到的最好的是这些 -
I have tried searching components for the same, but the best I could find were these -
react-native-infinite-scroll 和 this stackoverflow answer 但它们都只告诉我如何在到达 ScrollView 或 ListView 时加载更多数据结束.
react-native-infinite-scroll and this stackoverflow answer but both of them only tell about how can I load more data when I reach the ScrollView or ListView end.
推荐答案
我搜索了很多这种类型的组件,但没有找到,所以我使用 FlatList 从头开始创建了自己的组件,还有 发布到 npm,所以任何人都可以使用
I searched a lot for this type component but couldn't find any, so I created my own component from scratch using FlatList, and also published it to npm, so anyone can install it using
npm install react-native-infinite-looping-scroll
在您的 React Native 项目目录中.
in your react native project directory.
该组件仍处于测试阶段,因此不要期望它的性能非常好.但是该组件仍然非常基础,并且还有很大的改进空间,因此任何想要为其做出贡献的人都可以提交 PR 此处.
The component is still in beta so don't expect very good performance from it. But the component is still pretty basic and there's a lot of scope for improvement so anyone who wants to contribute to it can submit a PR here.
这篇关于在本机反应中创建双向重复/循环无限滚动视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!