# react-otp

> Mobile verification input React component

Latest version **0.0.1** (published 2018-04-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-otp
pnpm add react-otp
yarn add react-otp
bun add react-otp
```

## 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.1 |
| Published | 2018-04-02 |
| First published | 2018-04-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ronaldo Vitto Lewerissa |
| Maintainers | rvlewerissa |

## Links

- npm: https://www.npmjs.com/package/react-otp
- Repository: https://github.com/rvlewerissa/react-otp
- Homepage: https://github.com/rvlewerissa/react-otp#readme
- Issues: https://github.com/rvlewerissa/react-otp/issues
- npm.io page: https://npm.io/package/react-otp

## Dependencies (1)

- [class-autobind](https://npm.io/package/class-autobind.md) ^0.1.4

## Recent versions

- 0.0.1 (latest) — 2018-04-02

## README

# react-otp
Verification input field for React Native and React (using `react-native-web`).

![Alt Text](https://media.giphy.com/media/1vZ8VEQysWtXaJzmm1/giphy.gif)

### Install
```
yarn add react-otp
npm install react-otp
```

### Properties
| Props          | Type                      | Description                                   | Defaults  |
|----------------|---------------------------|-----------------------------------------------|-----------|
| autofocus      | boolean                   | auto focus input on mounts                    | true      |
| autoClear      | boolean                   | clears input after onSuccess/onFail           | false     |
| backspaceOnly  | boolean                   | input behavior                                | false     |
| maxLength      | number                    | length of OTP/PIN/code                        | 4         |
| keyboardType   | string                    | default | numeric | email-address | phone-pad | 'numeric' |
| containerStyle | StyleSheet                | -                                             | -         |
| textStyle      | StyleSheet                | -                                             | -         |
| onInputFinish  | (code: string) => ?Promise| handler after users fill all slots            | -         |
| onSuccess      | () => void                | handler after successful attempts             | -         |
| onFailure      | () => void                | handler after failure                         | -         |

> `onSuccess()` and `onFail()` works only if `onInputFinish()` returns a `Promise`, and are invoked depending on the result (resolved or rejected).

### Ref Properties
You can also set a ref and access the following methods:
- `getVerificationCode()`: returns the current code inputted by user
- `resetVerificationCode()`: resets input

Peace :v:

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