Font size is way too big until I resize the window
spaceghostu opened this issue · 6 comments
As the title says, the font size is way too big until I resize the window.
react@15.4.1
react-textfit@0.1.8
I am also facing same issue.
react@15.4.2
react-textfit@0.1.9
Is there any workaround atleast till final fix for this issue?
It could be that some of your other components or styles are delayed and are not applied at the moment we mount the TextFit
component, thus we compute the values incorrectly. Notice that the demo works correctly without resizing the window.
You can try and show a minimal reproduction case with the help of jsfiddle.net, or you can try and find what delays correct styling in your app, and trigger a resize
event on the window
yourself, once the app settles in and we can compute the correct dimensions.
By all means, do tell in this issue if you have new information.
trigger a resize event on the window yourself, once the app settles in and we can compute the correct dimensions.
Triggering a resize
event on the window can have side-effects we don't want - for instance, I could have several components with Textfit and want to resize only one of them.
Did you consider adding a way to manually force the recomputation of the text size?
Textfit is idempotent, so it does not matter if other component resize as well.
If there’s a use case for it, we may add the feature. However, I would rather identify the use cases and solve them so that it works out of the box, without manual method calling.
Sorry, what I meant is that there can be performance hits if other components also act on the window resize event.
If you have a performance problem with resize, I think that’s what you might focus on. Consider what happens when user resizes their window. I don’t think this use case warrants our further attention, I’m sorry. :-(