From 9936a2406d4c886abfeca50b2c8527e354ab654e Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Tue, 14 Jul 2015 08:05:08 -0700 Subject: [PATCH] [TabBarIOS] Add translucent property to TabBarIOS Summary: To be on par with NavigatorIOS, I added the translucent property to TabBarIOS. Usage: ``` ``` Closes https://github.com/facebook/react-native/pull/1937 Github Author: Jean Regisser --- Libraries/Components/TabBarIOS/TabBarIOS.ios.js | 9 +++++++-- React/Views/RCTTabBar.h | 1 + React/Views/RCTTabBar.m | 8 ++++++++ React/Views/RCTTabBarManager.m | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Libraries/Components/TabBarIOS/TabBarIOS.ios.js b/Libraries/Components/TabBarIOS/TabBarIOS.ios.js index 1910c67ca8..0be39a8f15 100644 --- a/Libraries/Components/TabBarIOS/TabBarIOS.ios.js +++ b/Libraries/Components/TabBarIOS/TabBarIOS.ios.js @@ -32,7 +32,11 @@ var TabBarIOS = React.createClass({ /** * 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() { @@ -40,7 +44,8 @@ var TabBarIOS = React.createClass({ + barTintColor={this.props.barTintColor} + translucent={this.props.translucent !== false}> {this.props.children} ); diff --git a/React/Views/RCTTabBar.h b/React/Views/RCTTabBar.h index 6f491ca08a..5c24b90392 100644 --- a/React/Views/RCTTabBar.h +++ b/React/Views/RCTTabBar.h @@ -15,6 +15,7 @@ @property (nonatomic, strong) UIColor *tintColor; @property (nonatomic, strong) UIColor *barTintColor; +@property (nonatomic, assign) BOOL translucent; - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER; diff --git a/React/Views/RCTTabBar.m b/React/Views/RCTTabBar.m index 06df7bad6f..a4b55975c9 100644 --- a/React/Views/RCTTabBar.m +++ b/React/Views/RCTTabBar.m @@ -140,6 +140,14 @@ RCT_NOT_IMPLEMENTED(-initWithCoder:(NSCoder *)aDecoder) _tabController.tabBar.tintColor = tintColor; } +- (BOOL)translucent { + return _tabController.tabBar.isTranslucent; +} + +- (void)setTranslucent:(BOOL)translucent { + _tabController.tabBar.translucent = translucent; +} + #pragma mark - UITabBarControllerDelegate - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController diff --git a/React/Views/RCTTabBarManager.m b/React/Views/RCTTabBarManager.m index 2290c78c74..7b96162465 100644 --- a/React/Views/RCTTabBarManager.m +++ b/React/Views/RCTTabBarManager.m @@ -23,5 +23,6 @@ RCT_EXPORT_MODULE() RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor) +RCT_EXPORT_VIEW_PROPERTY(translucent, BOOL) @end