question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Focusing on TextInput programmatically doesn't start also editing with keyboard

See original GitHub issue

Hello

I have created a ref to TextInput as follows :

<TextInput
			ref={inputRef}
			style={styles.textInput}
			label='Update reason here..'
			value={reason}
			onChangeText={text => setReason(text)}
/>

and tried something like this :

const inputRef = useRef()
	
useEffect(()=>{
	console.log(inputRef.current)
	inputRef.current.focus()
},[])

But it just focuses the TextInput

studio64_K8OyuPrbOL

I need it also to show the keyboard like below instead of the user having to manuallytap on the TextInput in order for it to show the keyboard :

image

Your Environment

software version
ios or android 11
react-native 0.64
react-native-paper 4.12.0
node 16
npm or yarn 6.12
expo sdk 44
44

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
goxr3pluscommented, May 29, 2022

@lukewalczak Still not working with forceFocus … let me show you on the gif below

It just focuses the text but never showing the keyboard … I have to manually press again the text

studio64_Yxaj1H1F1L

0reactions
github-actions[bot]commented, Jul 14, 2022

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I set the focus (and display the keyboard) on my ...
Try this: EditText editText = (EditText) findViewById(R.id.myTextViewId); editText.requestFocus(); InputMethodManager imm = (InputMethodManager) ...
Read more >
HTMLElement.focus() - Web APIs | MDN
focus () method sets focus on the specified element, if it can be focused. The focused element is the element that will receive...
Read more >
Focusing: focus/blur - The Modern JavaScript Tutorial
An element receives the focus when the user either clicks on it or uses the Tab key on the keyboard. There's also an...
Read more >
TextInput - React Native
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, ...
Read more >
How to dismiss the keyboard for a TextField - Hacking with Swift
If you're supporting only iOS 15 and later, you can activate and dismiss the keyboard for a text field by focusing and unfocusing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found