New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-swipe-down-refresh

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-swipe-down-refresh

React swipe down to refresh component

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

react-swipe-down-refresh

npm version license

Swipe down to refresh or pull-to-refresh control for mobile web applications.

The component is built using composable utilities to give fine grain control over the swipe-refresh behavior. These building blocks could be used independently to build your own swipe-refresh control.

Components and utils

  • SwipeRefreshList—React component with swipe-refresh behavior
  • useSwipeRefresh—React hook that encapsulates the swipe-refresh logic
  • SwipeRefreshCoordinator—UI framework agnostic implementation of the core gesture handling logic

Getting started

To start using react-swipe-down-refresh, install it via NPM

npm i react-swipe-down-refresh

# yarn
yarn add react-swipe-down-refresh

Demo

Try it online

Open in a mobile web-browser or toggle the device mode on a web-browser

Try the app online here.

Usage

Import the SwipeRefreshList component and include the styles provided in the package to get the swipe-refresh behavior. Make sure your build system supports importing .css files.

import { SwipeRefreshList } from "react-swipe-down-refresh";

// include the styles
import "react-swipe-down-refresh/lib/styles.css";

export default function App() {
  const onRefreshRequested = () => {
    return new Promise<void>((resolve) => {
      setTimeout(() => resolve(), 3000);
    });
  };

  return (
    <div>
      <SwipeRefreshList onRefresh={onRefreshRequested}>
        <div className="item">Line 1</div>
        <div className="item">Line 2</div>
        <div className="item">Line 3</div>
      </SwipeRefreshList>
    </div>
  );
}

Props

NameDescriptionRequiredDefault
onRefreshCallback function triggered on refreshtrue-
disabledDisabled pull to refreshfalsefalse
classNameCSS class to attache to the outermost divfalse-

Customization

You can customize the swipe refresh spinner look and behavior via the following the props

NameDescriptionRequiredDefault
thresholdMinimum gesture movement displacement before swipe action is registeredfalsefalse
onEndRefreshCallback function triggered on refresh is completefalsefalse
onStartRefreshCallback function triggered on refresh startfalsefalse
slingshotDistanceThe distance the refresh indicator can be pulled during a swipe gesturefalsefalse
progressViewOffsetThe refresh indicator position during refreshfalsefalse
progressStrokeColorColor of the refresh progress spinnerfalsefalse
getScrollTopOverrideDisabled pull to refreshfalsefalse
overrideBrowserRefreshOverride browser pull to refresh behaviourfalsefalse
progressBackgroundColorBackground color of the progress spinnerfalsefalse

Credits

Keywords

react

FAQs

Package last updated on 26 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts