constructor(props) {
super(props);
this.state= {
input: "",
}
}
_textChange = (text) => {
this.setState({
textValue: text,
// textEntered: true
})
console.log(this.state.textValue);
}
And:
<TextInput onChangeText={this._textChange}/>
I am able to print the text entered in TextInput
to console. But when I am deleting the text from TextInput
, then the first letter entered is still showing. I tried using clear(), but not able to do it. How do I clear this.state.input
when text is deleted from TextInput
.
CONSOLE
a
ab
abc
ab
a
As you can see, a
still shows in console, even when everything is deleted from TextInput
.