From 176b1a6869c5d6e5255a620d94a9d4bcf3263db2 Mon Sep 17 00:00:00 2001 From: Fabrizio Bertoglio Date: Mon, 20 May 2024 18:24:20 +0800 Subject: [PATCH] reintroduce check #37465 https://github.com/facebook/react-native/pull/37465/files#diff-38333c03094e568d775af03727306a9e737fec7434e31f2f6e849f9663e48052R134-R139 --- .../renderer/textlayoutmanager/RCTAttributedTextUtils.mm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm index 74f5b65df1338d..048ce2d9026e89 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm @@ -235,9 +235,12 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex if (!isnan(textAttributes.lineHeight)) { CGFloat lineHeight = textAttributes.lineHeight * RCTEffectiveFontSizeMultiplierFromTextAttributes(textAttributes); - paragraphStyle.minimumLineHeight = lineHeight; - paragraphStyle.maximumLineHeight = lineHeight; - isParagraphStyleUsed = YES; + UIFont *font = RCTEffectiveFontFromTextAttributes(textAttributes); + if (lineHeight > font.lineHeight) { + paragraphStyle.minimumLineHeight = lineHeight; + paragraphStyle.maximumLineHeight = lineHeight; + isParagraphStyleUsed = YES; + } } if (isParagraphStyleUsed) {