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

@twotalltotems/react-native-otp-input

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twotalltotems/react-native-otp-input - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

8

index.d.ts

@@ -66,2 +66,10 @@ /* typescript declaration file created for @twotalltotems/react-native-otp-input

placeholderTextColor?: string;
/**
* Style of the OTP container view
*/
style?: object;
/**
* The highlight (and cursor on iOS) color of the text input.
*/
selectionColor?: string;
}

@@ -68,0 +76,0 @@

22

index.js

@@ -20,3 +20,5 @@ import React, { Component } from 'react'

placeholderCharacter: PropTypes.string,
placeholderTextColor: PropTypes.string
placeholderTextColor: PropTypes.string,
style: PropTypes.object,
selectionColor: PropTypes.string,
}

@@ -35,2 +37,4 @@

placeholderTextColor: null,
style: null,
selectionColor: '#000',
}

@@ -107,5 +111,6 @@

checkPinCodeFromClipBoard = () => {
const { pinCount } = this.props
const { pinCount, onCodeFilled } = this.props
const regexp = new RegExp(`^\\d{${pinCount}}$`)
Clipboard.getString().then(code => {
if (this.hasCheckedClipBoard && code.length === pinCount && (this.clipBoardCode !== code)) {
if (this.hasCheckedClipBoard && regexp.test(code) && (this.clipBoardCode !== code)) {
this.setState({

@@ -116,2 +121,3 @@ digits: code.split(""),

this.notifyCodeChanged()
onCodeFilled && onCodeFilled(code)
})

@@ -141,4 +147,6 @@ }

text.split("").forEach((value) => {
newdigits[index] = value
index += 1
if(index < pinCount) {
newdigits[index] = value;
index += 1;
}
})

@@ -197,3 +205,3 @@ index -= 1

renderOneInputField = (_, index) => {
const { codeInputFieldStyle, codeInputHighlightStyle, secureTextEntry, keyboardType } = this.props
const { codeInputFieldStyle, codeInputHighlightStyle, secureTextEntry, keyboardType, selectionColor } = this.props
const { defaultTextFieldStyle } = styles

@@ -218,3 +226,3 @@ const { selectedIndex, digits } = this.state

key={index}
selectionColor="#00000000"
selectionColor={selectionColor}
secureTextEntry={secureTextEntry}

@@ -221,0 +229,0 @@ placeholder={placeholderCharacter}

{
"name": "@twotalltotems/react-native-otp-input",
"version": "1.2.1",
"version": "1.2.2",
"description": "is a tiny JS library for one time passcode (OTP). Supports smart input suggestion on iOS and code autofill on Android (it will be filled when you press the copy button on the SMS notification bar)",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -24,2 +24,15 @@ ![PaginatableList](https://raw.githubusercontent.com/Twotalltotems/react-native-otp-input/master/assets/otp_banner.jpg)

...
<OTPInputView pinCount={4} />
```
## More Advanced Usage
```
import OTPInputView from '@twotalltotems/react-native-otp-input'
...
<OTPInputView

@@ -87,3 +100,4 @@ style={{width: '80%', height: 200}}

## Roadmap
* [ ] Typescript
* [x] Typescript definition file
* [ ] Typescript implementation
* [x] Add basic unit tests

@@ -90,0 +104,0 @@ * [ ] Add integration tests

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