react-pull-to-refresh-js

0.0.2 • Public • Published

react-pulltorefresh

基于pulltorefreshjs的下拉刷新组件。 如果有问题, 可以提 issue 或者可以直接联系我 8452201776@qq.com ~谢谢。

example

import React from "react";
import ReactDom from "react-dom";
import List from "./components/list";
import ReactPullToRefresh from "../src/index";
 
const defaultData = ["one", "two", "three"];
 
class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data: [...defaultData],
      ptrDisabled: true
    };
  }
 
  componentDidMount() {
    console.log("component mounted");
    setTimeout(() => {
      this.setState({ ptrDisabled: false });
    }, 2000);
  }
 
  onRefresh() {
    console.log("onRefresh called");
  }
 
  render() {
    return (
      <ReactPullToRefresh
        disabled={this.state.ptrDisabled}
        onRefresh={this.onRefresh}
      >
        <h1 style={{ textAlign: "center" }}>Pull down to refresh</h1>
        <List data={this.state.data} />
      </ReactPullToRefresh>
    );
  }
}
 
ReactDom.render(<App />, document.querySelector("#app"));

Package Sidebar

Install

npm i react-pull-to-refresh-js

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

431 kB

Total Files

14

Last publish

Collaborators

  • karis