未聚焦时更改边框线颜色(react-native-paper)

时间:2021-03-24 10:24:57

标签: javascript react-native react-native-paper

我有一个文本输入,它在聚焦时会在满足或不满足条件时改变颜色(绿色到棕色,反之亦然)。

即使输入未聚焦,我也希望颜色保持不变。

专注和验证不正确:

Focused and verifications not ok

专注和验证没问题:

Focused and verifications ok

非重点验证可以与否:

Unfocused verifications okay or not

我的代码:

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

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

我试图改变:

  • underlineColor 道具。
  • borderColor、backgroundColor、样式中的颜色,但目前没有任何效果。

0 个答案:

没有答案