Why is my secureTextEntry
not working ? Here is my code:
export default function App() { const { t } = useTranslation(); const [value, setValue] = useState(''); return ( <View style={s.container}> <Input value='' placeholder='Passwort' style={[InputStyles.normal, s.inputMargin]} /> <Input value={value} onChangeText={(e) => setValue(e)} placeholder='E-Mail' style={InputStyles.normal_icon} icon={<AntDesign name="stepforward" size={24} color="black" />} multiline secureTextEntry={true} keyboardType='default' /> </View> ); }
Advertisement
Answer
secureTextEntry
does not work with multiline
. Here is what React Native’s documentation says:
secureTextEntry
If
true
, the text input obscures the text entered so that sensitive text like passwords stay secure. The default value isfalse
. Does not work withmultiline={true}
.
In order to have it working, remove multiline
propriety, like so:
export default function App() { const { t } = useTranslation(); const [value, setValue] = useState(''); return ( <View style={s.container}> <Input value='' placeholder='Passwort' style={[InputStyles.normal, s.inputMargin]} /> <Input value={value} onChangeText={(e) => setValue(e)} placeholder='E-Mail' style={InputStyles.normal_icon} icon={<AntDesign name="stepforward" size={24} color="black" />} secureTextEntry={true} keyboardType='default' /> </View> ); }