Browse Source

Fix bottomTabs.translucent option (#6025)

* Fix translucent bottomTabs

* Remove unnecessary safeAreaView from Root component

* Add bottomTabsPresenter base class

* Revert Root.js

* DrawBehind when largeTitle is visible

Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
Yogev Ben David 5 years ago
parent
commit
6edbbf512f
No account linked to committer's email address

+ 2
- 2
lib/ios/BottomTabsAppearancePresenter.h View File

@@ -1,7 +1,7 @@
1
-#import "RNNBottomTabsPresenter.h"
1
+#import "BottomTabsBasePresenter.h"
2 2
 
3 3
 API_AVAILABLE(ios(13.0))
4
-@interface BottomTabsAppearancePresenter : RNNBottomTabsPresenter
4
+@interface BottomTabsAppearancePresenter : BottomTabsBasePresenter
5 5
 
6 6
 
7 7
 @end

+ 38
- 3
lib/ios/BottomTabsAppearancePresenter.m View File

@@ -1,12 +1,47 @@
1 1
 #import "BottomTabsAppearancePresenter.h"
2
+#import "UIColor+RNNUtils.h"
2 3
 
3 4
 @implementation BottomTabsAppearancePresenter
4 5
 
6
+# pragma mark - public
7
+
8
+- (void)applyBackgroundColor:(UIColor *)backgroundColor translucent:(BOOL)translucent {
9
+    if (translucent) [self setTabBarTranslucent:YES];
10
+    else if (backgroundColor.isTransparent) [self setTabBarTransparentBackground];
11
+    else if (backgroundColor) [self setTabBarBackgroundColor:backgroundColor];
12
+    else [self setTabBarDefaultBackground];
13
+}
14
+
5 15
 - (void)setTabBarBackgroundColor:(UIColor *)backgroundColor {
6
-    UITabBarController *bottomTabs = self.tabBarController;
7
-    for (UIViewController* childViewController in bottomTabs.childViewControllers) {
16
+    [self setTabBarOpaqueBackground];
17
+    for (UIViewController* childViewController in self.tabBarController.childViewControllers)
8 18
         childViewController.tabBarItem.standardAppearance.backgroundColor = backgroundColor;
9
-    }
19
+}
20
+
21
+- (void)setTabBarTranslucent:(BOOL)translucent {
22
+    if (translucent) [self setTabBarTranslucentBackground];
23
+    else [self setTabBarOpaqueBackground];
24
+}
25
+
26
+# pragma mark - private
27
+
28
+- (void)setTabBarDefaultBackground {
29
+    [self setTabBarOpaqueBackground];
30
+}
31
+
32
+- (void)setTabBarTranslucentBackground {
33
+    for (UIViewController* childViewController in self.tabBarController.childViewControllers)
34
+        [childViewController.tabBarItem.standardAppearance configureWithDefaultBackground];
35
+}
36
+
37
+- (void)setTabBarTransparentBackground {
38
+    for (UIViewController* childViewController in self.tabBarController.childViewControllers)
39
+        [childViewController.tabBarItem.standardAppearance configureWithTransparentBackground];
40
+}
41
+
42
+- (void)setTabBarOpaqueBackground {
43
+    for (UIViewController* childViewController in self.tabBarController.childViewControllers)
44
+        [childViewController.tabBarItem.standardAppearance configureWithOpaqueBackground];
10 45
 }
11 46
 
12 47
 @end

+ 20
- 0
lib/ios/BottomTabsBasePresenter.h View File

@@ -0,0 +1,20 @@
1
+#import <Foundation/Foundation.h>
2
+#import "RNNBasePresenter.h"
3
+#import "UITabBarController+RNNOptions.h"
4
+#import "UIViewController+LayoutProtocol.h"
5
+#import "UIViewController+Utils.h"
6
+#import "UIColor+RNNUtils.h"
7
+
8
+@interface BottomTabsBasePresenter : RNNBasePresenter
9
+
10
+- (void)applyBackgroundColor:(UIColor *)backgroundColor translucent:(BOOL)translucent;
11
+
12
+- (void)setTabBarBackgroundColor:(UIColor *)backgroundColor;
13
+
14
+- (void)setTabBarTranslucent:(BOOL)translucent;
15
+
16
+- (UITabBarController *)tabBarController;
17
+
18
+- (UITabBar *)tabBar;
19
+
20
+@end

+ 95
- 0
lib/ios/BottomTabsBasePresenter.m View File

@@ -0,0 +1,95 @@
1
+#import "BottomTabsBasePresenter.h"
2
+
3
+@implementation BottomTabsBasePresenter
4
+
5
+- (void)applyOptionsOnInit:(RNNNavigationOptions *)options {
6
+    [super applyOptionsOnInit:options];
7
+    UITabBarController *bottomTabs = self.tabBarController;
8
+    RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
9
+    [bottomTabs setCurrentTabIndex:[withDefault.bottomTabs.currentTabIndex getWithDefaultValue:0]];
10
+    if ([[withDefault.bottomTabs.titleDisplayMode getWithDefaultValue:@"alwaysShow"] isEqualToString:@"alwaysHide"]) {
11
+        [bottomTabs centerTabItems];
12
+    }
13
+}
14
+
15
+- (void)applyOptions:(RNNNavigationOptions *)options {
16
+    UITabBarController *bottomTabs = self.tabBarController;
17
+    RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
18
+
19
+    [bottomTabs setTabBarTestID:[withDefault.bottomTabs.testID getWithDefaultValue:nil]];
20
+    [bottomTabs setTabBarVisible:[withDefault.bottomTabs.visible getWithDefaultValue:YES] animated:[withDefault.bottomTabs.animate getWithDefaultValue:NO]];
21
+    
22
+    [bottomTabs.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
23
+    [self applyBackgroundColor:[withDefault.bottomTabs.backgroundColor getWithDefaultValue:nil] translucent:[withDefault.bottomTabs.translucent getWithDefaultValue:NO]];
24
+    [bottomTabs setTabBarHideShadow:[withDefault.bottomTabs.hideShadow getWithDefaultValue:NO]];
25
+    [bottomTabs setTabBarStyle:[RCTConvert UIBarStyle:[withDefault.bottomTabs.barStyle getWithDefaultValue:@"default"]]];
26
+}
27
+
28
+- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
29
+    [super mergeOptions:options resolvedOptions:currentOptions];
30
+    UITabBarController *bottomTabs = self.tabBarController;
31
+
32
+    if (options.bottomTabs.currentTabIndex.hasValue) {
33
+        [bottomTabs setCurrentTabIndex:options.bottomTabs.currentTabIndex.get];
34
+        [options.bottomTabs.currentTabIndex consume];
35
+    }
36
+
37
+    if (options.bottomTabs.currentTabId.hasValue) {
38
+        [bottomTabs setCurrentTabID:options.bottomTabs.currentTabId.get];
39
+        [options.bottomTabs.currentTabId consume];
40
+    }
41
+
42
+    if (options.bottomTabs.testID.hasValue) {
43
+        [bottomTabs setTabBarTestID:options.bottomTabs.testID.get];
44
+    }
45
+
46
+    if (options.bottomTabs.backgroundColor.hasValue) {
47
+        [self setTabBarBackgroundColor:options.bottomTabs.backgroundColor.get];
48
+    }
49
+
50
+    if (options.bottomTabs.barStyle.hasValue) {
51
+        [bottomTabs setTabBarStyle:[RCTConvert UIBarStyle:options.bottomTabs.barStyle.get]];
52
+    }
53
+
54
+    if (options.bottomTabs.translucent.hasValue) {
55
+        [bottomTabs setTabBarTranslucent:options.bottomTabs.translucent.get];
56
+    }
57
+
58
+    if (options.bottomTabs.hideShadow.hasValue) {
59
+        [bottomTabs setTabBarHideShadow:options.bottomTabs.hideShadow.get];
60
+    }
61
+
62
+    if (options.bottomTabs.visible.hasValue) {
63
+        if (options.bottomTabs.animate.hasValue) {
64
+            [bottomTabs setTabBarVisible:options.bottomTabs.visible.get animated:[options.bottomTabs.animate getWithDefaultValue:NO]];
65
+        } else {
66
+            [bottomTabs setTabBarVisible:options.bottomTabs.visible.get animated:NO];
67
+        }
68
+    }
69
+    
70
+    if (options.layout.backgroundColor.hasValue) {
71
+        [bottomTabs.view setBackgroundColor:options.layout.backgroundColor.get];
72
+    }
73
+}
74
+
75
+- (UITabBarController *)tabBarController {
76
+    return (UITabBarController *)self.boundViewController;
77
+}
78
+
79
+- (UITabBar *)tabBar {
80
+    return self.tabBarController.tabBar;
81
+}
82
+
83
+- (void)applyBackgroundColor:(UIColor *)backgroundColor translucent:(BOOL)translucent {
84
+    
85
+}
86
+
87
+- (void)setTabBarBackgroundColor:(UIColor *)backgroundColor {
88
+    
89
+}
90
+
91
+- (void)setTabBarTranslucent:(BOOL)translucent {
92
+    
93
+}
94
+
95
+@end

+ 2
- 0
lib/ios/RNNBottomTabsOptions.h View File

@@ -21,4 +21,6 @@
21 21
 @property (nonatomic, strong) Text* titleDisplayMode;
22 22
 @property (nonatomic, strong) BottomTabsAttachMode* tabsAttachMode;
23 23
 
24
+- (BOOL)shouldDrawBehind;
25
+
24 26
 @end

+ 6
- 0
lib/ios/RNNBottomTabsOptions.m View File

@@ -25,4 +25,10 @@
25 25
 	return self;
26 26
 }
