Browse Source

[v2] Support UIBarStyle for topBar and bottomTabs (#3519)

* Support UIBarStyle for topBar and bottomTabs

* Added to docs
Birkir Rafn Guðjónsson 6 years ago
parent
commit
4d1adedb93

+ 2
- 0
docs/docs/styling.md View File

@@ -173,6 +173,7 @@ Navigation.mergeOptions(this.props.componentId, {
173 173
   backgroundImage: require('background.png'),
174 174
   rootBackgroundImage: require('rootBackground.png'),
175 175
   topBar: {
176
+    barStyle: 'default' | 'black',
176 177
     translucent: true,
177 178
     transparent: false,
178 179
     noBorder: false,
@@ -189,6 +190,7 @@ Navigation.mergeOptions(this.props.componentId, {
189 190
     },
190 191
   },
191 192
   bottomTabs: {
193
+    barStyle: 'default' | 'black',
192 194
     translucent: true,
193 195
     hideShadow: false
194 196
   },

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

@@ -11,6 +11,7 @@
11 11
 
12 12
 @property (nonatomic, strong) NSNumber* tabColor;
13 13
 @property (nonatomic, strong) NSNumber* selectedTabColor;
14
+@property (nonatomic, strong) NSString* barStyle;
14 15
 @property (nonatomic, strong) NSNumber* translucent;
15 16
 @property (nonatomic, strong) NSNumber* hideShadow;
16 17
 @property (nonatomic, strong) NSNumber* backgroundColor;

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

@@ -39,6 +39,12 @@ extern const NSInteger BLUR_TOPBAR_TAG;
39 39
 		viewController.tabBarController.tabBar.barTintColor = nil;
40 40
 	}
41 41
 	
42
+	if (self.barStyle) {
43
+		viewController.tabBarController.tabBar.barStyle = [RCTConvert UIBarStyle:self.barStyle];
44
+	} else {
45
+		viewController.tabBarController.tabBar.barStyle = UIBarStyleDefault;
46
+	}
47
+
42 48
 	if (self.translucent) {
43 49
 		viewController.tabBarController.tabBar.translucent = [self.translucent boolValue];
44 50
 	} else {

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

@@ -14,6 +14,7 @@
14 14
 @property (nonatomic, strong) NSNumber* visible;
15 15
 @property (nonatomic, strong) NSNumber* hideOnScroll;
16 16
 @property (nonatomic, strong) NSNumber* buttonColor;
17
+@property (nonatomic, strong) NSString* barStyle;
17 18
 @property (nonatomic, strong) NSNumber* translucent;
18 19
 @property (nonatomic, strong) NSNumber* transparent;
19 20
 @property (nonatomic, strong) NSNumber* drawBehind;

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

@@ -120,6 +120,12 @@ extern const NSInteger BLUR_TOPBAR_TAG;
120 120
 		disableTopBarTransparent();
121 121
 	}
122 122
 	
123
+	if (self.barStyle) {
124
+		viewController.navigationController.navigationBar.barStyle = [RCTConvert UIBarStyle:self.barStyle];
125
+	} else {
126
+		viewController.navigationController.navigationBar.barStyle = UIBarStyleDefault;
127
+	}
128
+
123 129
 	if (self.translucent) {
124 130
 		viewController.navigationController.navigationBar.translucent = [self.translucent boolValue];
125 131
 	} else {