Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

225
Visualizações
Adding an eye icon on the right side of the input field in react native

I am working on a react native project. I have a password field on the Login page and I want to add an eye icon on the right end of the input field. My code currently looks like this:

  <View><TextInput placeholder='Enter your Password' autoCorrect={false} secureTextEntry={true} textContentType='password'></TextInput></View>

This is a normal input field with a placeholder text.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Please find the below code:

const [password, setPassword] = useState('');  
const [isPasswordSecure, setIsPasswordSecure] = useState(true);


<View style={styles.viewPassword}>
                    <TextInput
                      secureTextEntry={isPasswordSecure}
                      style={styles.textInputStyle}
                      right={
                        <TextInput.Icon
                          name={() => <MaterialCommunityIcons name={isPasswordSecure ? "eye-off" : "eye"} size={28} color={COLORS.black} />} // where <Icon /> is any component from vector-icons or anything else
                          onPress={() => { isPasswordSecure ? setIsPasswordSecure(false) : setIsPasswordSecure(true) }}
                        />
                      }
                      fontFamily={FONTS.ROBOTO_REGULAR}
                      fontSize={Theme.FONT_18PX}
                      selectionColor={COLORS.orange}
                      underlineColor={COLORS.orange}
                      label={StringsConstants.Password}
                      value={password}
                      onChangeText={text => setPassword(text)}
                      underlineColorAndroid="transparent"
                      theme={{ colors: { text: COLORS.black, primary: COLORS.orange, placeholder: COLORS.black } }}
                    />
</View>

I hope it will help you!

about 4 years ago · Juan Pablo Isaza Relatório

0

you can put it and style it like this

<View>
<TextInput placeholder='Enter your Password' autoCorrect={false} secureTextEntry={true} textContentType='password' />
<EyeIconOrImage style={{
position: 'absolute',
right: 20,
}} />
</View>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda