File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -104,14 +104,16 @@ export default class OTPInputView extends Component {
104104 }
105105
106106 checkPinCodeFromClipBoard = ( ) => {
107- const { pinCount } = this . props
107+ const { pinCount, onCodeFilled } = this . props
108+ const regexp = new RegExp ( `^\\d{${ pinCount } }$` )
108109 Clipboard . getString ( ) . then ( code => {
109- if ( this . hasCheckedClipBoard && code . length === pinCount && ( this . clipBoardCode !== code ) ) {
110+ if ( this . hasCheckedClipBoard && regexp . test ( code ) && ( this . clipBoardCode !== code ) ) {
110111 this . setState ( {
111112 digits : code . split ( "" ) ,
112113 } , ( ) => {
113114 this . blurAllFields ( )
114115 this . notifyCodeChanged ( )
116+ onCodeFilled && onCodeFilled ( code )
115117 } )
116118 }
117119 this . clipBoardCode = code
You can’t perform that action at this time.
0 commit comments