Skip to content

Commit 8378142

Browse files
skv-headlessFacebook Github Bot
authored andcommitted
unselectedItemTintColor property available since iOS10
Summary: **motivation:** make possible to use new tab bar property. ![1475603157804](https://cloud.githubusercontent.com/assets/1488195/19085757/8b7cc8a4-8a7c-11e6-82c7-7c76313fb545.jpg) It is not working for previous versions but not failing. https://developer.apple.com/reference/uikit/uitabbar/1648949-unselecteditemtintcolor Closes facebook#10241 Differential Revision: D4168046 Pulled By: mmmulani fbshipit-source-id: aa0c9b36cbdbc50a9a60bbbc658355c3066ba1a5
1 parent 188093a commit 8378142

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed
Loading

Examples/UIExplorer/js/TabBarIOSExample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class TabBarExample extends React.Component {
5858
<TabBarIOS
5959
unselectedTintColor="yellow"
6060
tintColor="white"
61+
unselectedItemTintColor="red"
6162
barTintColor="darkslateblue">
6263
<TabBarIOS.Item
6364
title="Blue Tab"

Libraries/Components/TabBarIOS/TabBarIOS.ios.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class TabBarIOS extends React.Component {
2424
style?: $FlowFixMe,
2525
unselectedTintColor?: $FlowFixMe,
2626
tintColor?: $FlowFixMe,
27+
unselectedItemTintColor?: $FlowFixMe,
2728
barTintColor?: $FlowFixMe,
2829
translucent?: boolean,
2930
itemPositioning?: 'fill' | 'center' | 'auto',
@@ -42,6 +43,10 @@ class TabBarIOS extends React.Component {
4243
* Color of the currently selected tab icon
4344
*/
4445
tintColor: ColorPropType,
46+
/**
47+
* Color of unselected tab icons. Available since iOS 10.
48+
*/
49+
unselectedItemTintColor: ColorPropType,
4550
/**
4651
* Background color of the tab bar
4752
*/
@@ -67,6 +72,7 @@ class TabBarIOS extends React.Component {
6772
<RCTTabBar
6873
style={[styles.tabGroup, this.props.style]}
6974
unselectedTintColor={this.props.unselectedTintColor}
75+
unselectedItemTintColor={this.props.unselectedItemTintColor}
7076
tintColor={this.props.tintColor}
7177
barTintColor={this.props.barTintColor}
7278
itemPositioning={this.props.itemPositioning}

React/Views/RCTTabBar.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ - (void)setTranslucent:(BOOL)translucent {
149149
_tabController.tabBar.translucent = translucent;
150150
}
151151

152+
- (void)setUnselectedItemTintColor:(UIColor *)unselectedItemTintColor {
153+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
154+
if ([_tabController.tabBar respondsToSelector:@selector(unselectedItemTintColor)]) {
155+
_tabController.tabBar.unselectedItemTintColor = unselectedItemTintColor;
156+
}
157+
#endif
158+
}
159+
152160
- (UITabBarItemPositioning)itemPositoning
153161
{
154162
#if TARGET_OS_TV

React/Views/RCTTabBarManager.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ - (UIView *)view
3636
RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor)
3737
RCT_EXPORT_VIEW_PROPERTY(translucent, BOOL)
3838
RCT_EXPORT_VIEW_PROPERTY(itemPositioning, UITabBarItemPositioning)
39+
RCT_EXPORT_VIEW_PROPERTY(unselectedItemTintColor, UIColor)
3940

4041
@end

0 commit comments

Comments
 (0)