Skip to content

Commit 445742f

Browse files
authored
Fix topBar.title scrollEdge Appearance (wix#6850)
1 parent 56cab56 commit 445742f

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lib/ios/TopBarAppearancePresenter.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,17 @@ - (void)setTitleAttributes:(RNNTitleOptions *)titleOptions {
115115
NSNumber *fontSize = [titleOptions.fontSize getWithDefaultValue:nil];
116116
UIColor *fontColor = [titleOptions.color getWithDefaultValue:nil];
117117

118-
self.getAppearance.titleTextAttributes =
118+
NSDictionary *titleTextAttributes =
119119
[RNNFontAttributesCreator createFromDictionary:self.getAppearance.titleTextAttributes
120120
fontFamily:fontFamily
121121
fontSize:fontSize
122122
defaultFontSize:nil
123123
fontWeight:fontWeight
124124
color:fontColor
125125
defaultColor:nil];
126+
127+
self.getAppearance.titleTextAttributes = titleTextAttributes;
128+
self.getScrollEdgeAppearance.titleTextAttributes = titleTextAttributes;
126129
}
127130

128131
- (void)setLargeTitleAttributes:(RNNLargeTitleOptions *)largeTitleOptions {

playground/ios/NavigationTests/TopBarAppearancePresenterTest.m

+21
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,25 @@ - (void)testShowBorder_shouldPreserveBorderColor {
106106
UIColor.blueColor);
107107
}
108108

109+
- (void)testMergeOptions_shouldApplyTitleAppearance {
110+
RNNNavigationOptions *options = [RNNNavigationOptions emptyOptions];
111+
options.topBar.title.color = [Color withColor:UIColor.redColor];
112+
options.topBar.title.fontSize = [Number withValue:@(21)];
113+
114+
[_uut applyOptions:options.topBar];
115+
XCTAssertEqual(_stack.childViewControllers.lastObject.navigationItem.standardAppearance
116+
.titleTextAttributes[NSForegroundColorAttributeName],
117+
UIColor.redColor);
118+
XCTAssertEqual([_stack.childViewControllers.lastObject.navigationItem.standardAppearance
119+
.titleTextAttributes[NSFontAttributeName] pointSize],
120+
21);
121+
122+
XCTAssertEqual(_stack.childViewControllers.lastObject.navigationItem.scrollEdgeAppearance
123+
.titleTextAttributes[NSForegroundColorAttributeName],
124+
UIColor.redColor);
125+
XCTAssertEqual([_stack.childViewControllers.lastObject.navigationItem.scrollEdgeAppearance
126+
.titleTextAttributes[NSFontAttributeName] pointSize],
127+
21);
128+
}
129+
109130
@end

0 commit comments

Comments
 (0)