Browse Source

Fix black topBar background color (#5726)

* Fix black topBar background color
Yogev Ben David 5 years ago
parent
commit
d2ed290b58
No account linked to committer's email address
2 changed files with 4 additions and 6 deletions
  1. 3
    3
      lib/ios/RNNStackPresenter.m
  2. 1
    3
      lib/ios/UINavigationBar+utils.m

+ 3
- 3
lib/ios/RNNStackPresenter.m View File

29
 	self.interactivePopGestureDelegate.originalDelegate = stack.interactivePopGestureRecognizer.delegate;
29
 	self.interactivePopGestureDelegate.originalDelegate = stack.interactivePopGestureRecognizer.delegate;
30
 	stack.interactivePopGestureRecognizer.delegate = self.interactivePopGestureDelegate;
30
 	stack.interactivePopGestureRecognizer.delegate = self.interactivePopGestureDelegate;
31
 
31
 
32
+    [stack setBarStyle:[RCTConvert UIBarStyle:[withDefault.topBar.barStyle getWithDefaultValue:@"default"]]];
33
+    [stack setNavigationBarTranslucent:[withDefault.topBar.background.translucent getWithDefaultValue:NO]];
34
+    [stack setNavigationBarNoBorder:[withDefault.topBar.noBorder getWithDefaultValue:NO]];
32
     [stack setTopBarBackgroundColor:[withDefault.topBar.background.color getWithDefaultValue:nil]];
35
     [stack setTopBarBackgroundColor:[withDefault.topBar.background.color getWithDefaultValue:nil]];
33
 	[stack setInteractivePopGestureEnabled:[withDefault.popGesture getWithDefaultValue:YES]];
36
 	[stack setInteractivePopGestureEnabled:[withDefault.popGesture getWithDefaultValue:YES]];
34
 	[stack setRootBackgroundImage:[withDefault.rootBackgroundImage getWithDefaultValue:nil]];
37
 	[stack setRootBackgroundImage:[withDefault.rootBackgroundImage getWithDefaultValue:nil]];
35
 	[stack setNavigationBarTestId:[withDefault.topBar.testID getWithDefaultValue:nil]];
38
 	[stack setNavigationBarTestId:[withDefault.topBar.testID getWithDefaultValue:nil]];
36
 	[stack setNavigationBarVisible:[withDefault.topBar.visible getWithDefaultValue:YES] animated:[withDefault.topBar.animate getWithDefaultValue:YES]];
39
 	[stack setNavigationBarVisible:[withDefault.topBar.visible getWithDefaultValue:YES] animated:[withDefault.topBar.animate getWithDefaultValue:YES]];
37
 	[stack hideBarsOnScroll:[withDefault.topBar.hideOnScroll getWithDefaultValue:NO]];
40
 	[stack hideBarsOnScroll:[withDefault.topBar.hideOnScroll getWithDefaultValue:NO]];
38
-	[stack setNavigationBarNoBorder:[withDefault.topBar.noBorder getWithDefaultValue:NO]];
39
-	[stack setBarStyle:[RCTConvert UIBarStyle:[withDefault.topBar.barStyle getWithDefaultValue:@"default"]]];
40
-	[stack setNavigationBarTranslucent:[withDefault.topBar.background.translucent getWithDefaultValue:NO]];
41
 	[stack setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds getWithDefaultValue:NO]];
41
 	[stack setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds getWithDefaultValue:NO]];
42
 	[stack setNavigationBarBlur:[withDefault.topBar.background.blur getWithDefaultValue:NO]];
42
 	[stack setNavigationBarBlur:[withDefault.topBar.background.blur getWithDefaultValue:NO]];
43
 	[stack setNavigationBarLargeTitleVisible:[withDefault.topBar.largeTitle.visible getWithDefaultValue:NO]];
43
 	[stack setNavigationBarLargeTitleVisible:[withDefault.topBar.largeTitle.visible getWithDefaultValue:NO]];

+ 1
- 3
lib/ios/UINavigationBar+utils.m View File

1
 #import "UINavigationBar+utils.h"
1
 #import "UINavigationBar+utils.h"
2
 #import "RNNFontAttributesCreator.h"
2
 #import "RNNFontAttributesCreator.h"
3
 
3
 
4
-
5
 @implementation UINavigationBar (utils)
4
 @implementation UINavigationBar (utils)
6
 
5
 
7
 - (void)rnn_setBackIndicatorImage:(UIImage *)image {
6
 - (void)rnn_setBackIndicatorImage:(UIImage *)image {
70
         [self getNavigaitonBarCompactAppearance].backgroundColor = color;
69
         [self getNavigaitonBarCompactAppearance].backgroundColor = color;
71
         [self getNavigaitonBarScrollEdgeAppearance].backgroundColor = color;
70
         [self getNavigaitonBarScrollEdgeAppearance].backgroundColor = color;
72
     } else {
71
     } else {
73
-        [super setBackgroundColor:color];
74
         self.barTintColor = color;
72
         self.barTintColor = color;
75
     }
73
     }
76
 }
74
 }
86
         [self getNavigaitonBarScrollEdgeAppearance].backgroundEffect = nil;
84
         [self getNavigaitonBarScrollEdgeAppearance].backgroundEffect = nil;
87
         
85
         
88
     } else {
86
     } else {
89
-        [self setBackgroundColor:[UIColor clearColor]];
87
+        self.barTintColor = UIColor.clearColor;
90
         self.shadowImage = [UIImage new];
88
         self.shadowImage = [UIImage new];
91
         [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
89
         [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
92
     }
90
     }