Added tabStyle property (#1667)

This commit is contained in:
Gabriel Bull
2017-05-24 02:03:23 -04:00
parent cc99ac0ea4
commit 4896895950
2 changed files with 11 additions and 1 deletions

View File

@@ -104,6 +104,7 @@ Several options get passed to the underlying router to modify navigation logic:
- `showLabel` - whether to show label for tab, default is true
- `style` - style object for the tab bar
- `labelStyle` - style object for the tab label
- `tabStyle` - style object for the tab
Example:
@@ -142,6 +143,9 @@ tabBarOptions: {
labelStyle: {
fontSize: 12,
},
tabStyle: {
width: 100,
},
style: {
backgroundColor: 'blue',
},

View File

@@ -35,6 +35,7 @@ type Props = {
showLabel: boolean,
style?: Style,
labelStyle?: Style,
tabStyle?: Style,
showIcon: boolean,
};
@@ -127,6 +128,7 @@ export default class TabBarBottom
activeBackgroundColor,
inactiveBackgroundColor,
style,
tabStyle,
} = this.props;
const { routes } = navigation.state;
// Prepend '-1', so there are always at least 2 items in inputRange
@@ -153,7 +155,11 @@ export default class TabBarBottom
onPress={() => jumpToIndex(index)}
>
<Animated.View
style={[styles.tab, { backgroundColor, justifyContent }]}
style={[
styles.tab,
{ backgroundColor, justifyContent },
tabStyle,
]}
>
{this._renderIcon(scene)}
{this._renderLabel(scene)}