Pārlūkot izejas kodu

Fix largeTitle behaviour on iOS 13 (#5715)

* Fix largeTitle behavior on iOS 13
Yogev Ben David 5 gadus atpakaļ
vecāks
revīzija
65118b1ed2
No account linked to committer's email address

+ 1
- 1
lib/ios/RNNComponentPresenter.m Parādīt failu

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

+ 1
- 1
lib/ios/RNNFontAttributesCreator.h Parādīt failu

7
 
7
 
8
 + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color;
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
 @end
12
 @end

+ 19
- 19
lib/ios/RNNFontAttributesCreator.m Parādīt failu

5
 
5
 
6
 + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize defaultFontSize:(NSNumber *)defaultFontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color defaultColor:(UIColor *)defaultColor {
6
 + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize defaultFontSize:(NSNumber *)defaultFontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color defaultColor:(UIColor *)defaultColor {
7
 	NSMutableDictionary* titleTextAttributes = [NSMutableDictionary new];
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
 + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
11
 + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
12
 	NSMutableDictionary* titleTextAttributes = [NSMutableDictionary new];
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
 	return titleTextAttributes;
36
 	return titleTextAttributes;
37
 }
37
 }

+ 2
- 2
lib/ios/RNNTabBarItemCreator.m Parādīt failu

63
 }
63
 }
64
 
64
 
65
 + (void)appendTitleAttributes:(UITabBarItem *)tabItem textColor:(UIColor *)textColor selectedTextColor:(UIColor *)selectedTextColor fontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight {
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
 	[tabItem setTitleTextAttributes:selectedAttributes forState:UIControlStateSelected];
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
 	[tabItem setTitleTextAttributes:normalAttributes forState:UIControlStateNormal];
71
 	[tabItem setTitleTextAttributes:normalAttributes forState:UIControlStateNormal];
72
 }
72
 }
73
 
73
 

+ 4
- 0
lib/ios/UINavigationBar+utils.h Parādīt failu

8
 
8
 
9
 - (void)rnn_showBorder:(BOOL)showBorder;
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
 @end
15
 @end

+ 38
- 11
lib/ios/UINavigationBar+utils.m Parādīt failu

1
 #import "UINavigationBar+utils.h"
1
 #import "UINavigationBar+utils.h"
2
+#import "RNNFontAttributesCreator.h"
2
 
3
 
3
 
4
 
4
 @implementation UINavigationBar (utils)
