
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
react-native-otp-inputs
Advanced tools
react-native-otp-inputs
is fully customizable, pure JavaScript package, that provides solution for One-time password feature with user friendly events like moving to previous input with backspace or going to next when filled in. It supports pasting and otp code into inputs
It's because of onKeyPress
event implementation on android.
import React, { Component } from 'react'
import { View } from 'react-native'
import OtpInputs from 'react-native-otp-inputs'
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<OtpInputs handleChange={code => console.log(code)} numberOfInputs={6} />
</View>
)
}
}
Method | Type | Required | Default | Description |
---|---|---|---|---|
autoCapitalize | string | false | 'none' | Defines input auto capitalization (only use with keyboardType) |
clearTextOnFocus | boolean | false | false | Defines if input text should be cleared on focus |
containerStyles | style (object) | false | none | Styles applied to whole container |
errorMessage | string | false | none | Error message that is displayed above inputs |
errorMessageContainerStyles | style (object) | false | none | Styles applied to error message container |
errorMessageTextStyles | style (object) | false | none | Styles applied to error message text |
focusedBorderColor | string | false | #0000ff | borderColor of input when focused |
handleChange | function | true | console.log | Returns otp code which is typed in inputs |
inputContainerStyles | style (object) | false | none | Styles applied to each input container |
inputsContainerStyles | style (object) | false | none | Styles applied to inputs container |
inputTextErrorColor | string | false | #ff0000 | Color of text inside input container when error is passed in |
keyboardType | string | true | 'phone-pad' | Keyboard type for inputs |
numberOfInputs | number | true (1..6) | 4 | How many inputs should be rendered |
secureTextEntry | boolean | false | false | Defines if input will hide text inside |
selectTextOnFocus | boolean | false | true | Defines if input text should be selected on focus |
unfocusedBorderColor | string | false | transparent | borderColor of input when not focused |
Great thanks to @kantorm.
FAQs
One-time password inputs built in pure JS for React-Native
The npm package react-native-otp-inputs receives a total of 5,660 weekly downloads. As such, react-native-otp-inputs popularity was classified as popular.
We found that react-native-otp-inputs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.