Implement labelStyle for TabBarBottom (#173)

This commit is contained in:
Jakob Hilden
2017-02-04 13:33:38 +01:00
committed by Satyajit Sahoo
parent 567b99a2d8
commit 8d722f43e9
2 changed files with 5 additions and 1 deletions

View File

@@ -106,12 +106,14 @@ Several options get passed to the underlying router to modify navigation logic:
- `inactiveTintColor` - label and icon color of the inactive tab
- `inactiveBackgroundColor` - background color of the inactive tab
- `style` - style object for the tab bar
- `labelStyle` - style object for the tab label
Example:
```js
tabBarOptions: {
activeTintColor: '#e91e63',
labelStyle: { fontSize: 12 },
style: {
backgroundColor: 'blue',
}

View File

@@ -39,6 +39,7 @@ type Props = {
getLabelText: (scene: TabScene) => string;
renderIcon: (scene: TabScene) => React.Element<*>;
style: any;
labelStyle?: any;
};
export default class TabBarBottom extends PureComponent<DefaultProps, Props, void> {
@@ -59,6 +60,7 @@ export default class TabBarBottom extends PureComponent<DefaultProps, Props, voi
navigationState,
activeTintColor,
inactiveTintColor,
labelStyle,
} = this.props;
const { index } = scene;
const { routes } = navigationState;
@@ -74,7 +76,7 @@ export default class TabBarBottom extends PureComponent<DefaultProps, Props, voi
const label = this.props.getLabelText(scene);
if (typeof label === 'string') {
return (
<Animated.Text style={[styles.label, { color }]}>
<Animated.Text style={[styles.label, labelStyle, { color }]}>
{label}
</Animated.Text>
);