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 🙏

© 2026 – Pkg Stats / Ryan Hefner

milkui-pullrefresh

v0.1.0

Published

milk ui component for build mobile web app

Readme

milkui-pullrefresh

下拉/上拉刷新

Overview

image

Example

import PullRefresh from 'milkui-pullrefresh';

<PullRefresh
  ref={(f) => { this.pullRefresh = f; }}
  topLoad
  onTopLoad={this.events.loadTopData}
  distanceIndex={3}
  bottomLoad
  onBottomLoad={this.events.loadBottomData}
>
  <div className="demo__pullrefresh__list">
    {list.map((item) =>
      <div key={item} className="demo__pullrefresh__item">{item}</div>
    )}
  </div>
</PullRefresh>

// mock loadTopData
loadTopData() {
  const me = this;
  const { list } = me.state;
  let newList = Array.from(list);
  const firstItem = newList[0];
  for (let i = 1; i < 11; i++) {
    newList = [firstItem - i, ...newList];
  }
  setTimeout(() => {
    me.setState({ list: newList }, () => {
      me.pullRefresh.onTopLoaded();
    });
  }, 2000);
}

// mock loadBottomData
loadBottomData() {
  const me = this;
  const { list } = me.state;
  let newList = Array.from(list);
  const lastItem = newList[newList.length - 1];
  for (let i = 1; i < 11; i++) {
    newList = [...newList, lastItem + i];
  }
  setTimeout(() => {
    me.setState({ list: newList }, () => {
      me.pullRefresh.onBottomLoaded();
    });
  }, 2000);
}

Properties

| Property | Type | Description | Default | | -- | -- | -- | -- | | className | String | 自定义的 class 类名 | '' | | topPullText | String | 顶部下拉时的文字提示 | '↓ 下拉' | | topDropText | String | 顶部下拉后可以刷新时的文字提示 | '↑ 释放' | | topLoadingText | String | 顶部下拉更新时的文字提示 | 'loading...' | | bottomPullText | String | 底部上拉时的文字提示 | '↑ 上拉' | | bottomDropText | String | 底部上拉后可以刷新时的文字提示 | '↓ 释放' | | bottomLoadingText | String | 底部上拉更新时的文字提示 | 'loading...' | | distanceIndex | Number | 手指移动与组件移动距离的比值 | 2 | | topLoadDistance | Number | 顶部下拉更新的阈值 | 70 | | bottomLoadDistance | Number | 底部下拉更新的阈值 | 70 | | topLoad | Boolean | 顶部下拉更新 | false | | bottomLoad | Boolean | 底部下拉更新 | false | | onTopLoad | Function | 顶部下拉更新时的回调函数 | | | onBottomLoad | Function | 底部下拉更新时的回调函数 | |

Develop

cnpm i milk-dev -g    # dev tool

cnpm install

npm start

Links