[英]React native flatlist pull from bottom functionality
I know how to implement a "pull to refresh" from the top of the list functionality using the onRefresh
prop,is there a way to do something similar for the bottom end of the list,so when i "pull" from the bottom would trigger a function?我知道如何使用onRefresh
道具从列表顶部实现“拉动刷新”功能,有没有办法对列表的底端做类似的事情,所以当我从底部“拉动”时会触发function?
The onEndReached
prop does'nt really work as i would like,since it runs a function everytime you reach the end of the list,i dont want that,i want nothing to run unless i "pull" from the bottom. onEndReached
道具并没有像我希望的那样真正工作,因为每次你到达列表末尾时它都会运行 function,我不想要那个,我不想运行任何东西,除非我从底部“拉”出来。
I tried to invert the flatlist using the invert
prop,which makes use of the onRefresh
prop when pulling from the bottom(its upside down),and it works perfectly,but i want to have them both.我尝试使用invert
道具反转平面列表,它在从底部拉动时使用了onRefresh
道具(颠倒),并且效果很好,但我想同时拥有它们。
Any ideas?有任何想法吗?
Found it,i just added a negative value to onEndReachedThreshold
prop,so onEndReachedThreshold={-0.5}
will run the onEndReached
function when "pulling" to as much as half of the flatlist height.找到它,我只是在onEndReachedThreshold
道具上添加了一个负值,所以onEndReachedThreshold={-0.5}
将在“拉”到 flatlist 高度的一半时运行onEndReached
function。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.