27 27
 
28
+- (BOOL)shouldDrawBehind {
29
+    return [self.drawBehind getWithDefaultValue:NO] ||
30
+    [self.translucent getWithDefaultValue:NO] ||
31
+    ![self.visible getWithDefaultValue:YES];
32
+}
33
+
28 34
 @end

+ 2
- 8
lib/ios/RNNBottomTabsPresenter.h View File

@@ -1,11 +1,5 @@
1
-#import "RNNBasePresenter.h"
1
+#import "BottomTabsBasePresenter.h"
2 2
 
3
-@interface RNNBottomTabsPresenter : RNNBasePresenter
4
-
5
-- (void)setTabBarBackgroundColor:(UIColor *)backgroundColor;
6
-
7
-- (UITabBarController *)tabBarController;
8
-
9
-- (UITabBar *)tabBar;
3
+@interface RNNBottomTabsPresenter : BottomTabsBasePresenter
10 4
 
11 5
 @end

+ 5
- 78
lib/ios/RNNBottomTabsPresenter.m View File

@@ -1,91 +1,18 @@
1 1
 #import "RNNBottomTabsPresenter.h"
2
-#import "UITabBarController+RNNOptions.h"
3
-#import "UIViewController+LayoutProtocol.h"
4
-#import "UIViewController+Utils.h"
5 2
 
