How I can make the font size of the text auto change inside a view in react native?
I have text with different lengths, some of which doesn\'t fit the view so decrea
A bit improved Jeffy Lee code worked for me
const AdjustLabel = ({
fontSize, text, style, numberOfLines
}) => {
const [currentFont, setCurrentFont] = useState(fontSize);
return (
{
const { lines } = e.nativeEvent;
if (lines.length > numberOfLines) {
setCurrentFont(currentFont - 1);
}
} }
>
{ text }
);
};