Fix Android inline Text views with small font scale#57132
Open
TorinAsakura wants to merge 1 commit into
Open
Conversation
cipolleschi
reviewed
Jun 9, 2026
cipolleschi
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution
cipolleschi
approved these changes
Jun 9, 2026
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D108030457. |
cortinico
requested changes
Jun 9, 2026
cortinico
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withPixelUtil.toPixelFromSP(...), so a device font scale below 1.0 shrank the inline view placeholder width. In the #50916 RNTester reproducer, a measuredRow cutoffattachment around 155px became about 132px atfont_scale=0.85, clipping the rendered text toRow.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:
./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests com.facebook.react.views.text.TextLayoutManagerInlineViewSizeTest -Preact.internal.useHermesNightly=false./gradlew :packages:rn-tester:android:app:assembleDebug -Preact.internal.useHermesNightly=false -PreactNativeArchitectures=arm64-v8afont_scale=0.85, applied the Reproduction for issue 50916 #50915 Playground reproducer locally, and verified the middle row renders fullRow cutoffinstead of clipping toRow. Fixed screenshot captured locally at/tmp/rn50916-fixed-small.png.