Coder Social home page Coder Social logo

jljlpch / react-pull-to-refresh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bryaneaton13/react-pull-to-refresh

0.0 2.0 0.0 239 KB

React component for web pull to refresh

Home Page: https://www.npmjs.com/package/react-pull-to-refresh

License: MIT License

JavaScript 100.00%

react-pull-to-refresh's Introduction

react-pull-to-refresh

npm install react-pull-to-refresh

A pull to refresh component for the web.

Based on Andy Peatling's Pull to Refresh for the Web

Demo GIF

Usage

Your refresh handler function takes in resolve and reject to tell the PullToRefresh component when it's finished.

handleRefresh(resolve, reject) {
  // do some async code here
  if (success) {
    resolve();
  } else {
    reject();
  }
}

Where you want to render the component:

<ReactPullToRefresh
  onRefresh={this.handleRefresh}
  className="your-own-class-if-you-want"
  style={{
    textAlign: 'center'
  }}>
  <h3>Pull down to refresh</h3>
  <div>{items}</div>
  <div>etc.</div>
</ReactPullToRefresh>

CSS

Use the CSS from the example or from here as a starting point.

All props

React.PropTypes

  • onRefresh
  • function (required)
  • icon
  • React element
  • default:
 <span className="genericon genericon-next"></span>
  • loading
  • element
  • default:
<div className="loading">
  <span className="loading-ptr-1"></span>
  <span className="loading-ptr-2"></span>
  <span className="loading-ptr-3"></span>
</div>
  • disabled
  • boolean
  • className
  • string
  • style
  • object
  • distanceToRefresh
  • number
  • default: 70
  • resistance
  • number
  • default: 2.5
  • hammerOptions
  • object

Thanks

Andy Peatling

react-pull-to-refresh's People

Contributors

bryaneaton13 avatar eqyiel avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.