'Change border line colors when unfocused (react-native-paper)

I have a textinput that changes color if the conditions are met or not (green to brown and vice versa) when it is focused.

I would like the colors to stay the same even when the input is unfocused.

Focused and verifications not ok:

Focused and verifications not ok

Focused and verifications ok:

Focused and verifications ok

Unfocused verifications okay or not:

Unfocused verifications okay or not

My code:

//Change brow to green, green to brown
const [inputColor, setInputColor] = useState("brown");

<TextInput
  //{...}
  theme={{
    colors: {
      primary: inputColor,
      underlineColor: inputColor,
    },
  }}
/>;

I tried to change:

  • underlineColor props.
  • borderColor, backgroundColor, color in styles, but nothing is working so far.


Solution 1:[1]

try underlineColor Type: string Inactive underline color of the input.

Solution 2:[2]

You can try to change the placeholder color theme={{ colors: { primary: 'blue', placeholder: 'blue', }, }}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eric
Solution 2 Patrik Vlk