Commit No Bug
Published on

How I Fixed Font Scaling in React Native

Authors
Abstract landscape blog header showing a horizontal mobile UI with geometric typography bars of different heights, arrows indicating font scaling correction, and a responsive grid background—no readable text.

The Problem

At some point, I opened my Voice Timer app with font size and font scale both set to maximum. It looked terrible. Text was overflowing, buttons were cramped, and some text was partially "eaten" or clipped.

The settings are easy to forget about. I suppose that by default, most developers test at the default system settings, and the app looks fine. But real users change these - often users who need them, which makes it worse to get wrong.

The Two Extremes

When I was fixing all accessibility problems described above, I concluded that I need to think in terms of two extremes, not one.

Your layout needs to survive:

  • Maximum font size and scale - everything is large, the user needs it to be readable
  • Minimum font size and scale - everything is small, the layout should still make sense

If it works at both ends, everything in between will most likely be fine. Testing every combination is not practical - the extremes are where real issues show up.

The Simple Fix

Trying to fix the issue, I concluded to reduce my base font size.

If your base size is already big enough, scaling it up further by system settings pushes it past what the layout can hold. Bring it down to a more conservative base, and the scaled-up version is still readable without breaking everything around it.

That adjustment alone fixes most of the issues.

You Can Improve It Further - Reducing the Base Size Often Isn't Enough

A few things that help for specific problem spots:

maxFontSizeMultiplier - caps how much a Text component will scale. Use it on elements where overflow is not an option, like a tab bar label.

<Text maxFontSizeMultiplier={1.3}>Settings</Text>
The 'maxFontSizeMultiplier' property may not work on some React Native versions.

Some elements need to stay large enough at the default scale - you do not want to shrink them just to survive maximum scale. For those, you can keep the font size where you want it and use maxFontSizeMultiplier to cap how far it grows.

allowFontScaling={false} - disables scaling entirely for that element. Use sparingly - only where scaling would break functionally, not just aesthetics.

Flexbox instead of fixed heights - if a container has a hardcoded height, text will overflow it at large scales. Let it grow with flex or remove the fixed height where possible.

Conclusion

The goal is not pixel-perfect at every scale. At maximum settings, things will reflow and look different - that is expected. The goal is usable: nothing overlaps, nothing gets cut off, every interactive element is still reachable.

Test at both extremes. Adjust your base sizes first. Reach for the advanced tools only where you actually need them.

Found this helpful? Please share it with someone who also might find it helpful. Would you like more posts from me? Subscribe to the newsletter. Got questions? Send an email to commitnobug@outlook.com.