How to change the textColor of TextInput in react native dynamically? -
hi guys want change textcolor of input dynamically. example in css placed color:'#fff',then want change text color whenever need '#ddd'.
you can use ternary operator
check condition. has following format: (test conditon) ? true statement: false statement
based on that, can set <textinput>
color
this:
<textinput style={[styles.input, (this.state.username ? styles.inputhighlight : null)]} //replace condition />
and add style stylesheet:
var styles = stylesheet.create({ input: { //other styles color:'#fff' }, inputhighlight: { color:'#ddd' } });
Comments
Post a Comment