Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

settimeout react native focus text input

const inputRef = useRef(null)

In onSubmitEditing prop, include this:

setTimeout(() => inputRef.current.focus(), 250);

Ex:

const onEnterKeyPressed = () => {
  	...
	setTimeout(() => inputRef.current.focus(), 100);	
   	...
}
<TextInput
	...
    onSubmitEditing={onEnterKeyPress}
	...
/>

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #settimeout #react #native #focus #text #input
ADD COMMENT
Topic
Name
1+7 =