[英]Changing textColor of <TextInput/> in ReactNative
我希望在android react native應用中更改文本Color和占位符textcolor:
render: function() {
return (
<View>
<TextInput
placeholder='Add Credit'
placeholderTextColor='ffffff'
textAlign='center'
/>
</View>
);
},
var styles = StyleSheet.create({
creditInput: {
backgroundColor: "#3f51b5",
color: "#ffffff", //Expecting this to change input text color
},
(參考: https : //facebook.github.io/react-native/docs/textinput.html#content )
placeholderTextColor
和backgroundColor
會按預期更改,但不會更改輸入文本顏色。 我使用了錯誤的屬性,還是這是react-native / android錯誤?
我可以確認它可以在iOS上運行,而不能在Android上運行(至少對於React Native 0.14.2)。
該問題是幾天前提交的(請參閱https://github.com/facebook/react-native/issues/3742 )。
它應該是固定的,但只能在最新的預發行版本(v0.15.0-rc)中。
將您的樣式添加到TextInput組件中,我猜它會起作用!
render: function() {
return (
<View>
<TextInput
style={styles.creditInput}
placeholder='Add Credit'
placeholderTextColor='ffffff'
textAlign='center'
/>
</View>
);
},
var styles = StyleSheet.create({
creditInput: {
backgroundColor: "#3f51b5",
color: "#ffffff", //Expecting this to change input text color
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.