# react-native-slide-verify

> A pure JavaScript component for react-native

Latest version **0.0.2** (published 2018-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-slide-verify
pnpm add react-native-slide-verify
yarn add react-native-slide-verify
bun add react-native-slide-verify
```

## 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.0.2 |
| Published | 2018-01-13 |
| First published | 2018-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Jancat |
| Maintainers | jancat |
| Keywords | react-native, slide verify, puzzle, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-slide-verify
- Repository: https://github.com/Jancat/react-native-slide-verify
- Issues: https://github.com/Jancat/react-native-slide-verify/issues
- npm.io page: https://npm.io/package/react-native-slide-verify

## Dependencies (3)

- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0
- [react-native-cached-image](https://npm.io/package/react-native-cached-image.md) ^1.4.3
- [react-native-vector-icons](https://npm.io/package/react-native-vector-icons.md) ^4.5.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2018-01-13
- 0.0.1 — 2018-01-13

## README

# react-native-slide-verify

[![npm version](http://img.shields.io/npm/v/react-native-slide-verify.svg?style=flat-square)](https://npmjs.org/package/react-native-slide-verify "View this project on npm")
[![npm downloads](http://img.shields.io/npm/dm/react-native-slide-verify.svg?style=flat-square)](https://npmjs.org/package/react-native-slide-verify "View this project on npm")
[![Platform](https://img.shields.io/badge/platform-ios%20%7C%20android-989898.svg?style=flat-square)](https://npmjs.org/package/react-native-slide-verify "View this project on npm")

A pure JavaScript `<SlideVerify>` component for react-native. Drag the slider to fill the puzzle for verifying normal operation.


## Installation
```shell
yarn add react-native-slide-verify
```
> ensure to link react-native-vector-icons

## Usage
```js
import SlideVerify from 'react-native-slide-verify'

...

render() {
  return (
    <View style={{ alignItems: 'center', justifyContent: 'center', marginVertical: 20}}>

      // use default verify images
      <SlideVerify 
        useDefault
        onVerifyPassed={alert('passed')}
        onVerifyFailed={alert('failed')}
      />

      // use specified verify images
      <SlideVerify
        puzzle={{ url: 'url/to/image'}}
        puzzlePiece={require('path/to/image')}
        slideVerify={offset => { console.log(offset); return Promise.resolve() }}
        showRefresh
        refresh={() => alert('refresh')}
        slideTips={I18n.t('slideTips')}
      >
    </View>
  )
}
```

## Component Props
**use default verify images**

| Property | Type | Description |
|----------|------|-------------|
| `useDefault` | bool (default false) | use default verify images |
| `onVerifyPassed` | func (default `() => {}`) | verify passed callback |
| `onVerifyFaild` | func (default `() => {}`) | verify failed callback |


**use specified verify images**
| Property | Type | Description |
|----------|------|-------------|
| `imageSize` | object (`{puzzleWidth: number(default 300), puzzleHeight: number(default 150), puzzlePieceWidth: number(default 50)}`) | optional. custom image diplay size, related to slide offset (`puzzleWidth` decides the container width) |
| `puzzle` | object or number | background image. object with `{url: 'xxx'}` or result of `require('path/to/image')` |
| `puzzlePiece` | object or number | piece image. object with `{url: 'xxx'}` or result of `require('path/to/image')` |
| `showRefresh` | bool (default `false`) | show refresh icon on the top right corner |
| `refresh` | func (default `() => {}`) | refresh icon onPress listener |
| `slideVerify` | func (default `() => {}`) | called to verify when releasing finger on the dragging slider. pass `offset` as param.  **The func should return promise of verify result** |


**common props**
| Property | Type | Description |
|----------|------|-------------|
| `displayType` | string (default `'triggered'`) | puzzle image display type. enum(`'triggered'`, `'embedded'`) |
| `slideTips` | string (default `'向右滑动左侧箭头填充拼图'`) | slide tips showed in slide box |

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