Quellcode durchsuchen

Fix largeTitle animation on pop - #4110

yogevbd vor 5 Jahren
Ursprung
Commit
77f02a1b7c

+ 1
- 0
lib/ios/RNNNavigationControllerPresenter.m Datei anzeigen

@@ -39,6 +39,7 @@
39 39
 	RNNNavigationController* navigationController = self.bindedViewController;
40 40
 	[navigationController setTopBarBackgroundColor:[options.topBar.background.color getWithDefaultValue:nil]];
41 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 45
 - (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {

+ 13
- 1
lib/ios/ReactNativeNavigationTests/RNNNavigationControllerPresenterTest.m Datei anzeigen

@@ -92,7 +92,7 @@
92 92
 	[_bindedViewController verify];
93 93
 }
94 94
 
95
-- (void)testApplyOptionsBefoePoppingShouldSetTopBarBackgroundForPoppingViewController {
95
+- (void)testApplyOptionsBeforePoppingShouldSetTopBarBackgroundForPoppingViewController {
96 96
 	_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
97 97
 	
98 98
 	[[_bindedViewController expect] setTopBarBackgroundColor:_options.topBar.background.color.get];
@@ -100,6 +100,18 @@
100 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 117
 @end