There is a TextInput, and a cancel button, how to make it so that when you click on a button, the focus is removed from the textInput?

  • As far as I remember, the focus event works when focusing on the field, and blur when the focus disappears, for example, the visitor clicks on another place on the screen. - And

1 answer 1

I decided:

 <TextInput ref='searchInput' /> 

Button event:

 onPress={(event) => { this.refs.searchInput.blur() this.refs.searchInput.setNativeProps({text: ''}) }}