Tengo un TextInput en reaccionar nativo como este:
<SafeAreaView style={ChatWindowStyles.bottomAreaViewStyles}> <TextInput className="userMessageInput" style={ChatWindowStyles.messageTextInputStyles} placeholder="Enter a message" onChangeText={(text) => userMessage = (text)} /> </SafeAreaView>Quiero que el color del borde sea azul cuando escribo algo en TextInput. ¿Cómo puedo hacer eso?
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> ) } 