我正在使用 React Native 创建一个 Android 应用程序,其中有一个表单。占位符甚至没有出现在 textInput 字段中,所以我想改变占位符的颜色,但我不知道该怎么做。文档提到了一些我不明白的方式。
这是代码:
<TextInput
secureTextEntry={secureTextEntry}
style={inputStyle}
placeholder={placeholder}
value={value}
onChangeText={onChangeText}
/>
inputStyle: {
color: '#000',
paddingRight: 5,
paddingLeft: 5,
fontSize: 18,
lineHeight: 23,
flex: 2,
}
我也试过:
<TextInput
placeholderTextColor="blue"
style={inputStyle}
placeholder={placeholder}
value={value}
onChangeText={onChangeText}
/>
和
inputStyle: {
color: '#000',
paddingRight: 5,
paddingLeft: 5,
fontSize: 18,
lineHeight: 23,
flex: 2,
placeholderTextColor: '#333'
}
原文由 Etherealm 发布,翻译遵循 CC BY-SA 4.0 许可协议
像这样: