react-pull-to-refresh: react.js中实现下拉刷新

前端之家收集整理的这篇文章主要介绍了react-pull-to-refresh: react.js中实现下拉刷新前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

最近才发现的插件,感觉不错

安装

npm install react-pull-to-refresh

使用

handleRefresh(resolve,reject) {
  // do some async code here
  if (success) {
    resolve();
  } else {
    reject();
  }
}
<ReactPullToRefresh
  onRefresh={this.handleRefresh}
  className="your-own-class-if-you-want"
  style={{
    textAlign: 'center'
  }}>
  <h3>Pull down to refresh</h3>
  <div>{items}</div>
  <div>etc.</div>
</ReactPullToRefresh>

github

https://github.com/bryaneaton13/react-pull-to-refresh

猜你在找的React相关文章