0.0.1 • Published 6 years ago

react-otp v0.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

react-otp

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

Alt Text

Install

yarn add react-otp
npm install react-otp

Properties

PropsTypeDescriptionDefaults
autofocusbooleanauto focus input on mountstrue
autoClearbooleanclears input after onSuccess/onFailfalse
backspaceOnlybooleaninput behaviorfalse
maxLengthnumberlength of OTP/PIN/code4
keyboardTypestringdefaultnumericemail-addressphone-pad'numeric'
containerStyleStyleSheet--
textStyleStyleSheet--
onInputFinish(code: string) => ?Promisehandler after users fill all slots-
onSuccess() => voidhandler after successful attempts-
onFailure() => voidhandler 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: