Skip to content

Commit f15985f

Browse files
sbuggaymeta-codesync[bot]
authored andcommitted
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
1 parent 400a3b5 commit f15985f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

packages/react-native/Libraries/Text/Text/RCTDynamicTypeRamp.mm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ @implementation RCTConvert (DynamicTypeRamp)
3434
static NSDictionary<NSNumber *, UIFontTextStyle> *mapping;
3535
static dispatch_once_t onceToken;
3636
dispatch_once(&onceToken, ^{
37-
mapping = @{
37+
NSMutableDictionary<NSNumber *, UIFontTextStyle> *mutableMapping = [@{
3838
@(RCTDynamicTypeRampCaption2) : UIFontTextStyleCaption2,
3939
@(RCTDynamicTypeRampCaption1) : UIFontTextStyleCaption1,
4040
@(RCTDynamicTypeRampFootnote) : UIFontTextStyleFootnote,
@@ -45,8 +45,11 @@ @implementation RCTConvert (DynamicTypeRamp)
4545
@(RCTDynamicTypeRampTitle3) : UIFontTextStyleTitle3,
4646
@(RCTDynamicTypeRampTitle2) : UIFontTextStyleTitle2,
4747
@(RCTDynamicTypeRampTitle1) : UIFontTextStyleTitle1,
48-
@(RCTDynamicTypeRampLargeTitle) : UIFontTextStyleLargeTitle,
49-
};
48+
} mutableCopy];
49+
#if !TARGET_OS_TV
50+
mutableMapping[@(RCTDynamicTypeRampLargeTitle)] = UIFontTextStyleLargeTitle;
51+
#endif
52+
mapping = [mutableMapping copy];
5053
});
5154

5255
id textStyle =

packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ inline static UIFontTextStyle RCTUIFontTextStyleForDynamicTypeRamp(const Dynamic
6060
case DynamicTypeRamp::Title1:
6161
return UIFontTextStyleTitle1;
6262
case DynamicTypeRamp::LargeTitle:
63+
// UIFontTextStyleLargeTitle is not available on tvOS.
64+
#if !TARGET_OS_TV
6365
return UIFontTextStyleLargeTitle;
66+
#else
67+
return UIFontTextStyleTitle1;
68+
#endif
6469
}
6570
}
6671

0 commit comments

Comments
 (0)