Skip to content

Commit

Permalink
Fix system font weight for large title (#689)
Browse files Browse the repository at this point in the history
The font weight of the large title didn't match exactly to other common large titles in ios preinstalled apps.
  • Loading branch information
glennreyes authored Nov 4, 2020
1 parent 77ef5f6 commit f8c8120
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ios/RNSScreenStackHeaderConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ + (void)setAnimatedConfig:(UIViewController *)vc withConfig:(RNSScreenStackHeade
if (config.largeTitleFontFamily) {
largeAttrs[NSFontAttributeName] = [RCTFont updateFont:nil withFamily:config.largeTitleFontFamily size:largeSize weight:nil style:nil variant:nil scaleMultiplier:1.0];
} else {
largeAttrs[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[largeSize floatValue]];
largeAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:[largeSize floatValue] weight:UIFontWeightBold];
}
[navbar setLargeTitleTextAttributes:largeAttrs];
}
Expand Down Expand Up @@ -277,7 +277,7 @@ + (UINavigationBarAppearance*)buildAppearance:(UIViewController *)vc withConfig:
} else {
[appearance configureWithOpaqueBackground];
}

// set background color if specified
if (config.backgroundColor) {
appearance.backgroundColor = config.backgroundColor;
Expand Down Expand Up @@ -318,7 +318,7 @@ + (UINavigationBarAppearance*)buildAppearance:(UIViewController *)vc withConfig:
if (config.largeTitleFontFamily) {
largeAttrs[NSFontAttributeName] = [RCTFont updateFont:nil withFamily:config.largeTitleFontFamily size:largeSize weight:nil style:nil variant:nil scaleMultiplier:1.0];
} else {
largeAttrs[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[largeSize floatValue]];
largeAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:[largeSize floatValue] weight:UIFontWeightBold];
}

appearance.largeTitleTextAttributes = largeAttrs;
Expand Down Expand Up @@ -371,7 +371,7 @@ + (void)updateViewController:(UIViewController *)vc withConfig:(RNSScreenStackHe
if (shouldHide) {
return;
}

if (config.direction == UISemanticContentAttributeForceLeftToRight || config.direction == UISemanticContentAttributeForceRightToLeft) {
navctr.view.semanticContentAttribute = config.direction;
navctr.navigationBar.semanticContentAttribute = config.direction;
Expand Down Expand Up @@ -595,7 +595,7 @@ + (NSMutableDictionary *)blurEffectsForIOSVersion
@"light": @(UIBlurEffectStyleLight),
@"dark": @(UIBlurEffectStyleDark),
}];

if (@available(iOS 10.0, *)) {
[blurEffects addEntriesFromDictionary:@{
@"regular": @(UIBlurEffectStyleRegular),
Expand Down Expand Up @@ -640,7 +640,7 @@ + (NSMutableDictionary *)blurEffectsForIOSVersion
}), UISemanticContentAttributeUnspecified, integerValue)

RCT_ENUM_CONVERTER(UIBlurEffectStyle, ([self blurEffectsForIOSVersion]), UIBlurEffectStyleExtraLight, integerValue)

RCT_ENUM_CONVERTER(RNSStatusBarStyle, (@{
@"auto": @(RNSStatusBarStyleAuto),
@"inverted": @(RNSStatusBarStyleInverted),
Expand Down

0 comments on commit f8c8120

Please sign in to comment.