react-otp
v0.0.1
Published
Mobile verification input React component
Downloads
53
Readme
react-otp
Verification input field for React Native and React (using react-native-web).

Install
yarn add react-otp
npm install react-otpProperties
| 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()andonFail()works only ifonInputFinish()returns aPromise, 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 userresetVerificationCode(): resets input
Peace :v:
