ttdung11t2 / react-native-confirmation-code-input

A react-native component to input confirmation code for both Android and IOS
MIT License
411 stars 349 forks source link

How can i create autofill when i recieve otp via sms. #54

Open SukumarSmart opened 5 years ago

gsmohan commented 5 years ago

@SukumarSmart First create a ref like below : this.otpCodeRef = React.CreateRef() <CodeInput ref={(value) => this.otpCodeRef = value} .... />

After reading the 4 digit OTP from the 3rd part module ( react-native-android-sms-listener ) const verificationCode = '' const tmp = [...verificationCode] this.otpCodeRef.setState({ codeArr: tmp, currentIndex: 3 })

mohamed-ikram commented 4 years ago

@gsmohan Thanks for the answer