5
 @implementation UINavigationBar (utils)
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
 - (void)setBackgroundColor:(UIColor *)color {
67
 - (void)setBackgroundColor:(UIColor *)color {
30
     if (@available(iOS 13.0, *)) {
68
     if (@available(iOS 13.0, *)) {
31
         [self getNavigaitonBarStandardAppearance].backgroundColor = color;
69
         [self getNavigaitonBarStandardAppearance].backgroundColor = color;
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
 - (void)configureWithTransparentBackground {
95
 - (void)configureWithTransparentBackground {
69
     if (@available(iOS 13.0, *)) {
96
     if (@available(iOS 13.0, *)) {
70
         [[self getNavigaitonBarStandardAppearance] configureWithTransparentBackground];
97
         [[self getNavigaitonBarStandardAppearance] configureWithTransparentBackground];

+ 2
- 9
lib/ios/UINavigationController+RNNOptions.m Parādīt failu

44
 }
44
 }
45
 
45
 
46
 - (void)setNavigationBarFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
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
 - (void)setNavigationBarLargeTitleVisible:(BOOL)visible {
50
 - (void)setNavigationBarLargeTitleVisible:(BOOL)visible {
62
 }
58
 }
63
 
59
 
64
 - (void)setNavigationBarLargeTitleFontFamily:(NSString *)fontFamily fontSize:(NSNumber *)fontSize fontWeight:(NSString *)fontWeight color:(UIColor *)color {
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
 - (void)setNavigationBarTranslucent:(BOOL)translucent {
64
 - (void)setNavigationBarTranslucent:(BOOL)translucent {

+ 11
- 8
playground/ios/NavigationTests/RNNFontAttributesCreatorTest.m Parādīt failu

44
 	XCTAssertEqual(font.pointSize, defaultFontSize.floatValue);
44
 	XCTAssertEqual(font.pointSize, defaultFontSize.floatValue);
45
 }
45
 }
46
 
46
 
47
-- (void)testCreateWithDictionary_shouldCreateAttributes {
47
+- (void)testcreateFromDictionary_shouldCreateAttributes {
48
 	NSString* familyName = @"Helvetica";
48
 	NSString* familyName = @"Helvetica";
49
 	NSNumber* fontSize = @(20);
49
 	NSNumber* fontSize = @(20);
50
 	UIColor* fontColor = UIColor.blueColor;
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
 	UIFont* font = attributes[NSFontAttributeName];
53
 	UIFont* font = attributes[NSFontAttributeName];
54
 	XCTAssertEqual(attributes[NSForegroundColorAttributeName], fontColor);
54
 	XCTAssertEqual(attributes[NSForegroundColorAttributeName], fontColor);
55
     XCTAssertTrue([familyName isEqualToString:font.familyName]);
55
     XCTAssertTrue([familyName isEqualToString:font.familyName]);
56
 	XCTAssertEqual(font.pointSize, fontSize.floatValue);
56
 	XCTAssertEqual(font.pointSize, fontSize.floatValue);
57
 }
57
 }
58
 
58
 
59
-- (void)testCreateWithDictionary_shouldMergeWithDictionary {
59
+- (void)testcreateFromDictionary_shouldMergeWithDictionary {
60
 	NSString* familyName = @"Helvetica";
60
 	NSString* familyName = @"Helvetica";
61
 	NSNumber* fontSize = @(20);
61
 	NSNumber* fontSize = @(20);
62
 	NSDictionary* dictionary = @{NSForegroundColorAttributeName: UIColor.redColor};
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
 	UIFont* font = attributes[NSFontAttributeName];
65
 	UIFont* font = attributes[NSFontAttributeName];
66
 	XCTAssertEqual(attributes[NSForegroundColorAttributeName], UIColor.redColor);
66
 	XCTAssertEqual(attributes[NSForegroundColorAttributeName], UIColor.redColor);
67
     XCTAssertTrue([familyName isEqualToString:font.familyName]);
67
     XCTAssertTrue([familyName isEqualToString:font.familyName]);
68
 	XCTAssertEqual(font.pointSize, fontSize.floatValue);
68
 	XCTAssertEqual(font.pointSize, fontSize.floatValue);
69
 }
69
 }
70
 
70
 
71
-- (void)testCreateWithFontFamily_shouldCreateSystemFontWhenOnlySizeAvailable {
71
+- (void)testCreateWithFontFamily_shouldNotChangeFontFamilyWhenOnlySizeAvailable {
72
 	NSNumber* fontSize = @(20);
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
 	UIFont* font = attributes[NSFontAttributeName];
79
 	UIFont* font = attributes[NSFontAttributeName];
76
-	NSString* systemFontFamilyName = [[UIFont systemFontOfSize:20] familyName];
77
 	XCTAssertEqual(font.pointSize, fontSize.floatValue);
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 Parādīt failu

127
 	__unused RNNStackController* nav = [self createNavigationController];
127
 	__unused RNNStackController* nav = [self createNavigationController];
128
 	[self.uut viewWillAppear:false];
128
 	[self.uut viewWillAppear:false];
129
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
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
 -(void)testbackgroundColor_validColor{
133
 -(void)testbackgroundColor_validColor{
144
 	self.options.topBar.title.fontFamily = [[Text alloc] initWithValue:inputFont];
144
 	self.options.topBar.title.fontFamily = [[Text alloc] initWithValue:inputFont];
145
 	[self.uut viewWillAppear:false];
145
 	[self.uut viewWillAppear:false];
146
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:17];
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
 -(void)testTopBarHideOnScroll_true {
150
 -(void)testTopBarHideOnScroll_true {
202
 	NSNumber* topBarTextFontSizeInput = @(15);
202
 	NSNumber* topBarTextFontSizeInput = @(15);
203
 	self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
203
 	self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
204
 	__unused RNNStackController* nav = [self createNavigationController];
204
 	__unused RNNStackController* nav = [self createNavigationController];
205
+	UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"];
205
 	[self.uut viewWillAppear:false];
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
 -(void)testTopBarLargeTitleFontSize_withoutTextFontFamily_withTextColor {
211
 -(void)testTopBarLargeTitleFontSize_withoutTextFontFamily_withTextColor {
214
 	self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
214
 	self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
215
 	self.options.topBar.largeTitle.color = [[Color alloc] initWithValue:inputColor];
215
 	self.options.topBar.largeTitle.color = [[Color alloc] initWithValue:inputColor];
216
 	__unused RNNStackController* nav = [self createNavigationController];
216
 	__unused RNNStackController* nav = [self createNavigationController];
217
+	UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"];
217
 	[self.uut viewWillAppear:false];
218
 	[self.uut viewWillAppear:false];
218
-	UIFont* expectedFont = [UIFont systemFontOfSize:15];
219
+	UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue];
219
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
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
 -(void)testTopBarLargeTitleFontSize_withTextFontFamily_withTextColor {
225
 -(void)testTopBarLargeTitleFontSize_withTextFontFamily_withTextColor {
233
 	[self.uut viewWillAppear:false];
234
 	[self.uut viewWillAppear:false];
234
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
235
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
235
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
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
 -(void)testTopBarLargeTitleFontSize_withTextFontFamily_withoutTextColor {
241
 -(void)testTopBarLargeTitleFontSize_withTextFontFamily_withoutTextColor {
245
 	__unused RNNStackController* nav = [self createNavigationController];
246
 	__unused RNNStackController* nav = [self createNavigationController];
246
 	[self.uut viewWillAppear:false];
247
 	[self.uut viewWillAppear:false];
247
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
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
 	NSNumber* topBarTextFontSizeInput = @(15);
254
 	NSNumber* topBarTextFontSizeInput = @(15);
254
 	self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
255
 	self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
255
 	__unused RNNStackController* nav = [self createNavigationController];
256
 	__unused RNNStackController* nav = [self createNavigationController];
257
+	UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"];
256
 	[self.uut viewWillAppear:false];
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
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
263
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
264
 	self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
266
 	self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
265
 	self.options.topBar.title.color = [[Color alloc] initWithValue:inputColor];
267
 	self.options.topBar.title.color = [[Color alloc] initWithValue:inputColor];
266
 	__unused RNNStackController* nav = [self createNavigationController];
268
 	__unused RNNStackController* nav = [self createNavigationController];
269
+	UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"];
267
 	[self.uut viewWillAppear:false];
270
 	[self.uut viewWillAppear:false];
268
-	UIFont* expectedFont = [UIFont systemFontOfSize:15];
271
+	UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue];
269
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
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
 -(void)testTopBarTextFontSize_withTextFontFamily_withTextColor {
277
 -(void)testTopBarTextFontSize_withTextFontFamily_withTextColor {
282
 	[self.uut viewWillAppear:false];
285
 	[self.uut viewWillAppear:false];
283
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
286
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
284
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
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
 -(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
292
 -(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
294
 	__unused RNNStackController* nav = [self createNavigationController];
297
 	__unused RNNStackController* nav = [self createNavigationController];
295
 	[self.uut viewWillAppear:false];
298
 	[self.uut viewWillAppear:false];
296
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
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
 // TODO: Currently not passing
303
 // TODO: Currently not passing