npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-listview-refresh

v0.6.2

Published

A list component that can be pulled up & down to refresh, based on FlatList

Downloads

28

Readme

react-native-listview-refresh

一个基于FlatList的列表下拉、上拉刷新控件。代码一共100多行,尽量写得简单易懂,方便各位根据自己的需求随意修改。 如果有bug或建议,欢迎提issue。

安装

Yarn

$ yarn add react-native-listview-refresh

手动安装

下载源码,将RefreshListView.js拖入工程中

运行Demo

第一步

进入Example目录,执行:

yarn install

第二步

react-native run-ios

Example


constructor(props) {
  super(props)

  this.state = {
    refreshState: RefreshState.Idle,
  }
}

render() {
  return (
    <RefreshListView
      data={this.state.dataList}
      keyExtractor={this.keyExtractor}
      renderItem={this.renderCell}

      refreshState={this.state.refreshState}
      onHeaderRefresh={this.onHeaderRefresh}
      onFooterRefresh={this.onFooterRefresh}
    />
  )
}

// 开始下拉刷新
this.setState({refreshState: RefreshState.HeaderRefreshing})

// 开始上拉翻页
this.setState({refreshState: RefreshState.FooterRefreshing})

// 加载成功
this.setState({refreshState: RefreshState.Idle})

// 加载失败
this.setState({refreshState: RefreshState.Failure})

// 加载全部数据
this.setState({refreshState: RefreshState.NoMoreData})

// 服务器没有数据
this.setState({refreshState: RefreshState.EmptyData})

Props

| Prop | Type | Description | Default | | :- | :- | :- | :- | | refreshState | number | 列表刷新状态:1、Idle(普通状态)2、HeaderRefreshing(头部菊花转圈圈中)3、FooterRefreshing(底部菊花转圈圈中)4、NoMoreData(已加载全部数据)5、Failure(加载失败) | None | | onHeaderRefresh | (refreshState: number) => void | 下拉刷新回调方法refreshState参数值为RefreshState.HeaderRefreshing | None | | onFooterRefresh | (refreshState: number) => void | 上拉翻页回调方法refreshState参数值为RefreshState.FooterRefreshing | None | | data | Array | 同FlatList中的data属性 | None | | footerRefreshingText | ?string | 自定义底部刷新中文字 | '数据加载中…' | | footerFailureText | ?string | 自定义底部失败文字 | '点击重新加载' | | footerNoMoreDataText | ?string | 自定义底部已加载全部数据文字 | '已加载全部数据' | | footerEmptyDataText | ?string | 自定义空数据文字 | '暂时没有相关数据' | | footerRefreshingComponent | ?any | 自定义底部刷新控件 | null | | footerFailureComponent | ?any | 自定义底部失败控件 | null | | footerNoMoreDataComponent | ?any | 自定义底部已加载全部数据控件 | null | | footerEmptyDataComponent | ?any | 自定义空数据控件 | null |