6 3
 @implementation RNNBottomTabsPresenter
7 4
 
8
-- (void)applyOptionsOnInit:(RNNNavigationOptions *)options {
9
-    [super applyOptionsOnInit:options];
10
-    UITabBarController *bottomTabs = self.tabBarController;
11
-    RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
12
-    [bottomTabs setCurrentTabIndex:[withDefault.bottomTabs.currentTabIndex getWithDefaultValue:0]];
13
-	if ([[withDefault.bottomTabs.titleDisplayMode getWithDefaultValue:@"alwaysShow"] isEqualToString:@"alwaysHide"]) {
14
-		[bottomTabs centerTabItems];
15
-	}
16
-}
17
-
18
-- (void)applyOptions:(RNNNavigationOptions *)options {
19
-    UITabBarController *bottomTabs = self.tabBarController;
20
-    RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
21
-
22
-    [bottomTabs setTabBarTestID:[withDefault.bottomTabs.testID getWithDefaultValue:nil]];
23
-    [bottomTabs setTabBarVisible:[withDefault.bottomTabs.visible getWithDefaultValue:YES] animated:[withDefault.bottomTabs.animate getWithDefaultValue:NO]];
24
-    
25
-    [bottomTabs.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
26
-    [self setTabBarBackgroundColor:[withDefault.bottomTabs.backgroundColor getWithDefaultValue:UIColor.whiteColor]];
27
-    [bottomTabs setTabBarTranslucent:[withDefault.bottomTabs.translucent getWithDefaultValue:NO]];
28
-    [bottomTabs setTabBarHideShadow:[withDefault.bottomTabs.hideShadow getWithDefaultValue:NO]];
29
-    [bottomTabs setTabBarStyle:[RCTConvert UIBarStyle:[withDefault.bottomTabs.barStyle getWithDefaultValue:@"default"]]];
30
-}
31
-
32
-- (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
33
-    [super mergeOptions:options resolvedOptions:currentOptions];
34
-    UITabBarController *bottomTabs = self.tabBarController;
35
-
36
-    if (options.bottomTabs.currentTabIndex.hasValue) {
37
-        [bottomTabs setCurrentTabIndex:options.bottomTabs.currentTabIndex.get];
38
-        [options.bottomTabs.currentTabIndex consume];
39
-    }
40
-
41
-    if (options.bottomTabs.currentTabId.hasValue) {
42
-        [bottomTabs setCurrentTabID:options.bottomTabs.currentTabId.get];
43
-        [options.bottomTabs.currentTabId consume];
44
-    }
45
-
46
-    if (options.bottomTabs.testID.hasValue) {
47
-        [bottomTabs setTabBarTestID:options.bottomTabs.testID.get];
48
-    }
49
-
50
-    if (options.bottomTabs.backgroundColor.hasValue) {
51
-        [self setTabBarBackgroundColor:options.bottomTabs.backgroundColor.get];
52
-    }
53
-
54
-    if (options.bottomTabs.barStyle.hasValue) {
55
-        [bottomTabs setTabBarStyle:[RCTConvert UIBarStyle:options.bottomTabs.barStyle.get]];
56
-    }
57
-
58
-    if (options.bottomTabs.translucent.hasValue) {
59
-        [bottomTabs setTabBarTranslucent:options.bottomTabs.translucent.get];
60
-    }
61
-
62
-    if (options.bottomTabs.hideShadow.hasValue) {
63
-        [bottomTabs setTabBarHideShadow:options.bottomTabs.hideShadow.get];
64
-    }
65
-
66
-    if (options.bottomTabs.visible.hasValue) {
67
-        if (options.bottomTabs.animate.hasValue) {
68
-            [bottomTabs setTabBarVisible:options.bottomTabs.visible.get animated:[options.bottomTabs.animate getWithDefaultValue:NO]];
69
-        } else {
70
-            [bottomTabs setTabBarVisible:options.bottomTabs.visible.get animated:NO];
71
-        }
72
-    }
73
-    
74
-    if (options.layout.backgroundColor.hasValue) {
75
-        [bottomTabs.view setBackgroundColor:options.layout.backgroundColor.get];
76
-    }
5
+- (void)applyBackgroundColor:(UIColor *)backgroundColor translucent:(BOOL)translucent {
6
+    [self setTabBarTranslucent:translucent];
7
+    [self setTabBarBackgroundColor:backgroundColor];
77 8
 }
78 9
 
79 10
 - (void)setTabBarBackgroundColor:(UIColor *)backgroundColor {
80 11
     self.tabBar.barTintColor = backgroundColor;
81 12
 }
82 13
 
83
-- (UITabBarController *)tabBarController {
84
-    return (UITabBarController *)self.boundViewController;
85
-}
86
-
87
-- (UITabBar *)tabBar {
88
-    return self.tabBarController.tabBar;
14
+- (void)setTabBarTranslucent:(BOOL)translucent {
15
+    self.tabBar.translucent = translucent;
89 16
 }
90 17
 
91 18
 @end

+ 9
- 9
lib/ios/RNNComponentPresenter.m View File

@@ -77,17 +77,17 @@
77 77
 }
78 78
 
79 79
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)options {
80
-	[super applyOptionsOnInit:options];
81
-	
82
-	UIViewController* viewController = self.boundViewController;
83
-	RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
80
+    [super applyOptionsOnInit:options];
84 81
     
85
-	[viewController setDrawBehindTopBar:[withDefault.topBar.drawBehind getWithDefaultValue:NO]];
86
-    [viewController setDrawBehindTabBar:[withDefault.bottomTabs.drawBehind getWithDefaultValue:NO] || ![withDefault.bottomTabs.visible getWithDefaultValue:YES]];
82
+    UIViewController* viewController = self.boundViewController;
83
+    RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
87 84
     
88
-	if ((withDefault.topBar.leftButtons || withDefault.topBar.rightButtons)) {
89
-		[_navigationButtons applyLeftButtons:withDefault.topBar.leftButtons rightButtons:withDefault.topBar.rightButtons defaultLeftButtonStyle:withDefault.topBar.leftButtonStyle defaultRightButtonStyle:withDefault.topBar.rightButtonStyle];
90
-	}
85
+    [viewController setDrawBehindTopBar:[withDefault.topBar shouldDrawBehind]];
86
+    [viewController setDrawBehindTabBar:[withDefault.bottomTabs shouldDrawBehind]];
87
+    
88
+    if ((withDefault.topBar.leftButtons || withDefault.topBar.rightButtons)) {
89
+        [_navigationButtons applyLeftButtons:withDefault.topBar.leftButtons rightButtons:withDefault.topBar.rightButtons defaultLeftButtonStyle:withDefault.topBar.leftButtonStyle defaultRightButtonStyle:withDefault.topBar.rightButtonStyle];
90
+    }
91 91
 }
92 92
 
93 93
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {

+ 2
- 0
lib/ios/RNNTopBarOptions.h View File

@@ -35,4 +35,6 @@
35 35
 @property (nonatomic, strong) RNNButtonOptions* leftButtonStyle;
36 36
 @property (nonatomic, strong) RNNButtonOptions* rightButtonStyle;
37 37
 
38
+- (BOOL)shouldDrawBehind;
39
+
38 40
 @end

+ 6
- 0
lib/ios/RNNTopBarOptions.m View File

@@ -60,5 +60,11 @@
60 60
 	return self;
61 61
 }
62 62
 
63
+- (BOOL)shouldDrawBehind {
64
+    return [self.drawBehind getWithDefaultValue:NO] ||
65
+    [self.background.translucent getWithDefaultValue:NO] ||
66
+    ![self.visible getWithDefaultValue:YES] ||
67
+    [self.largeTitle.visible getWithDefaultValue:NO];
68
+}
63 69
 
64 70
 @end

+ 8
- 0
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj View File

@@ -167,6 +167,8 @@
167 167
 		503A8A2623BD04410094D1C4 /* ElementTransitionsCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 503A8A2423BD04410094D1C4 /* ElementTransitionsCreator.m */; };
