From 5e288d0cd479086647bae476861ace73301c12db Mon Sep 17 00:00:00 2001 From: Melissa Liu Date: Thu, 12 Sep 2024 19:17:23 -0700 Subject: [PATCH] fix for bottom adjustment (#46475) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46475 fm.top is negative, so we want to add in order to decrease the absolute value, but fm.bottom is positive, so we need to subtract instead here Changelog: [internal] Reviewed By: NickGerleman Differential Revision: D62612192 fbshipit-source-id: fc942abcb5a1ddedd6547aca66a188736e4ec029 --- .../react/views/text/internal/span/CustomLineHeightSpan.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLineHeightSpan.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLineHeightSpan.kt index 3eeb3abc3e7..ca2695e44ab 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLineHeightSpan.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLineHeightSpan.kt @@ -53,11 +53,11 @@ public class CustomLineHeightSpan(height: Float) : LineHeightSpan, ReactSpan { // Adjust fm.top and fm.bottom fm.top += topReduction - fm.bottom += bottomReduction + fm.bottom -= bottomReduction // If there's a remainder, put it on the top val remainder = excess - (topReduction + bottomReduction) - fm.top += remainder + fm.top -= remainder } else { // Show proportionally additional ascent / top & descent / bottom val additional = lineHeight - (-fm.top + fm.bottom)