react-textfit
react-textfit copied to clipboard
Compatibility with flexbox
This library just does not work with flex box containers:
export default function Comp() {
return (
<div style={{display: 'flex'}}><Textfit mode='single'>This will not resize.</Textfit></div>
)
}
It would be nice if it worked correctly with flex box, or if the repo at least warned that it does not work with flex box.
I can try to make it work with flex box and submit a pull request if someone can confirm it is a feature that the maintainers would like added.
This can easily be worked around by wrapping the <Textfit>
in a <div>
that is not display: 'flex'
. But, I did waste some time trying to figure out why my text wasn't resizing, and I would imagine future users will have the same problem.
Are you sure it doesn't work with flexbox? It seems to work for me
It works if you define the height/width of the element that the text is in.