Skip to content

Commit

Permalink
Merge pull request facebook#1453 from amgleitman/0.68-dynamic-type-re…
Browse files Browse the repository at this point in the history
…names

[0.68-stable] A couple of renames to make Dynamic Type features more proper
  • Loading branch information
amgleitman authored Oct 17, 2022
2 parents 5d3a4e3 + 6a155f3 commit a33466c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Libraries/Text/RCTTextAttributes.m
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ - (CGFloat)effectiveFontSizeMultiplier
#if !TARGET_OS_OSX // [TODO(macOS GH#774)
if (_dynamicTypeRamp != RCTDynamicTypeRampUndefined) {
UIFontMetrics *fontMetrics = RCTUIFontMetricsForDynamicTypeRamp(_dynamicTypeRamp);
CGFloat baseSize = RCTUIBaseSizeForDynamicTypeRamp(_dynamicTypeRamp);
CGFloat baseSize = RCTBaseSizeForDynamicTypeRamp(_dynamicTypeRamp);
fontSizeMultiplier = [fontMetrics scaledValueForValue:baseSize] / baseSize;
}
#endif // ]TODO(macOS GH#774)
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Text/Text/RCTDynamicTypeRamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef NS_ENUM(NSInteger, RCTDynamicTypeRamp) {
RCTDynamicTypeRampCaption2,
RCTDynamicTypeRampCaption1,
RCTDynamicTypeRampFootnote,
RCTDynamicTypeRampSubhead,
RCTDynamicTypeRampSubheadline,
RCTDynamicTypeRampCallout,
RCTDynamicTypeRampBody,
RCTDynamicTypeRampHeadline,
Expand All @@ -36,5 +36,5 @@ typedef NS_ENUM(NSInteger, RCTDynamicTypeRamp) {
/// Generates a `UIFontMetrics` instance representing a particular Dynamic Type ramp.
UIFontMetrics * _Nonnull RCTUIFontMetricsForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp);
/// The "reference" size for a particular font scale ramp, equal to a text element's size under default text size settings.
CGFloat RCTUIBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp);
CGFloat RCTBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp);
#endif // ]TODO(macOS GH#774)
8 changes: 4 additions & 4 deletions Libraries/Text/Text/RCTDynamicTypeRamp.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ @implementation RCTConvert (DynamicTypeRamp)
@"caption2": @(RCTDynamicTypeRampCaption2),
@"caption1": @(RCTDynamicTypeRampCaption1),
@"footnote": @(RCTDynamicTypeRampFootnote),
@"subhead": @(RCTDynamicTypeRampSubhead),
@"subheadline": @(RCTDynamicTypeRampSubheadline),
@"callout": @(RCTDynamicTypeRampCallout),
@"body": @(RCTDynamicTypeRampBody),
@"headline": @(RCTDynamicTypeRampHeadline),
Expand All @@ -36,7 +36,7 @@ @implementation RCTConvert (DynamicTypeRamp)
@(RCTDynamicTypeRampCaption2): UIFontTextStyleCaption2,
@(RCTDynamicTypeRampCaption1): UIFontTextStyleCaption1,
@(RCTDynamicTypeRampFootnote): UIFontTextStyleFootnote,
@(RCTDynamicTypeRampSubhead): UIFontTextStyleSubheadline,
@(RCTDynamicTypeRampSubheadline): UIFontTextStyleSubheadline,
@(RCTDynamicTypeRampCallout): UIFontTextStyleCallout,
@(RCTDynamicTypeRampBody): UIFontTextStyleBody,
@(RCTDynamicTypeRampHeadline): UIFontTextStyleHeadline,
Expand All @@ -51,7 +51,7 @@ @implementation RCTConvert (DynamicTypeRamp)
return [UIFontMetrics metricsForTextStyle:textStyle];
}

CGFloat RCTUIBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp) {
CGFloat RCTBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp) {
static NSDictionary<NSNumber *, NSNumber *> *mapping;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Expand All @@ -60,7 +60,7 @@ CGFloat RCTUIBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp) {
@(RCTDynamicTypeRampCaption2): @11,
@(RCTDynamicTypeRampCaption1): @12,
@(RCTDynamicTypeRampFootnote): @13,
@(RCTDynamicTypeRampSubhead): @15,
@(RCTDynamicTypeRampSubheadline): @15,
@(RCTDynamicTypeRampCallout): @16,
@(RCTDynamicTypeRampBody): @17,
@(RCTDynamicTypeRampHeadline): @17,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Text/TextProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export type TextProps = $ReadOnly<{|
| 'caption2'
| 'caption1'
| 'footnote'
| 'subhead'
| 'subheadline'
| 'callout'
| 'body'
| 'headline'
Expand Down

0 comments on commit a33466c

Please sign in to comment.