Skip to content

Android 0.86: TextAttributeProps lineHeight ignores maxFontSizeMultiplier (downstream report for #58982) #59022

Closed as duplicate

Description

@sammydynamo-dev

Description

React Native 0.86.0 Android TextAttributeProps converts lineHeight with toPixelFromSP(value) while fontSize passes maxFontSizeMultiplier. This makes capped Text line spacing continue to grow on Android. iOS and Android TextInput already apply the cap.

Related: #56578, #58124, and the existing open fix #58982. This downstream report records the separate lineHeight-only candidate requested by our app owner; #58982 appears to cover the same cap defect and should be preferred over duplicate implementation work.

Reproduction

On Android API 33 (linear font scaling), compare font scale 1.0 and 2.0:

<Text maxFontSizeMultiplier={1.35} style={{fontSize: 26, lineHeight: 33}}>
  First line{'\n'}Second line
</Text>

At 2.0 the font is capped at 35.1 dp but lineHeight becomes 66 dp rather than the capped 44.55 dp. On API 34+ account for nonlinear SP conversion before applying the cap. Expected: cap both fontSize and lineHeight. No crash logs.

Candidate Kotlin patch

Prepared against RN 0.86.0; not Gradle-tested in this session. Regression cases should cover fromReadableMap/fromMapBuffer, cap updates, uncapped/zero cap, allowFontScaling=false, and nonlinear font conversion. Existing PR #58982 has broader test coverage.

diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt
--- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt
+++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt
@@ -39,7 +39,8 @@
           if (value == ReactConstants.UNSET.toFloat()) {
             Float.NaN
           } else {
-            if (allowFontScaling) toPixelFromSP(value) else toPixelFromDIP(value)
+            if (allowFontScaling) toPixelFromSP(value, maxFontSizeMultiplier)
+            else toPixelFromDIP(value)
           }
     }
 

The companion last-line descent report includes our proposed CustomLineHeightSpanTest.kt; those tests cover descent geometry, not this independent cap defect.

Activity

  1. react-native-bot commented on Oct 13, 2026

    @react-native-bot
    Collaborator

    Warning

    Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:


    You can read more about about it on our website: How to report a bug.

  2. sammydynamo-dev commented on Oct 13, 2026

    @sammydynamo-dev
    Author

    Closing this as a duplicate of #56578.

    As the report itself notes, the open PR #58982 already addresses lineHeight (and letterSpacing) ignoring maxFontSizeMultiplier on Android, so a separate issue adds nothing. The patch sketch above was never built or tested; please disregard it in favour of #58982.

    Apologies for the noise.

    (Posted by an AI coding agent on behalf of the account owner.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions