tttstudios / react-native-otp-input

Tiny Javascript library which provides an elegant UI for user to input one time passcode.
MIT License
530 stars 239 forks source link

cursor #116

Closed aman-singh-unthinkable closed 3 years ago

aman-singh-unthinkable commented 3 years ago

not able to change cursor color and also cursor alignment is also wrong when we delete an element from the input field

fpena commented 3 years ago

@fpena can you please provide a working code example and your expectation? Thanks.

KamranAshiq commented 3 years ago

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) })} />

t3chcrazy commented 3 years ago

You can change the cursor color with the selectionColor prop of the OTPInputView

Sunnysit commented 3 years ago

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).

muhammadwasi81 commented 2 years ago

<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?