소스 검색

Fix largeTitle behaviour on iOS 13 (#5715)

* Fix largeTitle behavior on iOS 13
Yogev Ben David 5 년 전
부모
커밋
65118b1ed2
No account linked to committer's email address

+ 1
- 1
lib/ios/RNNComponentPresenter.m 파일 보기

@@ -192,7 +192,7 @@
192 192
 }
193 193
 
194 194
 - (void)setTitleViewWithSubtitle:(RNNNavigationOptions *)options {
195
-	if (!_customTitleView) {
195
+	if (!_customTitleView && ![options.topBar.largeTitle.visible getWithDefaultValue:NO]) {
196 196
 		_titleViewHelper = [[RNNTitleViewHelper alloc] initWithTitleViewOptions:options.topBar.title subTitleOptions:options.topBar.subtitle viewController:self.boundViewController];
197 197
 
198 198
 		if (options.topBar.title.text.hasValue) {

+ 1
- 1
lib/ios/RNNFontAttributesCreator.h 파일 보기

@@ -7,6 +7,6 @@
7 7
 
8 8
 + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color;
9 9
 
10
-+ (NSDictionary *)createWithDictionary:(NSDictionary *)attributesDictionary fontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize defaultFontSize:(NSNumber *)defaultFontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color defaultColor:(UIColor *)defaultColor;
10
++ (NSDictionary *)createFromDictionary:(NSDictionary *)attributesDictionary fontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize defaultFontSize:(NSNumber *)defaultFontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color defaultColor:(UIColor *)defaultColor;
11 11
 
12 12
 @end

+ 19
- 19
lib/ios/RNNFontAttributesCreator.m 파일 보기

@@ -5,33 +5,33 @@
5 5
 
6 6
 + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize defaultFontSize:(NSNumber *)defaultFontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color defaultColor:(UIColor *)defaultColor {
7 7
 	NSMutableDictionary* titleTextAttributes = [NSMutableDictionary new];
8
-	return [self createWithDictionary:titleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:defaultFontSize fontWeight:fontWeight color:color defaultColor:defaultColor];
8
+	return [self createFromDictionary:titleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:defaultFontSize fontWeight:fontWeight color:color defaultColor:defaultColor];
9 9
 }
10 10
 
11 11
 + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
12 12
 	NSMutableDictionary* titleTextAttributes = [NSMutableDictionary new];
13
-	return [self createWithDictionary:titleTextAttributes fontFamily:fontFamily fontSize:fontSize fontWeight:fontWeight color:color];
13
+	return [self createFromDictionary:titleTextAttributes fontFamily:fontFamily fontSize:fontSize fontWeight:fontWeight color:color];
14 14
 }
15 15
 
16
-+ (NSDictionary *)createWithDictionary:(NSDictionary *)attributesDictionary fontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize defaultFontSize:(NSNumber *)defaultFontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color defaultColor:(UIColor *)defaultColor {
17
-	return [self createWithDictionary:attributesDictionary fontFamily:fontFamily fontSize:fontSize ?: defaultFontSize fontWeight:fontWeight color:color ?: defaultColor];
16
++ (NSDictionary *)createFromDictionary:(NSDictionary *)attributesDictionary fontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize defaultFontSize:(NSNumber *)defaultFontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color defaultColor:(UIColor *)defaultColor {
17
+	return [self createFromDictionary:attributesDictionary fontFamily:fontFamily fontSize:fontSize ?: defaultFontSize fontWeight:fontWeight color:color ?: defaultColor];
18 18
 }
19 19
 
20
-+ (NSDictionary *)createWithDictionary:(NSDictionary *)attributesDictionary fontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
21
-	NSMutableDictionary* titleTextAttributes = [NSMutableDictionary dictionaryWithDictionary:attributesDictionary];
22
-	if (fontFamily || fontSize || color || fontWeight) {
23
-		CGFloat resolvedFontSize = fontSize ? fontSize.floatValue : 17;
24
-		if (color) {
25
-			titleTextAttributes[NSForegroundColorAttributeName] = color;
26
-		}
27
-		if (fontWeight) {
28
-			titleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:resolvedFontSize weight:[RCTConvert UIFontWeight:fontWeight]];
29
-		} else if (fontFamily){
30
-			titleTextAttributes[NSFontAttributeName] = [UIFont fontWithName:fontFamily size:resolvedFontSize];
31
-		} else {
32
-			titleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:resolvedFontSize];
33
-		}
34
-	}
20
++ (NSDictionary *)createFromDictionary:(NSDictionary *)attributesDictionary fontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
21
+	NSMutableDictionary* titleTextAttributes = [NSMutableDictionary dictionaryWithDictionary:attributesDictionary];\
22
+    UIFont* currentFont = attributesDictionary[NSFontAttributeName];
23
+    
24
+	CGFloat resolvedFontSize = fontSize ? fontSize.floatValue : currentFont.fontDescriptor.pointSize;
25
+    if (color) {
26
+        titleTextAttributes[NSForegroundColorAttributeName] = color;
27
+    }
28
+    if (fontWeight) {
29
+        titleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:resolvedFontSize weight:[RCTConvert UIFontWeight:fontWeight]];
30
+    } else if (fontFamily){
31
+        titleTextAttributes[NSFontAttributeName] = [UIFont fontWithName:fontFamily size:resolvedFontSize];
32
+    } else if (fontSize) {
33
+        titleTextAttributes[NSFontAttributeName] = [UIFont fontWithDescriptor:currentFont.fontDescriptor size:resolvedFontSize];
34
+    }
35 35
 	
36 36
 	return titleTextAttributes;
37 37
 }

