0

输入的占位符是绿色的,但我也想让绿色文本输入(当我输入文本文本颜色显示黑色时,在我的UI中不可见)。我怎样才能让它变成绿色?如何更改原始文本输入的文本颜色?

+1

请提供一些代码以显示您到目前为止所尝试的内容。检查[如何问](https://stackoverflow.com/help/how-to-ask)来了解如何提出一个好问题。检查如何自定义输入的'TextInput'的[style prop](https://facebook.github.io/react-native/docs/textinput.html#style)。 – bennygenel

+0

是你的问题解决? –

+0

您是否使用本地基地? – wlisrausr

回答

1

如果要更改TextInput颜色,请在样式中添加颜色

下面

的例子给你的TextInput颜色为蓝色:

export default class UselessTextInput extends Component { 
    constructor(props) { 
    super(props); 
    this.state = { text: 'Useless Placeholder' }; 
    } 

    render() { 
    return (
     <TextInput 
     style= 
     {{ 
      height: 40, borderColor: 'gray', borderWidth: 1, color : "blue" 
     }} 
     onChangeText={(text) => this.setState({text})} 
     value={this.state.text} 
     /> 
    ); 
    } 
} 
0

TextInput样式添加color: 'green';会改变颜色

<TextInput style={styles.textInput} /> 

const styles = StyleSheet.create({ 
textInput: { 
    color: 'green', 
}, 
});` 

native-base你将需要照顾也主题see docs

+0

我试过了。它不工作。颜色仍然是黑色的。 – Syuzanna

+0

你是否改变了主题颜色? –

+0

刚开始工作。谢谢。 – Syuzanna