Kaynağa Gözat

Fix topBar.background.color for older iOS versions (#5712)

Yogev Ben David 4 yıl önce
ebeveyn
işleme
7cf208353f
No account linked to committer's email address

+ 0
- 1
lib/ios/RNNNavigationOptions.h Dosyayı Görüntüle

@@ -14,7 +14,6 @@
14 14
 #import "RNNModalOptions.h"
15 15
 
16 16
 extern const NSInteger BLUR_TOPBAR_TAG;
17
-extern const NSInteger TOP_BAR_TRANSPARENT_TAG;
18 17
 
19 18
 @interface RNNNavigationOptions : RNNOptions
20 19
 

+ 1
- 16
lib/ios/UINavigationBar+utils.m Dosyayı Görüntüle

@@ -1,6 +1,5 @@
1 1
 #import "UINavigationBar+utils.h"
2 2
 
3
-const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
4 3
 
5 4
 @implementation UINavigationBar (utils)
6 5
 
@@ -34,7 +33,7 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
34 33
         [self getNavigaitonBarScrollEdgeAppearance].backgroundColor = color;
35 34
     } else {
36 35
         [super setBackgroundColor:color];
37
-        [self removeTransparentView];
36
+        self.barTintColor = color;
38 37
     }
39 38
 }
40 39
 
@@ -49,13 +48,6 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
49 48
         [self getNavigaitonBarScrollEdgeAppearance].backgroundEffect = nil;
50 49
         
51 50
     } else {
52
-        if (![self viewWithTag:TOP_BAR_TRANSPARENT_TAG]){
53
-            UIView *transparentView = [[UIView alloc] initWithFrame:CGRectZero];
54
-            transparentView.backgroundColor = [UIColor clearColor];
55
-            transparentView.tag = TOP_BAR_TRANSPARENT_TAG;
56
-            [self insertSubview:transparentView atIndex:0];
57
-        }
58
-        
59 51
         [self setBackgroundColor:[UIColor clearColor]];
60 52
         self.shadowImage = [UIImage new];
61 53
         [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
@@ -73,13 +65,6 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
73 65
     }
74 66
 }
75 67
 
76
-- (void)removeTransparentView {
77
-    UIView *transparentView = [self viewWithTag:TOP_BAR_TRANSPARENT_TAG];
78
-    if (transparentView){
79
-        [transparentView removeFromSuperview];
80
-    }
81
-}
82
-
83 68
 - (void)configureWithTransparentBackground {
84 69
     if (@available(iOS 13.0, *)) {
85 70
         [[self getNavigaitonBarStandardAppearance] configureWithTransparentBackground];

+ 0
- 1
playground/ios/NavigationTests/RNNNavigationControllerTest.m Dosyayı Görüntüle

@@ -178,7 +178,6 @@
178 178
 	[self.uut setTopBarBackgroundColor:redColor];
179 179
 	[self.uut setTopBarBackgroundColor:nil];
180 180
 	
181
-	XCTAssertNil([self.uut.navigationBar viewWithTag:TOP_BAR_TRANSPARENT_TAG]);
182 181
 	XCTAssertNil(self.uut.navigationBar.barTintColor);
183 182
 	XCTAssertNil(self.uut.navigationBar.standardAppearance.backgroundColor);
184 183
 	XCTAssertNil(self.uut.navigationBar.compactAppearance.backgroundColor);

+ 0
- 9
playground/ios/NavigationTests/RNNRootViewControllerTest.m Dosyayı Görüntüle

@@ -177,15 +177,6 @@
177 177
 
178 178
 }
179 179
 
180
--(void)testTopBarTransparent_BOOL_false {
181
-	UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
182
-	__unused RNNStackController* nav = [self createNavigationController];
183
-	self.options.topBar.background.color = [[Color alloc] initWithValue:inputColor];
184
-	[self.uut viewWillAppear:false];
185
-	UIView* transparentView = [self.uut.navigationController.navigationBar viewWithTag:TOP_BAR_TRANSPARENT_TAG];
186
-	XCTAssertFalse(transparentView);
187
-}
188
-
189 180
 -(void)testTopBarLargeTitle_default {
190 181
 	[self.uut viewWillAppear:false];
191 182