One mobile pull to refresh React component for all. Plug and play, highly customizable with many loaders provided!
With NPM
npm i react-ptr --save-dev
Import to your app
import { PullToRefresh, Loaders } from 'react-ptr';
import 'react-ptr/style.min.css';
Use with react
const App = () => (
<PullToRefresh loaders={Loaders.Material}>
<p> Your content here ... </p>
</PullToRefresh>
)
-
height : string
height for the container, use string like '10px', default for '100%' -
onRefresh : func
callback when refresh is request, pass resolve function as first parameters, default 2000ms auto resolve -
loader : shape
(optional) loader configuration shape consists of following properties-
mode : string
(optional) the method to display the loader container, chocie of usingmarginTop
orabsolute
-
loaderHeight : number
(optional) the height of loader in px, applied to the container when user pull the container -
loaderLoadingHeight : number
(optional) the height of loader in px while in its loading state, default to equal to loaderHeight -
loaderDefaultIcon : func
(optional) a function that return an react element, pass in progress(1-100) as it's first parameter -
loaderLoadingIcon : element
(optional) a react element that display while loader in it's loading state
-