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
   backgroundImage: require('background.png'),
173
   backgroundImage: require('background.png'),
174
   rootBackgroundImage: require('rootBackground.png'),
174
   rootBackgroundImage: require('rootBackground.png'),
175
   topBar: {
175
   topBar: {
176
+    barStyle: 'default' | 'black',
176
     translucent: true,
177
     translucent: true,
177
     transparent: false,
178
     transparent: false,
178
     noBorder: false,
179
     noBorder: false,
189
     },
190
     },
190
   },
191
   },
191
   bottomTabs: {
192
   bottomTabs: {
193
+    barStyle: 'default' | 'black',
192
     translucent: true,
194
     translucent: true,
193
     hideShadow: false
195
     hideShadow: false
194
   },
196
   },

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

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

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

39
 		viewController.tabBarController.tabBar.barTintColor = nil;
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
 	if (self.translucent) {
48
 	if (self.translucent) {
43
 		viewController.tabBarController.tabBar.translucent = [self.translucent boolValue];
49
 		viewController.tabBarController.tabBar.translucent = [self.translucent boolValue];
44
 	} else {
50
 	} else {

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

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

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

120
 		disableTopBarTransparent();
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
 	if (self.translucent) {
129
 	if (self.translucent) {
124
 		viewController.navigationController.navigationBar.translucent = [self.translucent boolValue];
130
 		viewController.navigationController.navigationBar.translucent = [self.translucent boolValue];
125
 	} else {
131
 	} else {