mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 17:30:38 +08:00
unselectedItemTintColor property available since iOS10
Summary: **motivation:** make possible to use new tab bar property.  It is not working for previous versions but not failing. https://developer.apple.com/reference/uikit/uitabbar/1648949-unselecteditemtintcolor Closes https://github.com/facebook/react-native/pull/10241 Differential Revision: D4168046 Pulled By: mmmulani fbshipit-source-id: aa0c9b36cbdbc50a9a60bbbc658355c3066ba1a5
This commit is contained in:
committed by
Facebook Github Bot
parent
188093ae29
commit
837814240b
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
@@ -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',
|
||||
@@ -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
|
||||
*/
|
||||
@@ -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 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
_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 @@ RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user