2

I'm having an issue when I try to custom my TextInput whereas the placeholder will have normal fontWeight and the textinput will be bold.

This is my code for that:

<TextInput
    placeholder={'Input'}
    style={{ width: '100%', fontWeight: this.state.text.length > 0 ? 'bold' : 'normal' }}
    value={this.state.text}
    onChangeText={(text) => {
           this.setState({
                 text,
             });
       }}
/>

My issue is: Firstly, placeholder have normal fontWeight, i entered some randomly input and then delete all of it, the placeholder style is not change back to normal but still be bold.

enter image description here

4

0 回答 0