+ 2
- 2
lib/ios/RNNTabBarItemCreator.m 파일 보기

@@ -63,11 +63,11 @@
63 63
 }
64 64
 
65 65
 + (void)appendTitleAttributes:(UITabBarItem *)tabItem textColor:(UIColor *)textColor selectedTextColor:(UIColor *)selectedTextColor fontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight {
66
-	NSDictionary* selectedAttributes = [RNNFontAttributesCreator createWithDictionary:[tabItem titleTextAttributesForState:UIControlStateSelected] fontFamily:fontFamily fontSize:fontSize defaultFontSize:@(10) fontWeight:fontWeight color:selectedTextColor defaultColor:[UIColor blackColor]];
66
+	NSDictionary* selectedAttributes = [RNNFontAttributesCreator createFromDictionary:[tabItem titleTextAttributesForState:UIControlStateSelected] fontFamily:fontFamily fontSize:fontSize defaultFontSize:@(10) fontWeight:fontWeight color:selectedTextColor defaultColor:[UIColor blackColor]];
67 67
 	[tabItem setTitleTextAttributes:selectedAttributes forState:UIControlStateSelected];
68 68
 	
69 69
 	
70
-	NSDictionary* normalAttributes = [RNNFontAttributesCreator createWithDictionary:[tabItem titleTextAttributesForState:UIControlStateNormal] fontFamily:fontFamily fontSize:fontSize defaultFontSize:@(10) fontWeight:fontWeight color:textColor defaultColor:[UIColor blackColor]];
70
+	NSDictionary* normalAttributes = [RNNFontAttributesCreator createFromDictionary:[tabItem titleTextAttributesForState:UIControlStateNormal] fontFamily:fontFamily fontSize:fontSize defaultFontSize:@(10) fontWeight:fontWeight color:textColor defaultColor:[UIColor blackColor]];
71 71
 	[tabItem setTitleTextAttributes:normalAttributes forState:UIControlStateNormal];
72 72
 }
73 73
 

+ 4
- 0
lib/ios/UINavigationBar+utils.h 파일 보기

@@ -8,4 +8,8 @@
8 8
 
9 9
 - (void)rnn_showBorder:(BOOL)showBorder;
10 10
 
11
+- (void)rnn_setNavigationBarLargeTitleFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color;
12
+
13
+- (void)rnn_setNavigationBarTitleFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color;
14
+
11 15
 @end

+ 38
- 11
lib/ios/UINavigationBar+utils.m 파일 보기

@@ -1,4 +1,5 @@
1 1
 #import "UINavigationBar+utils.h"
2
+#import "RNNFontAttributesCreator.h"
2 3
 
3 4
 
4 5
 @implementation UINavigationBar (utils)
@@ -26,6 +27,43 @@
26 27
     }
27 28
 }
28 29
 
