Closed aman-singh-unthinkable closed 3 years ago
@fpena can you please provide a working code example and your expectation? Thanks.
not able to change cursor color and also cursor alignment is also wrong when we delete an element from the input field
facing same problem on clearing a input field cursor does not blink in the centre of input field(occured on android).
Sample code to reproduce the issue on android is following.
<OTPInputView style={{ width: '100%', height: hp('7%') }} pinCount={6} autoFocusOnLoad placeholderCharacter="-" onCodeFilled={(otp => { onPress(otp) })} />
You can change the cursor color with the selectionColor
prop of the OTPInputView
Hi @aman-singh-unthinkable,
as @t3chcrazy mentioned, please use selectionColor
prop to change cursor color.
For the cursor alignment, it would be center if there is no placeholderCharacter
value. Otherwise, the cursor would show beside the placeholderCharacter (left side in iOS or right side in Android).
<OTPInputView
style={{ width: '80%' }}
pinCount={4}
autoFocusOnLoad
code={code}
onCodeChanged={code => setCode(code)}
codeInputFieldStyle={styles.underlineStyleBase}
codeInputHighlightStyle={styles.underlineStyleHighLighted}
placeholderTextColor={COLORS.black}
selectionColor={COLORS.main}
keyboardType="number-pad"
onCodeFilled={code => {
console.log(Code is ${code}, you are good to go!
)
setCode(code)
}}
/>
This provide me the backgroundColor when I enter last input field does anyone have the solution?
not able to change cursor color and also cursor alignment is also wrong when we delete an element from the input field