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.

selectTextOnFocus does not work with multiline text inputs iOS

See original GitHub issue

A multiline textinput with selectTextOnFocus={true} selects the text on focus, and then instantly unselects the text.

For an example repro, this code from RNTester will demonstrate the issue:

<TextInput
  placeholder="text is selected on focus"
  defaultValue="text is selected on focus"
  selectTextOnFocus={true}
  multiline={true}
/>

You can find this in the TextInput example page in RNTester on iOS as well. textinputfocus

React Native version: 0.61.4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kelsyvghncommented, May 19, 2020

Awesome, I’d love to take it.

On May 18, 2020, at 6:41 PM, Eli White notifications@github.com wrote:

Hi @kelsyvghn https://github.com/kelsyvghn, yeah, I think this is a good first issue for someone wanting to get familiar with React Native internals. It looks like something is blurring or taking focus from the React Native text input control. This will probably require setting some breakpoints in the Objc code and trying to figure out what is happening.

I think this is where it is selecting all of the text, but I’m not sure what is taking the focus away. https://github.com/facebook/react-native/blob/c8ed2dbbb287deed05a8782fb8665c1edf45bbac/Libraries/Text/TextInput/RCTBaseTextInputView.m#L330-L332 https://github.com/facebook/react-native/blob/c8ed2dbbb287deed05a8782fb8665c1edf45bbac/Libraries/Text/TextInput/RCTBaseTextInputView.m#L330-L332 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/27253#issuecomment-630524948, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANX3PSM3EKXHIJZ55TWPL4DRSHPWFANCNFSM4JO3ERVA.

0reactions
TheSaviorcommented, Sep 1, 2020

Thanks for the comments all! I’m glad this is resolved, I’ll close it out!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select text on focus does not work for multiline textInputs
The text inside my multiline textInput is not being selected even though 'selectTextOnFocus' is set to true. I know that the text will...
Read more >
TextInput · React Native
A foundational component for inputting text into the app via a keyboard. Props provide configurability ... If true, the text input can be...
Read more >
TextInput - React Native Archive
Determines the types of data converted to clickable URLs in the text input. Only valid if multiline={true} and editable={false} . By default no...
Read more >
React Native Text Input Component - GeeksforGeeks
maxLength: It is used when we do not want to exceed the particular number of characters. So we provide a fixed maximum length...
Read more >
iOS : React Native multi line TextInput, text is centered
iOS : React Native multi line TextInput, text is centered [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] iOS : React ...
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