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.

[TextInput]How to get content height when TextInput has a defaultValue

See original GitHub issue

I want to write a auto grow text input, i know onChange will pass contentSize in event.nativeEvent

<TextInput
  onChange={event => {
      event.nativeEvent.contentSize.height
  }}
/>

but if input has a defaultValue, how to get the content height?

sorry for my english…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Andreycocommented, Jun 22, 2016

Actually, onLayout is not triggered for TextInput. Doing more testing, but first findings are negative…

0reactions
ghostcommented, Jun 23, 2016

Hey @musicode and thanks for posting this! @damusnet tells me this issue looks like a question that would be best asked on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on SO.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native - TextInput - How to use value & defaultValue ...
Finally solved it,. The key is the following - "value" has preceding over "defaultValue" unless "value" is undefined!
Read more >
TextInput
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, ...
Read more >
How to make an automatic increase in the width of the text ...
Coding example for the question How to make an automatic increase in the width of the text input field depending on the number...
Read more >
TextInput · React Native Paper
A component to allow users to input text. ... Whether the input can have multiple lines. ... When height is passed, dense prop...
Read more >
Text Input — Kivy 2.1.0 documentation
You can get the currently selected text from the TextInput.selection_text property. ... The previous default value False has been changed to True ....
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