Open gandarain opened 4 years ago
Thanks for reporting this. We'll take a look.
oke thanks
Hi @gandarain Have you updated this package to version 1.3.11? I tested this on version 1.3.11 and it works for me.
I set Prop autoFocusOnLoad
to true for the first OTP component and set it to false for the second OTP component. No need to use useEffect to call focus method.
Here is my code
<View style={{ justifyContent: "center", alignItems: "center" }}>
<OTPInputView
style={{ width: "80%", height: 200 }}
pinCount={4}
autoFocusOnLoad={true} // <==== Set to TRUE
codeInputFieldStyle={styles.underlineStyleBase}
codeInputHighlightStyle={styles.underlineStyleHighLighted}
onCodeFilled={(code) => {
console.log(`Code is ${code}, you are good to go!`)
}}
placeholderCharacter="-"
/>
<OTPInputView
style={{ width: "80%", height: 200 }}
pinCount={4}
autoFocusOnLoad={false} // <==== Set to FALSE
codeInputFieldStyle={styles.underlineStyleBase}
codeInputHighlightStyle={styles.underlineStyleHighLighted}
onCodeFilled={(code) => {
console.log(`Code is ${code}, you are good to go!`)
}}
placeholderCharacter="@"
/>
</View>
on long press my 2 pin get clear but pointer move only 1 step back
Describe the bug If We use 2 OTPInputView or more in the same screen, it will always focus into the second or the last OTPInputView. I have use ref but nothing change.
This is my use effect, will focus into pinRef in component did mount
This is my form, with 2 component otp, the first one is pinRef and the second one is confirmPinRef
this is my component OTPInputView
Expected behavior A The first OTPInputView should focus every time open the screen
Screenshots If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):