react-textfit icon indicating copy to clipboard operation
react-textfit copied to clipboard

Often "Freezes" at minimum size

Open brandonkal opened this issue 6 years ago • 8 comments

I use this with a Gatsby site. Often the font size will initially load at the minimum font size and it does not update.

brandonkal avatar Sep 23 '18 22:09 brandonkal

Did you find a fix?

sis-dk avatar May 02 '19 08:05 sis-dk

No I did not. I ended up implementing a component like this using CSS calc().

However, it is not perfect with SSR as the text will be streamed at minimum size in the HTML and stay that way until react hydrates.

brandonkal avatar May 02 '19 09:05 brandonkal

Try to use a parameter 'throttle' i.e 1000 milliseconds, it should calculate height with delay when text, styles, etc already fully loaded.

42x42x42 avatar Oct 29 '19 12:10 42x42x42

Same issue. @brandonkal would you be willing to share your CSS solution?

ceiphr avatar Jun 24 '21 20:06 ceiphr

same problem using nextjs. IU tried loading it dynamically but still it won't work.

koraysels avatar Sep 06 '21 14:09 koraysels

@ceiphr No longer using calc for other reasons but the idea is to figure out what size you want the text at different breakpoints and build an algebraic function to achieve that initial sizing as a function of view width.

brandonkal avatar Oct 05 '21 23:10 brandonkal

@ceiphr No longer using calc for other reasons but the idea is to figure out what size you want the text at different breakpoints and build an algebraic function to achieve that initial sizing as a function of view width.

Makes sense, thank you!

ceiphr avatar Oct 07 '21 13:10 ceiphr

i am still facing this issue is there any fix available?

Arnavop avatar May 28 '24 08:05 Arnavop