Gathering detailed insights and metrics for simple-pincode-input
Gathering detailed insights and metrics for simple-pincode-input
Gathering detailed insights and metrics for simple-pincode-input
Gathering detailed insights and metrics for simple-pincode-input
A cross-platform, smooth, lightweight, customizable PIN code input component for React Native.
npm install simple-pincode-input
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
87 Commits
1 Branches
1 Contributors
Updated on 29 Aug 2022
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
4,300%
44
Compared to previous week
Last month
-39.2%
152
Compared to previous month
Last year
89.8%
5,378
Compared to previous year
1
A cross-platform, smooth, lightweight, customizable PIN code input component for React Native.
Most PIN code inputs components implemented by combining several TextInputs. They works, however, not good enough. When user types fast, or system sluggish, characters may lost when component switching focus between TextInputs. User need to type over and over again to get a correct input, gave a frustrated user experience.
React Native Smooth Pincode Input implemented with a different approach - It's based on single TextInput but only render it as seperated fields. In other words, it looks like a PIN code input, but works as smooth as a native TextInput.
React Native Smooth Pincode Input is also highly customizable. By exposing cells and text stylesheets, it can be fully customized to fit in your app design. Password mode also supported with customizable mask characters as well as placeholders.
1# yarn 2yarn add react-native-smooth-pincode-input 3 4# npm 5npm i react-native-smooth-pincode-input
1<SmoothPinCodeInput 2 ref={this.pinInput} 3 value={code} 4 onTextChange={code => this.setState({ code })} 5 onFulfill={this._checkCode} 6 onBackspace={this._focusePrevInput} 7 />
1<SmoothPinCodeInput password mask="﹡" 2 cellSize={36} 3 codeLength={8} 4 value={password} 5 onTextChange={password => this.setState({ password })}/>
1<SmoothPinCodeInput 2 cellStyle={{ 3 borderBottomWidth: 2, 4 borderColor: 'gray', 5 }} 6 cellStyleFocused={{ 7 borderColor: 'black', 8 }} 9 value={code} 10 onTextChange={code => this.setState({ code })} 11 />
1<SmoothPinCodeInput 2 placeholder="⭑" 3 cellStyle={{ 4 borderWidth: 2, 5 borderRadius: 24, 6 borderColor: 'mediumturquoise', 7 backgroundColor: 'azure', 8 }} 9 cellStyleFocused={{ 10 borderColor: 'lightseagreen', 11 backgroundColor: 'lightcyan', 12 }} 13 textStyle={{ 14 fontSize: 24, 15 color: 'salmon' 16 }} 17 textStyleFocused={{ 18 color: 'crimson' 19 }} 20 value={code} 21 onTextChange={code => this.setState({ code })} 22 />
1<SmoothPinCodeInput 2 placeholder={<View style={{ 3 width: 10, 4 height: 10, 5 borderRadius: 25, 6 opacity: 0.3, 7 backgroundColor: 'blue', 8 }}></View>} 9 mask={<View style={{ 10 width: 10, 11 height: 10, 12 borderRadius: 25, 13 backgroundColor: 'blue', 14 }}></View>} 15 maskDelay={1000} 16 password={true} 17 cellStyle={null} 18 cellStyleFocused={null} 19 value={code} 20 onTextChange={code => this.setState({ code })} 21/>
Name | Type | Default | Description |
---|---|---|---|
value | String | '' | The value to show for the input |
codeLength | Number | 4 | Number of character for the input |
cellSize | Number | 48 | Size for each cell in input |
cellSpacing | Number | 4 | Space between each cell |
placeholder | String | Element | '' |
mask | String | Element | '*' |
maskDelay | Number | 200 | The delay in milliseconds before a character is masked |
password | Boolean | false | Mask the input value. Each cell masked with mask props |
autoFocus | Boolean | false | If true, focuses the input on componentDidMount |
editable | Boolean | true | If false, makes each cell not editable |
animated | Boolean | true | Toggle animations |
animationFocused | String, Object | 'pulse' | The animation of the focused cell. This can be a preset animation in the form of a string or a custom animation object. |
restrictToNumbers | Boolean | false | Restrict input to numbers only |
containerStyle | React View StyleSheet | {} | View style for whole cell containers |
cellStyle | React View StyleSheet | { borderColor: 'gray', borderWidth: 1} | View style for each cell |
cellStyleFocused | React View StyleSheet | { borderColor: 'black', borderWidth: 2 } | View style for focused cell |
textStyle | React Text StyleSheet | { color: 'gray', fontSize: 24 } | Text style for cell value |
textStyleFocused | React Text StyleSheet | { color: 'black' } | Text style for focused cell value |
onFulfill | Function | null | Callback function that's called when the input is completely filled |
onTextChange | Function | null | Callback function that's called when the text changed |
onBackspace | Function | null | Callback function that's called when the input is empty and the backspace button is pressed |
keyboardType | Enum('default', 'number-pad', 'decimal-pad', 'numeric', 'email-address', 'phone-pad') | 'numeric' | Determines which keyboard to open |
No vulnerabilities found.
No security vulnerabilities found.