react-native列表视图下拉刷新上拉加载实现代码

  

本文介绍了react-native列表视图下拉刷新上拉加载实现。分享给大家,具体如下:
  

  

先看效果图

  

 react-native列表视图下拉刷新上拉加载实现代码

  

<强>下拉刷新
  

  

反应本地提供了一个组件可以实现下拉刷新方法RefreshControl

  

使用方法

        & lt;列表视图   refreshControl={   & lt; RefreshControl   刷新={this.state.refreshing}>   呈现(){   const FooterView=this.state。loadMore & # 63;   & lt;视图风格={styles.footer}比;   & lt;文本样式=祝辞加载更多……& lt;/Text>   & lt;/View>:空;   返回& lt;列表视图   refreshControl={   & lt; RefreshControl   刷新={this.state.refreshing}>   _onEndReached () {   this.setState ({   loadMore:没错,   pageNo: this.state。pageNo + 1   });   this._fetchData ();   }   之前      

说明   

视图里还设置了一个参数onEndReachedThreshold这个参数与onEndReached配合使用,它的意思是:像素的临界值,该属性和onEndReached配合使用,因为onEndReached滑动结束的标志是以该值作为判断条件的
  

  

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

react-native列表视图下拉刷新上拉加载实现代码