Skip to content

Commit 0599c04

Browse files
authored
chore: Use const pointer for static const for default header height (#3656)
## Description This PR adds const specifier for default header height values. ## Changes Added const specifier & handled proper copying of the value. ## Checklist - [ ] Ensured that CI passes
1 parent df54cc7 commit 0599c04

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ios/RNSScreenStackHeaderConfig.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
namespace react = facebook::react;
3939
#endif // RCT_NEW_ARCH_ENABLED
4040

41-
static NSNumber *const DEFAULT_TITLE_FONT_SIZE = @17;
42-
static NSNumber *const DEFAULT_TITLE_LARGE_FONT_SIZE = @34;
41+
static const NSNumber *const DEFAULT_TITLE_FONT_SIZE = @17;
42+
static const NSNumber *const DEFAULT_TITLE_LARGE_FONT_SIZE = @34;
4343

4444
#if !defined(RCT_NEW_ARCH_ENABLED)
4545
// Some RN private method hacking below. Couldn't figure out better way to access image data
@@ -488,7 +488,7 @@ + (UINavigationBarAppearance *)buildAppearance:(UIViewController *)vc withConfig
488488
#endif
489489

490490
NSString *family = config.titleFontFamily ?: nil;
491-
NSNumber *size = config.titleFontSize ?: DEFAULT_TITLE_FONT_SIZE;
491+
NSNumber *size = config.titleFontSize ?: [DEFAULT_TITLE_FONT_SIZE copy];
492492
NSString *weight = config.titleFontWeight ?: nil;
493493
if (family || weight) {
494494
attrs[NSFontAttributeName] = [RCTFont updateFont:nil
@@ -516,7 +516,7 @@ + (UINavigationBarAppearance *)buildAppearance:(UIViewController *)vc withConfig
516516
#endif
517517

518518
NSString *largeFamily = config.largeTitleFontFamily ?: nil;
519-
NSNumber *largeSize = config.largeTitleFontSize ?: DEFAULT_TITLE_LARGE_FONT_SIZE;
519+
NSNumber *largeSize = config.largeTitleFontSize ?: [DEFAULT_TITLE_LARGE_FONT_SIZE copy];
520520
NSString *largeWeight = config.largeTitleFontWeight ?: nil;
521521
if (largeFamily || largeWeight) {
522522
largeAttrs[NSFontAttributeName] = [RCTFont updateFont:nil

0 commit comments

Comments
 (0)