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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-pullable

v1.0.5

Published

Simple, customizable pull to refresh.

Downloads

2,564

Readme

🙋 React Pullable

Simple, customizable React component for pull to refresh on touch devices.

Play with the demo

GIF

Usage

Install with yarn add react-pullable or npm install react-pullable

Import in your components with import Pullable from 'react-pullable'

Component styles

To prevent Chrome overscroll set overscroll-behavior-y: contain [or] none; on <body> (learn more).

Required props

| Prop | Type | Description | | :--- | :--- | :--- | | onRefresh | Function | Called when a pull is triggered |

Optional props

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | className | String | pullable | Class applied to the component | | centerSpinner | Boolean | true | Is the spinner vertically centered or top-aligned? | | fadeSpinner | Boolean | true | Does the spinner fade in/out when pulled? | | rotateSpinner | Boolean | true | Does the spinner rotate when pulled? | | spinnerSize | Number | 24 | Pixel width/height of the spinner | | spinnerOffset | Number | 0 | Pixel offset of the spinner (from the top) | | spinnerColor | String | #000000 | Color of the spinner | | spinSpeed | Number | 1200 | Time to rotate the spinner 360° (in ms) | | popDuration | Number | 200 | Time to expand the spinner before it rotates (0 = skip pop) | | distThreshold | Number | spinnerSize * 3 | Distance where refresh is triggered | | resistance | Number | 2.5 | How hard it is to pull down | | refreshDuration | Number | 1000 | Time spent spinning before resetting (in ms) | | resetDuration | Number | 400 | Time to reset (in ms) | | resetEase | String | cubic-bezier(0.215, 0.61, 0.355, 1) | Ease when resetting | | shouldPullToRefresh | Function | () => window.scrollY <= 0 | When to allow pulling | | disabled | Boolean | | Disables all functionality |

Examples

Using only the required onRefresh prop:

<Pullable onRefresh={() => this.getData()}>
  {this.state.cards.map(card => <Card data={card}/>)}
</Pullable>

Using some optional props:

<Pullable
  onRefresh={() => this.getTasks(currentUser)}
  centerSpinner={false}
  spinnerColor="#FFFFFF"
  disabled={!currentUser}
>
  {this.state.tasks.map(task => <Task data={task}/>)}
</Pullable>

Credits

Inspired by BoxFactura’s PulltoRefresh.js

Spinner SVG from Feather Icons

Built using NWB

Contributing

To test using the included demo app:

  1. Clone the repo
  2. Open the directory and run npm install and npm start
  3. The demo app will update to reflect any changes to it or the component

To test in your own local app:

  1. Clone the repo
  2. Open the directory and run npm install and npm link
  3. Open a directory with a test project and run npm link [package name]
  4. Back in the react-preload-image directory run npm run build