I have a question, currently I have this code for my password type input and I have the functionality to see or not see the password, and the problem is that when I write the password and change the state to see it it works fine and I can continue writing and when I return it and I change it and I want to continue writing, as soon as I type the character it erases what it had, how can I solve that?
<TextInput
label='Contraseña'
mode='flat'
style={{
marginBottom: 17,
backgroundColor: '#304d4a',
borderTopRightRadius: 10,
borderTopLeftRadius: 10,
fontWeight: 'bold',
}}
selectionColor='white'
underlineColor={'#958f8f'}
activeUnderlineColor={'#fff'}
textColor='white'
secureTextEntry={showPassword}
textContentType='password'
value={password}
autoCorrect={false}
onChangeText={(text) => {
console.log(text)
setPassword(text)
}}
onFocus={() => {
setShowIcon(true)
}}
onBlur={() => {
setShowIcon(false)
}}
right={
showIcon && (
<TextInput.Icon
icon={showPassword ? 'eye-off' : 'eye'}
color='white'
forceTextInputFocus={false}
onPress={() => {
setShowPassword(!showPassword)
}}
/>
)
}
/>
section, you can try writing the setPassword() part before console.log(). I think there may be an error caused by the use of setPassword. I recommend you try again by changing the priority of something.