Permalink
Browse files

badgeColor property

Summary:
**motivation:**

make possible to use new tab bar item property

![1476033023249](https://cloud.githubusercontent.com/assets/1488195/19222245/f4c1292c-8e64-11e6-8a29-7b95b45e153c.jpg)
Closes #10315

Differential Revision: D4000011

Pulled By: mmmulani

fbshipit-source-id: 5c00b0b5f56c551cc4151fcc030da6c8bc1a3649
  • Loading branch information...
skv-headless authored and Facebook Github Bot committed Nov 29, 2016
1 parent 065af66 commit a50bafa678f116435e12a7e457a423886b0b90c7
@@ -73,6 +73,7 @@ class TabBarExample extends React.Component {
<TabBarIOS.Item
systemIcon="history"
badge={this.state.notifCount > 0 ? this.state.notifCount : undefined}
badgeColor="black"
selected={this.state.selectedTab === 'redTab'}
onPress={() => {
this.setState({
@@ -16,6 +16,7 @@ var React = require('React');
var StaticContainer = require('StaticContainer.react');
var StyleSheet = require('StyleSheet');
var View = require('View');
var ColorPropType = require('ColorPropType');
var requireNativeComponent = require('requireNativeComponent');
@@ -29,6 +30,10 @@ class TabBarItemIOS extends React.Component {
React.PropTypes.string,
React.PropTypes.number,
]),
/**
* Background color for the badge. Available since iOS 10.
*/
badgeColor: ColorPropType,
/**
* Items comes with a few predefined system icons. Note that if you are
* using them, the title and selectedIcon will be overridden with the
@@ -105,6 +105,13 @@ - (void)setSelectedIcon:(UIImage *)selectedIcon
}
}
- (void)setBadgeColor:(UIColor *)bagdeColor
{
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
_barItem.badgeColor = bagdeColor;
#endif
}
- (UIViewController *)reactViewController
{
return self.superview.reactViewController;
@@ -28,6 +28,7 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(selectedIcon, UIImage)
RCT_EXPORT_VIEW_PROPERTY(systemIcon, UITabBarSystemItem)
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(badgeColor, UIColor)
RCT_CUSTOM_VIEW_PROPERTY(title, NSString, RCTTabBarItem)
{
view.barItem.title = json ? [RCTConvert NSString:json] : defaultView.barItem.title;

0 comments on commit a50bafa

Please sign in to comment.