Permalink
Browse files

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 #10241

Differential Revision: D4168046

Pulled By: mmmulani

fbshipit-source-id: aa0c9b36cbdbc50a9a60bbbc658355c3066ba1a5
  • Loading branch information...
1 parent 188093a commit 837814240bea4db30b902493617b80ff4a2c8b3d @skv-headless skv-headless committed with Facebook Github Bot Nov 29, 2016
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -58,6 +58,7 @@ class TabBarExample extends React.Component {
<TabBarIOS
unselectedTintColor="yellow"
tintColor="white"
+ unselectedItemTintColor="red"
barTintColor="darkslateblue">
<TabBarIOS.Item
title="Blue Tab"
@@ -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',
@@ -43,6 +44,10 @@ class TabBarIOS extends React.Component {
*/
tintColor: ColorPropType,
/**
+ * Color of unselected tab icons. Available since iOS 10.
+ */
+ unselectedItemTintColor: ColorPropType,
+ /**
* Background color of the tab bar
*/
barTintColor: ColorPropType,
@@ -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}
@@ -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
@@ -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.