Closed AndreyMiloserdov closed 6 years ago
You're right, I've added this gotcha with workarounds to the readme.
I think this is a different issue than this ticket but when / if the "Rendered Font" used for the container changes, the size will also change but not trigger a re-calculation of the needed width. Something like this might be needed: https://stackoverflow.com/questions/5680013/how-to-be-notified-once-a-web-font-has-loaded
@cancan101 Also seeing this issue. Once the web font is rendered the placeholder will be slightly cut off as it's slightly wider than initial paint font.
Any idea for a quick fix?
I subscribed to the font loaded event and then called a repaint on the auto size component.
That's great! How does one call a repaint? New to React – would be thankful for an example :)
How do I call copyInputStyles()? I'm using react hooks now, can't use ref on AutosizeInput to call that function at all. I know I can set a key to trigger rerender, but how to call copyInputStyles () if I don't want to use key.
If you are created styles for input, and change it on fly, your sizer not update styles, so, where are no correct autoresize on change font size or family or others...
this.sizer node has only the initial props and not updates on input props updated.
hack to temporary solve this problem in code:
this.view.input.copyInputStyles(); this.view.input.updateInputWidth();