mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-25 01:28:16 +00:00
Add showIcon
to tabBarOptions
so that icons can be hidden on iOS (#291)
This commit is contained in:
parent
a7002f2151
commit
546fc657d5
@ -42,6 +42,7 @@ type Props = {
|
||||
showLabel: boolean;
|
||||
style: any;
|
||||
labelStyle?: any;
|
||||
showIcon: boolean;
|
||||
};
|
||||
|
||||
export default class TabBarBottom extends PureComponent<DefaultProps, Props, void> {
|
||||
@ -53,6 +54,7 @@ export default class TabBarBottom extends PureComponent<DefaultProps, Props, voi
|
||||
inactiveTintColor: '#929292', // Default inactive tint color in iOS 10
|
||||
inactiveBackgroundColor: 'transparent',
|
||||
showLabel: true,
|
||||
showIcon: true,
|
||||
};
|
||||
|
||||
props: Props;
|
||||
@ -98,7 +100,11 @@ export default class TabBarBottom extends PureComponent<DefaultProps, Props, voi
|
||||
activeTintColor,
|
||||
inactiveTintColor,
|
||||
renderIcon,
|
||||
showIcon,
|
||||
} = this.props;
|
||||
if (showIcon === false) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<TabBarIcon
|
||||
position={position}
|
||||
@ -136,9 +142,10 @@ export default class TabBarBottom extends PureComponent<DefaultProps, Props, voi
|
||||
inputRange,
|
||||
outputRange,
|
||||
});
|
||||
const justifyContent = this.props.showIcon ? 'flex-end' : 'center';
|
||||
return (
|
||||
<TouchableWithoutFeedback key={route.key} onPress={() => jumpToIndex(index)}>
|
||||
<Animated.View style={[styles.tab, { backgroundColor }]}>
|
||||
<Animated.View style={[styles.tab, { backgroundColor, justifyContent }]}>
|
||||
{this._renderIcon(scene)}
|
||||
{this._renderLabel(scene)}
|
||||
</Animated.View>
|
||||
|
Loading…
x
Reference in New Issue
Block a user