Javascript TextInput颜色在React Native中仅更新一次

Javascript TextInput颜色在React Native中仅更新一次,javascript,reactjs,react-native,Javascript,Reactjs,React Native,我试图在react native中更新TextInput的颜色,但当我从色样中选择颜色时,TextInput颜色只更新一次,当我再次从色样中选择新颜色时,它不再更新。但是相反,当我更新视图的背景色时,它总是更新。我在下面添加了我的代码 formConfig.color是提供文本输入颜色的状态对象 <View style={[ styles.editor, {backgroundColor: formConfig.backgroundColor}, ]}> <TextIn

我试图在react native中更新TextInput的
颜色
,但当我从色样中选择颜色时,TextInput颜色只更新一次,当我再次从色样中选择新颜色时,它不再更新。但是相反,当我更新
视图的背景色时,它总是更新。我在下面添加了我的代码

formConfig.color
是提供文本输入颜色的状态对象

<View style={[
  styles.editor,
  {backgroundColor: formConfig.backgroundColor},
]}>
<TextInput
   style={[
     styles.createUserContent,
     {
        backgroundColor: 'transparent',
        color: formConfig.color,
     },
   ]}
   placeholder={"What's your name?"}
   multiline
   textAlign={'left'}
/>
</View>
这是将颜色更新为状态对象的代码。当用户单击与样例不同的颜色时,我会设置新颜色

_handleFormConfig = (key, value) => {
  this.setState(prevState => {
     return {
       ...prevState,
       formConfig: {
        ...prevState.formConfig,
        [key]: value,
      },
    };
  });
};
组件状态:

constructor() {
  this.state = {
     formConfig: {
       backgroundColor: '#ffffff',
       color: '#000000',
     },
  };
}
自定义颜色数组:

export const paintTextColors = [
  '#f44336',
  '#e91e63',
  '#9c27b0',
  '#673ab7',
];

我尝试了你的代码,效果很好,你在这里遗漏了什么?对我来说,它没有更新
TextInput
颜色。
export const paintTextColors = [
  '#f44336',
  '#e91e63',
  '#9c27b0',
  '#673ab7',
];