30
+- (void)rnn_setNavigationBarLargeTitleFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
31
+    NSDictionary* fontAttributes;
32
+    if (@available(iOS 13.0, *)) {
33
+        fontAttributes = [RNNFontAttributesCreator createFromDictionary:self.standardAppearance.largeTitleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:nil fontWeight:fontWeight color:color defaultColor:nil];
34
+        [[self getNavigaitonBarStandardAppearance] setLargeTitleTextAttributes:fontAttributes];
35
+        [[self getNavigaitonBarCompactAppearance] setLargeTitleTextAttributes:fontAttributes];
36
+        [[self getNavigaitonBarScrollEdgeAppearance] setLargeTitleTextAttributes:fontAttributes];
37
+    } else if (@available(iOS 11.0, *)) {
38
+        fontAttributes = [RNNFontAttributesCreator createFromDictionary:self.largeTitleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:nil fontWeight:fontWeight color:color defaultColor:nil];
39
+        self.largeTitleTextAttributes = fontAttributes;
40
+    }
41
+}
42
+
43
+- (void)rnn_setNavigationBarTitleFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
44
+    NSDictionary* fontAttributes;
45
+    if (@available(iOS 13.0, *)) {
46
+        fontAttributes = [RNNFontAttributesCreator createFromDictionary:self.standardAppearance.titleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:nil fontWeight:fontWeight color:color defaultColor:nil];
47
+        [[self getNavigaitonBarStandardAppearance] setTitleTextAttributes:fontAttributes];
48
+        [[self getNavigaitonBarCompactAppearance] setTitleTextAttributes:fontAttributes];
49
+        [[self getNavigaitonBarScrollEdgeAppearance] setTitleTextAttributes:fontAttributes];
50
+    } else if (@available(iOS 11.0, *)) {
51
+        fontAttributes = [RNNFontAttributesCreator createFromDictionary:self.titleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:nil fontWeight:fontWeight color:color defaultColor:nil];
52
+        self.titleTextAttributes = fontAttributes;
53
+    }
54
+}
55
+
56
+- (void)rnn_showBorder:(BOOL)showBorder {
57
+    if (@available(iOS 13.0, *)) {
58
+        UIColor* shadowColor = showBorder ? [[UINavigationBarAppearance new] shadowColor] : nil;
59
+        [[self getNavigaitonBarStandardAppearance] setShadowColor:shadowColor];
60
+        [[self getNavigaitonBarCompactAppearance] setShadowColor:shadowColor];
61
+        [[self getNavigaitonBarScrollEdgeAppearance] setShadowColor:shadowColor];
62
+    } else {
63
+        [self setShadowImage:showBorder ? nil : [UIImage new]];
64
+    }
65
+}
66
+
29 67
 - (void)setBackgroundColor:(UIColor *)color {
30 68
     if (@available(iOS 13.0, *)) {
31 69
         [self getNavigaitonBarStandardAppearance].backgroundColor = color;
@@ -54,17 +92,6 @@
54 92
     }
55 93
 }
56 94
 
57
-- (void)rnn_showBorder:(BOOL)showBorder {
58
-    if (@available(iOS 13.0, *)) {
59
-        UIColor* shadowColor = showBorder ? [[UINavigationBarAppearance new] shadowColor] : nil;
60
-        [[self getNavigaitonBarStandardAppearance] setShadowColor:shadowColor];
61
-        [[self getNavigaitonBarCompactAppearance] setShadowColor:shadowColor];
62
-        [[self getNavigaitonBarScrollEdgeAppearance] setShadowColor:shadowColor];
63
-    } else {
64
-        [self setShadowImage:showBorder ? nil : [UIImage new]];
65
-    }
66
-}
67
-
68 95
 - (void)configureWithTransparentBackground {
69 96
     if (@available(iOS 13.0, *)) {
70 97
         [[self getNavigaitonBarStandardAppearance] configureWithTransparentBackground];

+ 2
- 9
lib/ios/UINavigationController+RNNOptions.m 파일 보기

@@ -44,11 +44,7 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
44 44
 }
45 45
 
46 46
 - (void)setNavigationBarFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
47
-	NSDictionary* fontAttributes = [RNNFontAttributesCreator createWithFontFamily:fontFamily fontSize:fontSize fontWeight:fontWeight color:color];
48
-	
49
-	if (fontAttributes.allKeys.count > 0) {
50
-		self.navigationBar.titleTextAttributes = fontAttributes;
51
-	}
47
+    [self.navigationBar rnn_setNavigationBarTitleFontFamily:fontFamily fontSize:fontSize fontWeight:fontWeight color:color];
52 48
 }
53 49
 
54 50
 - (void)setNavigationBarLargeTitleVisible:(BOOL)visible {
@@ -62,10 +58,7 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
62 58
 }
63 59
 
64 60
 - (void)setNavigationBarLargeTitleFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
