Possibility to overwrite label's style if defined as string. (#731)

* Added option to overwrite label style for only if label is as string defined in navigationOptions in DrawerNavigation.

* update doc for labelStyle prop

* change title to label
This commit is contained in:
Grzegorz Mandziak 2017-03-30 05:50:56 +02:00 committed by Satyajit Sahoo
parent 84d284d591
commit 3cee5c30fa
2 changed files with 4 additions and 1 deletions

View File

@ -137,6 +137,7 @@ const styles = StyleSheet.create({
- `inactiveTintColor` - label and icon color of the inactive label
- `inactiveBackgroundColor` - background color of the inactive label
- `style` - style object for the content section
- `labelStyle` - style object to overwrite `Text` style inside content section, when your label is a string
#### Example:

View File

@ -29,6 +29,7 @@ type Props = {
getLabel: (scene: DrawerScene) => ?(React.Element<*> | string);
renderIcon: (scene: DrawerScene) => ?React.Element<*>;
style?: Style;
labelStyle?: Style;
};
/**
@ -43,6 +44,7 @@ const DrawerNavigatorItems = ({
getLabel,
renderIcon,
style,
labelStyle,
}: Props) => (
<View style={[styles.container, style]}>
{navigation.state.routes.map((route: *, index: number) => {
@ -69,7 +71,7 @@ const DrawerNavigatorItems = ({
) : null}
{typeof label === 'string'
? (
<Text style={[styles.label, { color }]}>
<Text style={[styles.label, { color }, labelStyle]}>
{label}
</Text>
)