mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-06 22:39:41 +08:00
Implement labelStyle for TabBarBottom (#173)
This commit is contained in:
committed by
Satyajit Sahoo
parent
567b99a2d8
commit
8d722f43e9
@@ -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',
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user