168 168
 		50415CBA20553B8E00BB682E /* RNNScreenTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = 50415CB820553B8E00BB682E /* RNNScreenTransition.h */; };
169 169
 		50415CBB20553B8E00BB682E /* RNNScreenTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 50415CB920553B8E00BB682E /* RNNScreenTransition.m */; };
170
+		5041DC3E2417BBBA0033312F /* BottomTabsBasePresenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 5041DC3C2417BBBA0033312F /* BottomTabsBasePresenter.h */; };
171
+		5041DC3F2417BBBA0033312F /* BottomTabsBasePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5041DC3D2417BBBA0033312F /* BottomTabsBasePresenter.m */; };
170 172
 		50451D052042DAEB00695F00 /* RNNPushAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 50451D032042DAEB00695F00 /* RNNPushAnimation.h */; };
171 173
 		50451D062042DAEB00695F00 /* RNNPushAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 50451D042042DAEB00695F00 /* RNNPushAnimation.m */; };
172 174
 		50451D092042E20600695F00 /* RNNAnimationsOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50451D072042E20600695F00 /* RNNAnimationsOptions.h */; };
@@ -653,6 +655,8 @@
653 655
 		503A8A2423BD04410094D1C4 /* ElementTransitionsCreator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ElementTransitionsCreator.m; sourceTree = "<group>"; };
654 656
 		50415CB820553B8E00BB682E /* RNNScreenTransition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNScreenTransition.h; sourceTree = "<group>"; };
655 657
 		50415CB920553B8E00BB682E /* RNNScreenTransition.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNScreenTransition.m; sourceTree = "<group>"; };
658
+		5041DC3C2417BBBA0033312F /* BottomTabsBasePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BottomTabsBasePresenter.h; sourceTree = "<group>"; };
659
+		5041DC3D2417BBBA0033312F /* BottomTabsBasePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BottomTabsBasePresenter.m; sourceTree = "<group>"; };
656 660
 		50451D032042DAEB00695F00 /* RNNPushAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNPushAnimation.h; sourceTree = "<group>"; };
657 661
 		50451D042042DAEB00695F00 /* RNNPushAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNPushAnimation.m; sourceTree = "<group>"; };
658 662
 		50451D072042E20600695F00 /* RNNAnimationsOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNAnimationsOptions.h; sourceTree = "<group>"; };
@@ -1395,6 +1399,8 @@
1395 1399
 				5022EDB82405226800852BA6 /* BottomTabAppearancePresenter.m */,
