Answers for "React Native TextInput losing focus after each character"

0

React Native TextInput losing focus after each character

its happen beacuse when we type at that time our state get changed due to that 
our jsx get render and 
that mens our TextInput also reRender so that why its loosing focus 

one more thing it also happens when  we use our componet out side form the return 

and call the input as jsx function like this

const MyINPUT=()=>(

<TextInput
 '''''
 .....
  .....
 />
)


return (
<View>
  <MyINPUT/>
 </View>
)

to resolve that there are  diff methods you can try base on your code

1: one is use autofocus=true in TextInput
2: another is use onBlur method
3: or create a button on click save the input text 
4: or try to use class componet
Posted by: Guest on May-28-2021

Code answers related to "React Native TextInput losing focus after each character"

Code answers related to "Javascript"

Browse Popular Code Answers by Language