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