1396 1400
 				5022EDC324054C6100852BA6 /* BottomTabsAppearancePresenter.h */,
1397 1401
 				5022EDC424054C6100852BA6 /* BottomTabsAppearancePresenter.m */,
1402
+				5041DC3C2417BBBA0033312F /* BottomTabsBasePresenter.h */,
1403
+				5041DC3D2417BBBA0033312F /* BottomTabsBasePresenter.m */,
1398 1404
 				5022EDBB2405237100852BA6 /* BottomTabPresenterCreator.h */,
1399 1405
 				5022EDBC2405237100852BA6 /* BottomTabPresenterCreator.m */,
1400 1406
 				5022EDC724054C8A00852BA6 /* BottomTabsPresenterCreator.h */,
@@ -1705,6 +1711,7 @@
1705 1711
 				50E38DDD23A7A306009817F6 /* AnimatedImageView.h in Headers */,
1706 1712
 				7B4928081E70415400555040 /* RNNCommandsHandler.h in Headers */,
1707 1713
 				50495942216F5E5D006D2B81 /* NullBool.h in Headers */,
1714
+				5041DC3E2417BBBA0033312F /* BottomTabsBasePresenter.h in Headers */,
1708 1715
 				263905AE1E4C6F440023D7D3 /* MMDrawerBarButtonItem.h in Headers */,
