mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 19:44:13 +00:00
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 https://github.com/facebook/react-native/pull/10315 Differential Revision: D4000011 Pulled By: mmmulani fbshipit-source-id: 5c00b0b5f56c551cc4151fcc030da6c8bc1a3649
This commit is contained in:
parent
065af66deb
commit
a50bafa678
@ -73,6 +73,7 @@ class TabBarExample extends React.Component {
|
|||||||
<TabBarIOS.Item
|
<TabBarIOS.Item
|
||||||
systemIcon="history"
|
systemIcon="history"
|
||||||
badge={this.state.notifCount > 0 ? this.state.notifCount : undefined}
|
badge={this.state.notifCount > 0 ? this.state.notifCount : undefined}
|
||||||
|
badgeColor="black"
|
||||||
selected={this.state.selectedTab === 'redTab'}
|
selected={this.state.selectedTab === 'redTab'}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -16,6 +16,7 @@ var React = require('React');
|
|||||||
var StaticContainer = require('StaticContainer.react');
|
var StaticContainer = require('StaticContainer.react');
|
||||||
var StyleSheet = require('StyleSheet');
|
var StyleSheet = require('StyleSheet');
|
||||||
var View = require('View');
|
var View = require('View');
|
||||||
|
var ColorPropType = require('ColorPropType');
|
||||||
|
|
||||||
var requireNativeComponent = require('requireNativeComponent');
|
var requireNativeComponent = require('requireNativeComponent');
|
||||||
|
|
||||||
@ -29,6 +30,10 @@ class TabBarItemIOS extends React.Component {
|
|||||||
React.PropTypes.string,
|
React.PropTypes.string,
|
||||||
React.PropTypes.number,
|
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
|
* Items comes with a few predefined system icons. Note that if you are
|
||||||
* using them, the title and selectedIcon will be overridden with the
|
* using them, the title and selectedIcon will be overridden with the
|
||||||
|
@ -105,6 +105,13 @@ RCT_ENUM_CONVERTER(UITabBarSystemItem, (@{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (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
|
- (UIViewController *)reactViewController
|
||||||
{
|
{
|
||||||
return self.superview.reactViewController;
|
return self.superview.reactViewController;
|
||||||
|
@ -28,6 +28,7 @@ RCT_EXPORT_VIEW_PROPERTY(icon, UIImage)
|
|||||||
RCT_EXPORT_VIEW_PROPERTY(selectedIcon, UIImage)
|
RCT_EXPORT_VIEW_PROPERTY(selectedIcon, UIImage)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(systemIcon, UITabBarSystemItem)
|
RCT_EXPORT_VIEW_PROPERTY(systemIcon, UITabBarSystemItem)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
||||||
|
RCT_EXPORT_VIEW_PROPERTY(badgeColor, UIColor)
|
||||||
RCT_CUSTOM_VIEW_PROPERTY(title, NSString, RCTTabBarItem)
|
RCT_CUSTOM_VIEW_PROPERTY(title, NSString, RCTTabBarItem)
|
||||||
{
|
{
|
||||||
view.barItem.title = json ? [RCTConvert NSString:json] : defaultView.barItem.title;
|
view.barItem.title = json ? [RCTConvert NSString:json] : defaultView.barItem.title;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user