Skip to content

Commit

Permalink
unselectedItemTintColor property available since iOS10
Browse files Browse the repository at this point in the history
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 #10241

Differential Revision: D4168046

Pulled By: mmmulani

fbshipit-source-id: aa0c9b36cbdbc50a9a60bbbc658355c3066ba1a5
  • Loading branch information
skv-headless authored and Facebook Github Bot committed Nov 29, 2016
1 parent 188093a commit 8378142
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Examples/UIExplorer/js/TabBarIOSExample.js
Expand Up @@ -58,6 +58,7 @@ class TabBarExample extends React.Component {
<TabBarIOS
unselectedTintColor="yellow"
tintColor="white"
unselectedItemTintColor="red"
barTintColor="darkslateblue">
<TabBarIOS.Item
title="Blue Tab"
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Components/TabBarIOS/TabBarIOS.ios.js
Expand Up @@ -24,6 +24,7 @@ class TabBarIOS extends React.Component {
style?: $FlowFixMe,
unselectedTintColor?: $FlowFixMe,
tintColor?: $FlowFixMe,
unselectedItemTintColor?: $FlowFixMe,
barTintColor?: $FlowFixMe,
translucent?: boolean,
itemPositioning?: 'fill' | 'center' | 'auto',
Expand All @@ -42,6 +43,10 @@ class TabBarIOS extends React.Component {
* Color of the currently selected tab icon
*/
tintColor: ColorPropType,
/**
* Color of unselected tab icons. Available since iOS 10.
*/
unselectedItemTintColor: ColorPropType,
/**
* Background color of the tab bar
*/
Expand All @@ -67,6 +72,7 @@ class TabBarIOS extends React.Component {
<RCTTabBar
style={[styles.tabGroup, this.props.style]}
unselectedTintColor={this.props.unselectedTintColor}
unselectedItemTintColor={this.props.unselectedItemTintColor}
tintColor={this.props.tintColor}
barTintColor={this.props.barTintColor}
itemPositioning={this.props.itemPositioning}
Expand Down
8 changes: 8 additions & 0 deletions React/Views/RCTTabBar.m
Expand Up @@ -149,6 +149,14 @@ - (void)setTranslucent:(BOOL)translucent {
_tabController.tabBar.translucent = translucent;
}

- (void)setUnselectedItemTintColor:(UIColor *)unselectedItemTintColor {
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
if ([_tabController.tabBar respondsToSelector:@selector(unselectedItemTintColor)]) {
_tabController.tabBar.unselectedItemTintColor = unselectedItemTintColor;
}
#endif
}

- (UITabBarItemPositioning)itemPositoning
{
#if TARGET_OS_TV
Expand Down
1 change: 1 addition & 0 deletions React/Views/RCTTabBarManager.m
Expand Up @@ -36,5 +36,6 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(translucent, BOOL)
RCT_EXPORT_VIEW_PROPERTY(itemPositioning, UITabBarItemPositioning)
RCT_EXPORT_VIEW_PROPERTY(unselectedItemTintColor, UIColor)

@end

0 comments on commit 8378142

Please sign in to comment.