1709 1716
 				5012241621736667000F5F98 /* Color.h in Headers */,
1710 1717
 				7365071121E4B16F004E020F /* RCTConvert+UIBarButtonSystemItem.h in Headers */,
@@ -2199,6 +2206,7 @@
2199 2206
 				30987D71FB4FEEAC8D8978E8 /* DotIndicatorParser.m in Sources */,
2200 2207
 				50CED44E239EA78700C42EE2 /* TopBarAppearancePresenter.m in Sources */,
2201 2208
 				30987B23F288EB3A78B7F27C /* RNNDotIndicatorPresenter.m in Sources */,
2209
+				5041DC3F2417BBBA0033312F /* BottomTabsBasePresenter.m in Sources */,
2202 2210
 				5022EDC224053C9F00852BA6 /* TabBarItemAppearanceCreator.m in Sources */,
2203 2211
 				507ACB1223F44D1E00829911 /* RNNComponentView.m in Sources */,
2204 2212
 				5017D9F3239D2FCB00B74047 /* BottomTabsOnSwitchToTabAttacher.m in Sources */,

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

@@ -1,6 +1,7 @@
1 1
 #import "TopBarPresenter.h"
2 2
 #import "UIImage+tint.h"
3 3
 #import "RNNFontAttributesCreator.h"
4
+#import "UIColor+RNNUtils.h"
4 5
 
5 6
 @implementation TopBarPresenter
6 7
 
@@ -148,7 +149,7 @@
148 149
 }
149 150
 
