mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 17:18:09 +00:00
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:
parent
84d284d591
commit
3cee5c30fa
@ -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:
|
||||
|
||||
|
@ -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>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user