Skip to content

Commit 2157de6

Browse files
authored
TabBarItem - remove deprecated prop (#1554)
1 parent 48dc82b commit 2157de6

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

generatedTypes/src/components/tabBar/TabBarItem.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ export interface TabBarItemProps {
2323
*/
2424
labelStyle?: StyleProp<TextStyle>;
2525
/**
26-
* Badge component props to display next the item label
26+
* Badge component's props to display next the item label
2727
*/
28-
badge?: BadgeProps;
2928
badgeProps?: BadgeProps;
3029
/**
3130
* Pass to render a leading element

src/components/tabBar/TabBarItem.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
ViewStyle,
1111
TextStyle
1212
} from 'react-native';
13-
import {LogService} from '../../services';
1413
import {Constants} from '../../helpers';
1514
import {Colors, Typography, Spacings} from '../../style';
1615
import {asBaseComponent} from '../../commons/new';
@@ -20,6 +19,7 @@ import Text from '../text';
2019
import Image from '../image';
2120
import Badge, {BadgeProps} from '../badge';
2221

22+
2323
const INDICATOR_HEIGHT = 2;
2424
const INDICATOR_BG_COLOR = Colors.primary;
2525
const HORIZONTAL_PADDING = Constants.isTablet ? Spacings.s7 : Spacings.s5;
@@ -46,9 +46,8 @@ export interface TabBarItemProps {
4646
*/
4747
labelStyle?: StyleProp<TextStyle>;
4848
/**
49-
* Badge component props to display next the item label
49+
* Badge component's props to display next the item label
5050
*/
51-
badge?: BadgeProps; //TODO: remove after deprecation
5251
badgeProps?: BadgeProps;
5352
/**
5453
* Pass to render a leading element
@@ -131,10 +130,6 @@ class TabBarItem extends PureComponent<TabBarItemProps, State> {
131130
indicatorOpacity: props.selected ? new Animated.Value(1) : new Animated.Value(0),
132131
selected: props.selected
133132
};
134-
135-
if (!_.isEmpty(props.badge)) {
136-
LogService.deprecationWarn({component: 'TabBarItem', oldProp: 'badge', newProp: 'badgeProps'});
137-
}
138133
}
139134

140135
componentDidUpdate(prevProps: TabBarItemProps) {
@@ -193,7 +188,6 @@ class TabBarItem extends PureComponent<TabBarItemProps, State> {
193188
label,
194189
labelStyle,
195190
badgeProps,
196-
badge,
197191
leadingAccessory,
198192
trailingAccessory,
199193
uppercase,
@@ -212,8 +206,7 @@ class TabBarItem extends PureComponent<TabBarItemProps, State> {
212206
const iconTint = iconColor || this.getColorFromStyle(labelStyle) || this.getColorFromStyle(styles.label);
213207
const iconSelectedTint =
214208
iconSelectedColor || this.getColorFromStyle(selectedLabelStyle) || this.getColorFromStyle(styles.selectedLabel);
215-
const badgeFinalProps = badgeProps || badge;
216-
const badgeSize = _.get(badgeFinalProps, 'size', 16);
209+
const badgeSize = _.get(badgeProps, 'size', 16);
217210

218211
return (
219212
<TouchableOpacity
@@ -247,12 +240,12 @@ class TabBarItem extends PureComponent<TabBarItemProps, State> {
247240
</Text>
248241
)}
249242
{children}
250-
{!_.isNil(badgeFinalProps) && (
243+
{!_.isNil(badgeProps) && (
251244
<Badge
252245
backgroundColor={Colors.red30}
253-
{...badgeFinalProps}
246+
{...badgeProps}
254247
size={badgeSize}
255-
containerStyle={[styles.badge, badgeFinalProps.containerStyle]}
248+
containerStyle={[styles.badge, badgeProps.containerStyle]}
256249
/>
257250
)}
258251
{trailingAccessory}

0 commit comments

Comments
 (0)