malte-wessel/react-textfit

Font size doesn't update, when the height of the div is reduced.

Johannes5 opened this issue · 1 comments

Demo video:
https://www.loom.com/share/e1a54f0ee4ac4d6c93fedf24c100ec8d

When the text length changes from a length spanning multiple lines, to a smaller text requiring only one line, the font size doesn't update. It will keep its previous font size until the length of the incoming text spans more than one line and shifts the height of the div back to i's maxHeight.

the API is used like this
title={(<Textfit max={20}> {article.title} </Textfit>)}

it might be worth noting, that inserting
window.dispatchEvent(new CustomEvent('resize'));
(as suggested by @ShaMan123 in #82 )
into the component forces everything to be in one line