I want to change the font size of the text that we are entering in textInput only when the charLength more then 6.
the actual font size is 80px, when changing it should be 40 or something like less then it
thanks in advance
I want to change the font size of the text that we are entering in textInput only when the charLength more then 6.
the actual font size is 80px, when changing it should be 40 or something like less then it
thanks in advance
You can give conditional style to the TextInput component.
Example
_onChangeText(text) {
this.setState({ fontSize: text.length > 6 ? 40 : 80 });
}
render() {
return (
// Giving an array of objects to style property can help you to define a -- default value
<TextInput
onChangeText={this._onChangeText.bind(this)}
style={[ {fontSize: 80}, {fontSize: this.state.fontSize} ]}
/>
)
}