1.0.0 • Published 2 years ago

react-native-otp-keyboard v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-otp-keyboard

A package for Custom OTP keyboard. This can be customized according to needs.

Compatible with both React Native CLI and Expo Managed apps.

Installation

npm i react-native-otp-keyboard

Usage

Below are some examples to use this package

Basic Usage

import OTPInput from "react-native-otp-keyboard";

const [OTP, SetOTP] = useState("");
// Maintain a state variable

// Use it like this
<OTPKeyboard
  onSubmitPress={(text: string) => console.log(text)}
  onPress={SetOTP}
/>;

Some Examples


Parameters

ParameterrequiredDefaultDescription
keysNOSee DocsKeys array to display, you can manipulate it. Take a look at the Props.
backspaceComponentNOnullcomponent to render in place of backspace key
submitComponentNOnullcomponent to render in place of submit key
keyboardStyleNOstyling for keyboard container
digitBoxStyleNOstyling for each digit box
keyboardBackgroundColorNOwhitebackground color for keyboard container
digitBoxBackgroundColorNObackground color for digit box container
digitColorNO60Each digit text color
widthNOScreen Widthwidth of the keyboard container
heightNO40% of Screen Heightheight of the keyboard container
onPressNOcallback to execute when user presses the key
onSubmitPressNOcallback to execute when user presses the submit key
maxLengthNOmaxLength of keyboard input