# react-swipe-row

> Swipe Row [![Build Status](https://travis-ci.org/shiminshen/react-swipe-row.svg?branch=master)](https://travis-ci.org/shiminshen/react-swipe-row) ===

Latest version **0.1.0** (published 2018-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-swipe-row
pnpm add react-swipe-row
yarn add react-swipe-row
bun add react-swipe-row
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-04-15 |
| First published | 2018-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 44 |
| Unpacked size | 368 KB |
| Known vulnerabilities | 0 (+10 in 3 direct dependencies) |
| Install scripts | no |
| Author | smshen |
| Maintainers | shiminshen |

## Links

- npm: https://www.npmjs.com/package/react-swipe-row
- Homepage: https://shiminshen.github.io/react-swipe-row
- npm.io page: https://npm.io/package/react-swipe-row

## Dependencies (44)

- [raf](https://npm.io/package/raf.md) 3.4.0
- [jest](https://npm.io/package/jest.md) 20.0.4
- [chalk](https://npm.io/package/chalk.md) 1.1.3
- [react](https://npm.io/package/react.md) ^16.1.1
- [dotenv](https://npm.io/package/dotenv.md) 4.0.0
- [eslint](https://npm.io/package/eslint.md) 4.10.0
- [promise](https://npm.io/package/promise.md) 8.0.1
- [webpack](https://npm.io/package/webpack.md) 3.8.1
- [fs-extra](https://npm.io/package/fs-extra.md) 3.0.1
- [gh-pages](https://npm.io/package/gh-pages.md) ^1.1.0
- [babel-cli](https://npm.io/package/babel-cli.md) ^6.26.0
- [bootstrap](https://npm.io/package/bootstrap.md) ^4.0.0-beta.2
- [react-dom](https://npm.io/package/react-dom.md) ^16.1.1
- [babel-core](https://npm.io/package/babel-core.md) 6.26.0
- [babel-jest](https://npm.io/package/babel-jest.md) 20.0.3
- [css-loader](https://npm.io/package/css-loader.md) 0.28.7
- [url-loader](https://npm.io/package/url-loader.md) 0.6.2
- [file-loader](https://npm.io/package/file-loader.md) 1.1.5
- [autoprefixer](https://npm.io/package/autoprefixer.md) 7.1.6
- [babel-eslint](https://npm.io/package/babel-eslint.md) 7.2.3
- [babel-loader](https://npm.io/package/babel-loader.md) 7.1.2
- [style-loader](https://npm.io/package/style-loader.md) 0.19.0
- [whatwg-fetch](https://npm.io/package/whatwg-fetch.md) 2.0.3
- [babel-runtime](https://npm.io/package/babel-runtime.md) 6.26.0
- [eslint-loader](https://npm.io/package/eslint-loader.md) 1.9.0
- [object-assign](https://npm.io/package/object-assign.md) 4.1.1
- [postcss-loader](https://npm.io/package/postcss-loader.md) 2.0.8
- [react-dev-utils](https://npm.io/package/react-dev-utils.md) ^4.2.1
- [babel-preset-react](https://npm.io/package/babel-preset-react.md) ^6.24.1
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) 2.9.4
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.24.1
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) 7.4.0
- [html-webpack-plugin](https://npm.io/package/html-webpack-plugin.md) 2.29.0
- [babel-preset-stage-0](https://npm.io/package/babel-preset-stage-0.md) ^6.24.1
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) 2.8.0
- [babel-preset-react-app](https://npm.io/package/babel-preset-react-app.md) ^3.1.0
- [eslint-plugin-flowtype](https://npm.io/package/eslint-plugin-flowtype.md) 2.39.1
- [eslint-plugin-jsx-a11y](https://npm.io/package/eslint-plugin-jsx-a11y.md) 5.1.1
- [postcss-flexbugs-fixes](https://npm.io/package/postcss-flexbugs-fixes.md) 3.2.0
- [eslint-config-react-app](https://npm.io/package/eslint-config-react-app.md) ^2.0.1
- [webpack-manifest-plugin](https://npm.io/package/webpack-manifest-plugin.md) 1.3.2
- [sw-precache-webpack-plugin](https://npm.io/package/sw-precache-webpack-plugin.md) 0.11.4
- [extract-text-webpack-plugin](https://npm.io/package/extract-text-webpack-plugin.md) 3.0.2
- [case-sensitive-paths-webpack-plugin](https://npm.io/package/case-sensitive-paths-webpack-plugin.md) 2.1.1

## Recent versions

- 0.1.0 (latest) — 2018-04-15
- 0.0.16 — 2018-04-15
- 0.0.15 — 2018-04-15
- 0.0.14 — 2018-04-15
- 0.0.10 — 2018-04-15
- 0.0.9 — 2018-04-15
- 0.0.6 — 2018-02-27
- 0.0.5 — 2018-02-27
- 0.0.4 — 2018-02-27

## README

Swipe Row [![Build Status](https://travis-ci.org/shiminshen/react-swipe-row.svg?branch=master)](https://travis-ci.org/shiminshen/react-swipe-row)
===

A React component implement swipe to show actions.

Development
---

    npm install
    npm start

or use storybook

    npm run storybook

then swipe the row by mobile dev tool!

Usage
---

```javascript
import SwipeRow from 'SwipeRow'

const rowId = 1

<SwipeRow
  rowId={rowId}
  onTouchStart={(e, { x, y, move, offset, ...rest }) => {}}
  rightButtons={[
    <div style={{padding: '12px', background: 'blue'}}>Delete</div>,
    <div style={{padding: '12px', background: 'red'}}>Delete</div>,
    <div style={{padding: '12px', background: 'yellow'}}>Delete</div>
  ]}
  leftButtons={[
    <div style={{padding: '12px', background: 'gray'}}>Mute</div>,
    <div style={{padding: '12px', background: 'pink'}}>Mute</div>
  ]}
  disableSwipeLeft
>
  <div style={{background: '#fff', padding: '12px', textAlign: 'center'}}>
    example {rowId.toString()}
  </div>
</SwipeRow>

```
API
---

#### SwipeRow
| name                   | description            | type    | default |
|------------------------|------------------------|--------- |---------|
|  onTouchStart          |                        | Function |         |
|  onTouchMove           |                        | Function |         |
|  onTouchEnd            |                        | Function |         |
|  leftButtons           | Components which reveals on left  | Array of React Components   | [ ] |
|  rightButtons          | Components which reveals on right | Array of React Components   | [ ] |
|  className             | ClassName for wrapper div  | String   |''       |
|  deltaThreshold        | Threshold of swiping direction track | number | 10       |
|  flickThreshold        | Threshold of flick swiping comfirmation | number | 200      |
|  transitionFunc        | CSS transition to complete swipe | String | 'all 0.3s cubic-bezier(0, 0, 0, 1)' |
|  disableSwipeLeft      | Disable swipe left     | Boolean  | false |
|  disableSwipeRight     | Disable swipe right    | Boolean  | false |

#### Event Props
```onTouchStart```, ```onTouchMove``` and ```onTouchEnd``` are the callback event with corresponding event as the first parameter and the state of each threshold as the second parameter.

---
_Source: https://npm.io/package/react-swipe-row · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
