react-pull-to-refresh-js
v0.0.2
Published
React component for web pull to refresh
Downloads
1
Maintainers
Readme
react-pulltorefresh
基于pulltorefreshjs的下拉刷新组件。 如果有问题, 可以提 issue 或者可以直接联系我 [email protected] ~谢谢。
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"));