Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-otp-input-fields-suzan

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-otp-input-fields-suzan

React Native Component for OTP Input Fields.

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-otp-input-fields

This is a component for OTP Input fields.

  • Installation
  • Usage
  • Docs

Installation

npm i react-native-otp-input-fields

NOTE: This package uses react-native-reanimated under the hood for animation. Please Follow the installation process of React Native Reanimated

Usage

Below are some examples to use this package

Basic Usage

import OTPInput from "react-native-otp-input-fields";

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

// Use it like this
<OTPInput onChangeText={SetOTP} value={OTP} />;

Password Secure Usage

import OTPInput from "react-native-otp-input-fields";

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

// Use it like this
<OTPInput onChangeText={SetOTP} value={OTP} secureTextEntry={true} />;

Change Colors and other styles

import OTPInput from "react-native-otp-input-fields";

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

// Use it like this
<OTPInput
  onChangeText={SetOTP}
  value={OTP}
  borderColor="orange"
  boxBackgroundColor="dodgerblue"
  cursorColor="orange"
  digitColor="white"
/>;

Apply Elevation and Border Radius etc.

import OTPInput from "react-native-otp-input-fields";

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

// Use it like this
<OTPInput
  onChangeText={SetOTP}
  value={OTP}
  boxBorderRadius={50}
  onlyBorderBottom={false}
  boxElevation={10}
/>;

Parameters

Basic Parameters

ParameterrequiredDefaultDescription
valueYESMaintain a state in parent component and use it as a controlled input
onChangeTextYESthe onChangeText function to update the state in parent component
countNO6Number of digits in the OTP
autoFocusNOfalseWhether to autofocus the first field
removeOnBackspaceNOtrueWhether to clear the previous input while pressing the backspace button on a input field
onSubmitEditingNOfunction to execute when user presses the done button on keyboard
containerWidthNOscreenWidthWidth of the Input Field Container
boxHeightNO60Height of each input field
marginNO5margin between each input field

Customization

ParameterrequiredDefaultDescription
secureTextEntryNOfalseMask the text input as password field or not
allowDigitsOnlyNOfalseAllow only digits to be entered in the text input
digitFontSizeNO25font size of the text inside input field
animateDurationNO300msDuration for the animation to complete when input field is focused
cursorColorNOblackcolor of the blinking cursor
digitColorNOblackcolor of the digit inside the field
onlyBorderBottomNOtruewhether to show border around whole box or just the border bottom
keyboardTypeNOtruetype of Keyboard from KeyboardTypeOptions in react-native
borderBottomWidthNO3width for the border bottom of box
borderColorNOblackcolor for the border of box
boxElevationNO6elevation for the input field box
maxLengthNO1Max length of each input field
inputStyleNOstyles for the TextInput component
boxHeightNO60height of each input field
boxBorderRadiusNO0border Radius of input field
boxContainerStyleNOstyles for the input containers
containerStyleNOstyles for the whole input box container (outer)
boxBackgroundColorNOwhitebackround Color of the input fields

Keywords

FAQs

Package last updated on 03 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc