[TabBarIOS] Add translucent property to TabBarIOS

Summary:
To be on par with NavigatorIOS, I added the translucent property to TabBarIOS.

Usage:
```
<TabBarIOS
 translucent={false} // default is true
/>
```
Closes https://github.com/facebook/react-native/pull/1937
Github Author: Jean Regisser <jean.regisser@gmail.com>
This commit is contained in:
Jean Regisser 2015-07-14 08:05:08 -07:00
parent 691a1dafd1
commit 9936a2406d
4 changed files with 17 additions and 2 deletions

View File

@ -32,7 +32,11 @@ var TabBarIOS = React.createClass({
/** /**
* Background color of the tab bar * Background color of the tab bar
*/ */
barTintColor: React.PropTypes.string barTintColor: React.PropTypes.string,
/**
* A Boolean value that indicates whether the tab bar is translucent
*/
translucent: React.PropTypes.bool,
}, },
render: function() { render: function() {
@ -40,7 +44,8 @@ var TabBarIOS = React.createClass({
<RCTTabBar <RCTTabBar
style={[styles.tabGroup, this.props.style]} style={[styles.tabGroup, this.props.style]}
tintColor={this.props.tintColor} tintColor={this.props.tintColor}
barTintColor={this.props.barTintColor}> barTintColor={this.props.barTintColor}
translucent={this.props.translucent !== false}>
{this.props.children} {this.props.children}
</RCTTabBar> </RCTTabBar>
); );

View File

@ -15,6 +15,7 @@
@property (nonatomic, strong) UIColor *tintColor; @property (nonatomic, strong) UIColor *tintColor;
@property (nonatomic, strong) UIColor *barTintColor; @property (nonatomic, strong) UIColor *barTintColor;
@property (nonatomic, assign) BOOL translucent;
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER; - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER;

View File

@ -140,6 +140,14 @@ RCT_NOT_IMPLEMENTED(-initWithCoder:(NSCoder *)aDecoder)
_tabController.tabBar.tintColor = tintColor; _tabController.tabBar.tintColor = tintColor;
} }
- (BOOL)translucent {
return _tabController.tabBar.isTranslucent;
}
- (void)setTranslucent:(BOOL)translucent {
_tabController.tabBar.translucent = translucent;
}
#pragma mark - UITabBarControllerDelegate #pragma mark - UITabBarControllerDelegate
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

View File

@ -23,5 +23,6 @@ RCT_EXPORT_MODULE()
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(translucent, BOOL)
@end @end