150 151
 - (BOOL)transparent {
151
-    return (self.backgroundColor && CGColorGetAlpha(self.backgroundColor.CGColor) == 0.0);
152
+    return self.backgroundColor.isTransparent;
152 153
 }
153 154
 
154 155
 @end

+ 2
- 1
lib/ios/Utils/UIColor+RNNUtils.h View File

@@ -2,4 +2,5 @@
2 2
 
3 3
 @interface UIColor (RNNUtils)
4 4
 - (NSString *)toHex;
5
-@end
5
+- (BOOL)isTransparent;
6
+@end

+ 5
- 0
lib/ios/Utils/UIColor+RNNUtils.m View File

@@ -8,6 +8,11 @@
8 8
 @implementation UIColor (RNNUtils)
9 9
 
10 10
 #pragma mark Public
11
+
12
+- (BOOL)isTransparent {
13
+    return (CGColorGetAlpha(self.CGColor) == 0.0);
14
+}
15
+
11 16
 - (NSString *)toHex {
12 17
     const CGFloat *components = CGColorGetComponents([self CGColor]);
13 18
 

+ 2
- 4
playground/ios/NavigationIOS12Tests/RNNBottomTabsPresenterTest.m View File

@@ -25,8 +25,7 @@
25 25
 - (void)testApplyOptions_shouldSetDefaultEmptyOptions {
26 26
     RNNNavigationOptions *emptyOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
27 27
     [[self.boundViewController expect] setTabBarTestID:nil];
28
-    [self.uut setTabBarBackgroundColor:nil];
29
-    [[self.boundViewController expect] setTabBarTranslucent:NO];
28
+	[[(id)self.uut expect] applyBackgroundColor:nil translucent:NO];
30 29
     [[self.boundViewController expect] setTabBarHideShadow:NO];
31 30
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
32 31
     [[self.boundViewController expect] setTabBarVisible:YES animated:NO];
@@ -44,8 +43,7 @@
44 43
     initialOptions.bottomTabs.barStyle = [[Text alloc] initWithValue:@"black"];
45 44
 
46 45
     [[self.boundViewController expect] setTabBarTestID:@"testID"];
47
-    [self.uut setTabBarBackgroundColor:[UIColor redColor]];
48
-    [[self.boundViewController expect] setTabBarTranslucent:NO];
46
+    [[(id)self.uut expect] applyBackgroundColor:nil translucent:[UIColor redColor]];
49 47
     [[self.boundViewController expect] setTabBarHideShadow:YES];
50 48
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleBlack];
51 49
     [[self.boundViewController expect] setTabBarVisible:NO animated:NO];

+ 2
- 4
playground/ios/NavigationTests/RNNBottomTabsAppearancePresenterTest.m View File

@@ -33,8 +33,7 @@
33 33
 - (void)testApplyOptions_shouldSetDefaultEmptyOptions {
34 34
     RNNNavigationOptions *emptyOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
35 35
     [[self.boundViewController expect] setTabBarTestID:nil];
36
-    [self.uut setTabBarBackgroundColor:nil];
37
-    [[self.boundViewController expect] setTabBarTranslucent:NO];
36
+    [[(id)self.uut expect] applyBackgroundColor:nil translucent:NO];
38 37
     [[self.boundViewController expect] setTabBarHideShadow:NO];
39 38
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
40 39
     [[self.boundViewController expect] setTabBarVisible:YES animated:NO];
@@ -52,8 +51,7 @@
52 51
     initialOptions.bottomTabs.barStyle = [[Text alloc] initWithValue:@"black"];
53 52
 
54 53
     [[self.boundViewController expect] setTabBarTestID:@"testID"];
55
-    [self.uut setTabBarBackgroundColor:[UIColor redColor]];
56
-    [[self.boundViewController expect] setTabBarTranslucent:NO];
54
+    [[(id)self.uut expect] applyBackgroundColor:nil translucent:[UIColor redColor]];
57 55
     [[self.boundViewController expect] setTabBarHideShadow:YES];
58 56
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleBlack];
59 57
     [[self.boundViewController expect] setTabBarVisible:NO animated:NO];