65
-	if (@available(iOS 11.0, *)) {
66
-		NSDictionary* fontAttributes = [RNNFontAttributesCreator createWithFontFamily:fontFamily fontSize:fontSize fontWeight:fontWeight color:color];
67
-		self.navigationBar.largeTitleTextAttributes = fontAttributes;
68
-	}
61
+    [self.navigationBar rnn_setNavigationBarLargeTitleFontFamily:fontFamily fontSize:fontSize fontWeight:fontWeight color:color];
69 62
 }
70 63
 
71 64
 - (void)setNavigationBarTranslucent:(BOOL)translucent {

+ 11
- 8
playground/ios/NavigationTests/RNNFontAttributesCreatorTest.m 파일 보기

@@ -44,38 +44,41 @@
44 44
 	XCTAssertEqual(font.pointSize, defaultFontSize.floatValue);
45 45
 }
46 46
 
47
-- (void)testCreateWithDictionary_shouldCreateAttributes {
47
+- (void)testcreateFromDictionary_shouldCreateAttributes {
48 48
 	NSString* familyName = @"Helvetica";
49 49
 	NSNumber* fontSize = @(20);
50 50
 	UIColor* fontColor = UIColor.blueColor;
51 51
 	
52
-	NSDictionary* attributes = [RNNFontAttributesCreator createWithDictionary:@{} fontFamily:familyName fontSize:fontSize defaultFontSize:nil fontWeight:nil color:fontColor defaultColor:nil];
52
+	NSDictionary* attributes = [RNNFontAttributesCreator createFromDictionary:@{} fontFamily:familyName fontSize:fontSize defaultFontSize:nil fontWeight:nil color:fontColor defaultColor:nil];
53 53
 	UIFont* font = attributes[NSFontAttributeName];
54 54
 	XCTAssertEqual(attributes[NSForegroundColorAttributeName], fontColor);
55 55
     XCTAssertTrue([familyName isEqualToString:font.familyName]);
56 56
 	XCTAssertEqual(font.pointSize, fontSize.floatValue);
57 57
 }
58 58
 
59
-- (void)testCreateWithDictionary_shouldMergeWithDictionary {
59
+- (void)testcreateFromDictionary_shouldMergeWithDictionary {
60 60
 	NSString* familyName = @"Helvetica";
61 61
 	NSNumber* fontSize = @(20);
62 62
 	NSDictionary* dictionary = @{NSForegroundColorAttributeName: UIColor.redColor};
63 63
 	
64
-	NSDictionary* attributes = [RNNFontAttributesCreator createWithDictionary:dictionary fontFamily:familyName fontSize:fontSize defaultFontSize:nil fontWeight:nil color:nil defaultColor:nil];
64
+	NSDictionary* attributes = [RNNFontAttributesCreator createFromDictionary:dictionary fontFamily:familyName fontSize:fontSize defaultFontSize:nil fontWeight:nil color:nil defaultColor:nil];
65 65
 	UIFont* font = attributes[NSFontAttributeName];
66 66
 	XCTAssertEqual(attributes[NSForegroundColorAttributeName], UIColor.redColor);
67 67
     XCTAssertTrue([familyName isEqualToString:font.familyName]);
68 68
 	XCTAssertEqual(font.pointSize, fontSize.floatValue);
69 69
 }
70 70
 
71
-- (void)testCreateWithFontFamily_shouldCreateSystemFontWhenOnlySizeAvailable {
71
+- (void)testCreateWithFontFamily_shouldNotChangeFontFamilyWhenOnlySizeAvailable {
72 72
 	NSNumber* fontSize = @(20);
73
+	UIFont* initialFont = [UIFont systemFontOfSize:10 weight:UIFontWeightHeavy];
74
+	NSMutableDictionary* initialAttributes = [NSMutableDictionary new];
75
+	initialAttributes[NSFontAttributeName] = initialFont;
76
+	
77
+	NSDictionary* attributes = [RNNFontAttributesCreator createFromDictionary:initialAttributes fontFamily:nil fontSize:fontSize defaultFontSize:nil fontWeight:nil color:nil defaultColor:nil];
73 78
 	
74
-	NSDictionary* attributes = [RNNFontAttributesCreator createWithFontFamily:nil fontSize:fontSize fontWeight:nil color:nil];
75 79
 	UIFont* font = attributes[NSFontAttributeName];
76
-	NSString* systemFontFamilyName = [[UIFont systemFontOfSize:20] familyName];
77 80
 	XCTAssertEqual(font.pointSize, fontSize.floatValue);
78
-	XCTAssertTrue([font.familyName isEqualToString:systemFontFamilyName]);
81
+	XCTAssertTrue([font.familyName isEqualToString:initialFont.familyName]);
79 82
 }
80 83
 
81 84
 

+ 22
- 19
playground/ios/NavigationTests/RNNRootViewControllerTest.m 파일 보기

@@ -127,7 +127,7 @@
127 127
 	__unused RNNStackController* nav = [self createNavigationController];
128 128
 	[self.uut viewWillAppear:false];
129 129
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
130
-	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
130
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
131 131
 }
132 132
 
133 133
 -(void)testbackgroundColor_validColor{
@@ -144,7 +144,7 @@
144 144
 	self.options.topBar.title.fontFamily = [[Text alloc] initWithValue:inputFont];
145 145
 	[self.uut viewWillAppear:false];
146 146
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:17];
147
-	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
147
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
148 148
 }
149 149
 
150 150
 -(void)testTopBarHideOnScroll_true {
@@ -202,10 +202,10 @@
202 202
 	NSNumber* topBarTextFontSizeInput = @(15);
203 203
 	self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
204 204
 	__unused RNNStackController* nav = [self createNavigationController];
205
+	UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"];
205 206
 	[self.uut viewWillAppear:false];
206
-	UIFont* expectedFont = [UIFont systemFontOfSize:15];
207
-
208
-	XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
207
+	UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue];
208
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
209 209
 }
