Browse Source

Force translucent on iOS 12 when background is transparent

yogevbd 5 years ago
parent
commit
2ad41f3adb

+ 2
- 0
lib/ios/TopBarPresenter.m View File

@@ -72,6 +72,7 @@
72 72
     if (self.transparent) {
73 73
         [self setBackgroundColorTransparent];
74 74
     } else if (_backgroundColor) {
75
+        self.navigationController.navigationBar.translucent = NO;
75 76
         self.navigationController.navigationBar.barTintColor = _backgroundColor;
76 77
     } else if (_translucent) {
77 78
         self.navigationController.navigationBar.translucent = YES;
@@ -83,6 +84,7 @@
83 84
 
84 85
 - (void)setBackgroundColorTransparent {
85 86
     self.navigationController.navigationBar.barTintColor = UIColor.clearColor;
87
+    self.navigationController.navigationBar.translucent = YES;
86 88
     self.navigationController.navigationBar.shadowImage = [UIImage new];
87 89
     [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
88 90
 }

+ 2
- 1
playground/ios/NavigationIOS12Tests/RNNRootViewControllerTest.m View File

@@ -185,6 +185,7 @@
185 185
 	
186 186
 	nav.navigationBar.barTintColor = UIColor.clearColor;
187 187
 	XCTAssertTrue([nav.navigationBar.barTintColor isEqual:UIColor.clearColor]);
188
+	XCTAssertTrue(nav.navigationBar.isTranslucent);
188 189
 }
189 190
 
190 191
 -(void)testTopBarTransparent_BOOL_false {
@@ -192,7 +193,7 @@
192 193
 	__unused RNNStackController* nav = [self createNavigationController];
193 194
 	self.options.topBar.background.color = [[Color alloc] initWithValue:inputColor];
194 195
 	[self.uut viewWillAppear:false];
195
-
196
+	XCTAssertFalse(nav.navigationBar.isTranslucent);
196 197
 	XCTAssertFalse([nav.navigationBar.barTintColor isEqual:UIColor.clearColor]);
197 198
 }
198 199