diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.mm index 0f2fbe82b8f5..09ad2c43f9e5 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.mm @@ -8,6 +8,7 @@ #import "TextLayoutManager.h" #import "RCTTextLayoutManager.h" +#import #import #import @@ -53,10 +54,15 @@ const auto &attributedString = placeholderAttributedString ? *placeholderAttributedString : originalAttributedString; + // The native measurement depends only on the maximum width, and the result is clamped to the + // full constraints below, outside the cache, so the rest is left out of the key. + LayoutConstraints keyConstraints = layoutConstraints; + keyConstraints.minimumSize = Size{}; + keyConstraints.maximumSize.height = std::numeric_limits::infinity(); measurement = textMeasureCache_.get( {.attributedString = attributedString, .paragraphAttributes = paragraphAttributes, - .layoutConstraints = layoutConstraints, + .layoutConstraints = keyConstraints, .pointScaleFactor = layoutContext.pointScaleFactor}, [&]() { auto telemetry = TransactionTelemetry::threadLocalTelemetry();