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

196
Visualizações
How to change the border color of textinputs when typing in React Native

I have a TextInput in react native like this:

<SafeAreaView style={ChatWindowStyles.bottomAreaViewStyles}>
  <TextInput
    className="userMessageInput"
    style={ChatWindowStyles.messageTextInputStyles}
    placeholder="Enter a message"
    onChangeText={(text) => userMessage = (text)}
                
  />
</SafeAreaView> 

I want the border color to be blue when I am typing something in the TextInput. How can I do that?

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

0

import React, { useState } from 'react'
import { SafeAreaView, View, TextInput, Text } from 'react-native'


export default function Example() {

    const [value, setValue] = useState('')
    const [isTextInputFocused, setTextInputFocused] = useState(false)

    return (
        <SafeAreaView style={{ flex: 1 }}>
            <View style={{ flex: 1, justifyContent: 'center', }}>
                <TextInput
                    value={value}
                    onChangeText={value => setValue(value)}
                    style={{ height: 60, width: '90%', marginLeft: '5%', borderColor: isTextInputFocused == true ? 'blue' : 'black', borderWidth: 1, borderRadius: 10, paddingLeft: 10 }}
                    placeholder='Enter text'
                    onFocus={() => setTextInputFocused(true)}
                    onSubmitEditing={() => setTextInputFocused(false)}
                    onEndEditing={() => setTextInputFocused(false)}
                />
            </View>
        </SafeAreaView>
    )
}
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