Browse Source

Fix largeTitle animation on pop - #4110

yogevbd 6 years ago
parent
commit
77f02a1b7c

+ 1
- 0
lib/ios/RNNNavigationControllerPresenter.m View File

39
 	RNNNavigationController* navigationController = self.bindedViewController;
39
 	RNNNavigationController* navigationController = self.bindedViewController;
40
 	[navigationController setTopBarBackgroundColor:[options.topBar.background.color getWithDefaultValue:nil]];
40
 	[navigationController setTopBarBackgroundColor:[options.topBar.background.color getWithDefaultValue:nil]];
41
 	[navigationController rnn_setNavigationBarFontFamily:[options.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.title.fontSize getWithDefaultValue:@(17)] color:[options.topBar.title.color getWithDefaultValue:[UIColor blackColor]]];
41
 	[navigationController rnn_setNavigationBarFontFamily:[options.topBar.title.fontFamily getWithDefaultValue:nil] fontSize:[options.topBar.title.fontSize getWithDefaultValue:@(17)] color:[options.topBar.title.color getWithDefaultValue:[UIColor blackColor]]];
42
+	[navigationController rnn_setNavigationBarLargeTitleVisible:[options.topBar.largeTitle.visible getWithDefaultValue:NO]];
42
 }
43
 }
43
 
44
 
44
 - (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
45
 - (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {

+ 13
- 1
lib/ios/ReactNativeNavigationTests/RNNNavigationControllerPresenterTest.m View File

92
 	[_bindedViewController verify];
92
 	[_bindedViewController verify];
93
 }
93
 }
94
 
94
 
95
-- (void)testApplyOptionsBefoePoppingShouldSetTopBarBackgroundForPoppingViewController {
95
+- (void)testApplyOptionsBeforePoppingShouldSetTopBarBackgroundForPoppingViewController {
96
 	_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
96
 	_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
97
 	
97
 	
98
 	[[_bindedViewController expect] setTopBarBackgroundColor:_options.topBar.background.color.get];
98
 	[[_bindedViewController expect] setTopBarBackgroundColor:_options.topBar.background.color.get];
100
 	[_bindedViewController verify];
100
 	[_bindedViewController verify];
101
 }
101
 }
102
 
102
 
103
+- (void)testApplyOptionsBeforePoppingShouldSetLargeTitleForPoppingViewController {
104
+	_options.topBar.largeTitle.visible = [[Bool alloc] initWithBOOL:YES];
105
+	
106
+	[self.uut applyOptionsBeforePopping:self.options];
107
+	XCTAssertTrue([[self.uut.bindedViewController navigationBar] prefersLargeTitles]);
108
+}
103
 
109
 
110
+- (void)testApplyOptionsBeforePoppingShouldSetDefaultLargeTitleFalseForPoppingViewController {
111
+	_options.topBar.largeTitle.visible = nil;
112
+	
113
+	[self.uut applyOptionsBeforePopping:self.options];
114
+	XCTAssertFalse([[self.uut.bindedViewController navigationBar] prefersLargeTitles]);
115
+}
104
 
116
 
105
 @end
117
 @end