From f15985f4f02fb32581f1d1f50bdaf64b1b5c0e66 Mon Sep 17 00:00:00 2001 From: Devan Buggay Date: Tue, 13 Jan 2026 16:09:38 -0800 Subject: [PATCH] Compile out UIFontTextStyleLargeTitle Summary: UIFontTextStyleLargeTitle is unavailable on AppleTV https://developer.apple.com/documentation/uikit/uifont/textstyle/largetitle?changes=_4 Changelog: [Internal] Reviewed By: javache Differential Revision: D90514242 fbshipit-source-id: 3fafbe513b52d5e733df336c401f2e76268496ea --- .../Libraries/Text/Text/RCTDynamicTypeRamp.mm | 9 ++++++--- .../renderer/textlayoutmanager/RCTAttributedTextUtils.mm | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm b/packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm index c28eada58e6..a3fe8e1e2b3 100644 --- a/packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm +++ b/packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm @@ -34,7 +34,7 @@ UIFontMetrics *RCTUIFontMetricsForDynamicTypeRamp(RCTDynamicTypeRamp dynamicType static NSDictionary *mapping; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - mapping = @{ + NSMutableDictionary *mutableMapping = [@{ @(RCTDynamicTypeRampCaption2) : UIFontTextStyleCaption2, @(RCTDynamicTypeRampCaption1) : UIFontTextStyleCaption1, @(RCTDynamicTypeRampFootnote) : UIFontTextStyleFootnote, @@ -45,8 +45,11 @@ UIFontMetrics *RCTUIFontMetricsForDynamicTypeRamp(RCTDynamicTypeRamp dynamicType @(RCTDynamicTypeRampTitle3) : UIFontTextStyleTitle3, @(RCTDynamicTypeRampTitle2) : UIFontTextStyleTitle2, @(RCTDynamicTypeRampTitle1) : UIFontTextStyleTitle1, - @(RCTDynamicTypeRampLargeTitle) : UIFontTextStyleLargeTitle, - }; + } mutableCopy]; +#if !TARGET_OS_TV + mutableMapping[@(RCTDynamicTypeRampLargeTitle)] = UIFontTextStyleLargeTitle; +#endif + mapping = [mutableMapping copy]; }); id textStyle = 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 520a24c28f7..f96a0494000 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 @@ -60,7 +60,12 @@ inline static UIFontTextStyle RCTUIFontTextStyleForDynamicTypeRamp(const Dynamic case DynamicTypeRamp::Title1: return UIFontTextStyleTitle1; case DynamicTypeRamp::LargeTitle: +// UIFontTextStyleLargeTitle is not available on tvOS. +#if !TARGET_OS_TV return UIFontTextStyleLargeTitle; +#else + return UIFontTextStyleTitle1; +#endif } }