Incorrect initial height when font-size isn't the initial value
See original GitHub issueI’d like to create textarea
s with two different font-size
.
The problem is fixed after typing something.
Apply _resizeComponent()
with setTimeout
inside componentDidMount
fixes de problem but I don’t now if this is the best solution:
_proto.componentDidMount = function componentDidMount() {
[...]
setTimeout(() => this._resizeComponent())
[...]
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Line height default value if font size is 100% - Stack Overflow
Depends on the user agent. Desktop browsers (including Firefox) use a default value of roughly 1.2 , depending on the element's font-family ....
Read more >Deep dive CSS: font metrics, line-height and vertical-align
An introduction to the inline formatting context. Explores line-height and vertical-align properties, as well as the font metrics. Understand how text is ...
Read more >font-size - CSS: Cascading Style Sheets - MDN Web Docs
The font-size CSS property sets the size of the font. Changing the font size also updates the sizes of the font size-relative <length>...
Read more >px - em - % - pt - keyword | CSS-Tricks
Em's aren't just for fonts, it's a unit of measure that you can use for any other length (height, width, etc). Elastic width...
Read more >How to Change Font Size in CSS - HubSpot Blog
There are several values you can use to define the font-size property. ... Note that in HTML the default font size is 16...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That is because aphrodite does not inject styles immediately but rather it uses some kind of scheduling - https://github.com/Khan/aphrodite/blob/62ee2f0a39f10be75322dc0f77d1346e9731ffbf/src/inject.js#L163-L178
We cannot work around this in here, the timing of the injection is nondeterministic - you have to find hacky way to solve this for your case. Maybe you can call
flushToStyleTag
in some react hook before Textarea’scomponentDidMount
gets called? You probably would have to do smth likebecause
css
call is actually queuing the style insertion.No problem, going to close the issue as solved 😃