210 210
 
211 211
 -(void)testTopBarLargeTitleFontSize_withoutTextFontFamily_withTextColor {
@@ -214,11 +214,12 @@
214 214
 	self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
215 215
 	self.options.topBar.largeTitle.color = [[Color alloc] initWithValue:inputColor];
216 216
 	__unused RNNStackController* nav = [self createNavigationController];
217
+	UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"];
217 218
 	[self.uut viewWillAppear:false];
218
-	UIFont* expectedFont = [UIFont systemFontOfSize:15];
219
+	UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue];
219 220
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
220
-	XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
221
-	XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]);
221
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
222
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]);
222 223
 }
223 224
 
224 225
 -(void)testTopBarLargeTitleFontSize_withTextFontFamily_withTextColor {
@@ -233,8 +234,8 @@
233 234
 	[self.uut viewWillAppear:false];
234 235
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
235 236
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
236
-	XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
237
-	XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]);
237
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
238
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]);
238 239
 }
239 240
 
240 241
 -(void)testTopBarLargeTitleFontSize_withTextFontFamily_withoutTextColor {
@@ -245,7 +246,7 @@
245 246
 	__unused RNNStackController* nav = [self createNavigationController];
246 247
 	[self.uut viewWillAppear:false];
247 248
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
248
-	XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
249
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
249 250
 }
250 251
 
251 252
 
@@ -253,9 +254,10 @@
253 254
 	NSNumber* topBarTextFontSizeInput = @(15);
254 255
 	self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
255 256
 	__unused RNNStackController* nav = [self createNavigationController];
257
+	UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"];
256 258
 	[self.uut viewWillAppear:false];
257
-	UIFont* expectedFont = [UIFont systemFontOfSize:15];
258
-	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
259
+	UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue];
260
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
259 261
 }
260 262
 
261 263
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
@@ -264,11 +266,12 @@
264 266
 	self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
265 267
 	self.options.topBar.title.color = [[Color alloc] initWithValue:inputColor];
266 268
 	__unused RNNStackController* nav = [self createNavigationController];
269
+	UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"];
267 270
 	[self.uut viewWillAppear:false];
268
-	UIFont* expectedFont = [UIFont systemFontOfSize:15];
271
+	UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue];
269 272
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
270
-	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
271
-	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
273
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
274
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
272 275
 }
273 276
 
274 277
 -(void)testTopBarTextFontSize_withTextFontFamily_withTextColor {
@@ -282,8 +285,8 @@
282 285
 	[self.uut viewWillAppear:false];
283 286
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
284 287
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
285
-	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
286
-	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
288
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
289
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
287 290
 }
288 291
 
289 292
 -(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
@@ -294,7 +297,7 @@
294 297
 	__unused RNNStackController* nav = [self createNavigationController];
295 298
 	[self.uut viewWillAppear:false];
296 299
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
297
-	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
300
+	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
298 301
 }
299 302
 
300 303
 // TODO: Currently not passing