Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { InputProps, OTPInputViewState } from '@twotalltotems/react-native-otp-input';
import React, { Component } from 'react'
import { View, TextInput, TouchableWithoutFeedback, Keyboard, Platform, I18nManager, EmitterSubscription, } from 'react-native'
import Clipboard from '@react-native-community/clipboard';
//import Clipboard from '@react-native-community/clipboard';
import styles from './styles'
import { isAutoFillSupported } from './helpers/device'
import { codeToArray } from './helpers/codeToArray'
Expand Down Expand Up @@ -93,20 +93,20 @@ export default class OTPInputView extends Component<InputProps, OTPInputViewStat
checkPinCodeFromClipBoard = () => {
const { pinCount, onCodeFilled } = this.props
const regexp = new RegExp(`^\\d{${pinCount}}$`)
Clipboard.getString().then(code => {
if (this.hasCheckedClipBoard && regexp.test(code) && (this.clipBoardCode !== code)) {
this.setState({
digits: code.split(""),
}, () => {
this.blurAllFields()
this.notifyCodeChanged()
onCodeFilled && onCodeFilled(code)
})
}
this.clipBoardCode = code
this.hasCheckedClipBoard = true
}).catch(() => {
})
// Clipboard.getString().then(code => {
// if (this.hasCheckedClipBoard && regexp.test(code) && (this.clipBoardCode !== code)) {
// this.setState({
// digits: code.split(""),
// }, () => {
// this.blurAllFields()
// this.notifyCodeChanged()
// onCodeFilled && onCodeFilled(code)
// })
// }
// this.clipBoardCode = code
// this.hasCheckedClipBoard = true
// }).catch(() => {
// })
}

private handleChangeText = (index: number, text: string) => {
Expand Down