How to Know When the Focus Is Lost in a React Native textInput?
For Example I Want to Do an Action When the User Touches Outside the textInput and It Loses Focus. 0 3 Answers Use the onBlur Prop on Textinput Example...
How to know when the focus is lost in a react native textInput?
For example I want to do an action when the user touches outside the textInput and it loses focus.
3 Answers
use the onBlur prop on TextInput
example
<TextInput
onFocus={() =>console.log("focus received" ) }
onBlur={() => console.log("focus lost") } />
The prop you are looking for is the onBlur. This is called when it loses focus.
You need to use the onBlur prop on TextInput.
example
onBlurMethod = () =>{
//what you want to do when it is not focused
}
<TextInput
onBlur = {this.onBlurMethod}
/>