Fix Android inline Text views with small font scale#57132
Conversation
cipolleschi
left a comment
There was a problem hiding this comment.
Thanks for the contribution
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D108030457. |
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Hi! I see the exported changes requested review from Phabricator, but there are no public review threads or actionable comments visible on GitHub. Is there anything I should change on my side, or is the PR only blocked by internal Meta checks? |
Yes I've asked @cipolleschi to do one change + can you add one test case for this inside RNTester? Specifically it would be gold if you could provide before/after screenshots of that test case inside RNTester for reference. Thank you |
Added the RNTester case under Text > Inline view with small font scale. Change: 9d2f6d8 Also updated the PR body with proofs. |


Summary:
Fixes #50916.
Closes torin-asakura/workspace#126.
Android inline views inside Text receive their measured layout size from Fabric as layout units/DIP. TextLayoutManager was converting those attachment dimensions with PixelUtil.toPixelFromSP(...), so a device font scale below 1.0 shrank the inline view placeholder width. In the #50916 RNTester reproducer, a measured Row cutoff attachment around 155px became about 132px at font_scale=0.85, clipping the rendered text to Row.
This changes inline text attachment dimensions to use DIP conversion and rounds them up to the pixel grid in both spannable construction paths.
Changelog:
[ANDROID] [FIXED] - Keep inline views inside Text from shrinking with Android system font scale
Test Plan:
Installed RNTester on an Android API 36 arm64 emulator, set font_scale=0.85, and checked Text > Inline view with small font scale.
Visual evidence:
Before
After