mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 17:18:09 +00:00
Added iconContainerStyle prop to Drawer (#2825)
* Added iconContainerStyle prop to Drawer * Updated DrawerNavigator docs * Improved code quality * Improved code with eslint
This commit is contained in:
parent
e6505054bd
commit
468a8ca9be
@ -148,6 +148,8 @@ const styles = StyleSheet.create({
|
||||
- `itemsContainerStyle` - style object for the content section
|
||||
- `itemStyle` - style object for the single item, which can contain an Icon and/or a Label
|
||||
- `labelStyle` - style object to overwrite `Text` style inside content section, when your label is a string
|
||||
- `iconContainerStyle` - style object to overwrite `View` icon container styles.
|
||||
|
||||
#### Example:
|
||||
|
||||
```js
|
||||
@ -155,6 +157,9 @@ contentOptions: {
|
||||
activeTintColor: '#e91e63',
|
||||
itemsContainerStyle: {
|
||||
marginVertical: 0,
|
||||
},
|
||||
iconContainerStyle: {
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -29,6 +29,7 @@ type Props = {
|
||||
itemsContainerStyle?: ViewStyleProp,
|
||||
itemStyle?: ViewStyleProp,
|
||||
labelStyle?: TextStyleProp,
|
||||
iconContainerStyle?: ViewStyleProp,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -48,6 +49,7 @@ const DrawerNavigatorItems = ({
|
||||
itemsContainerStyle,
|
||||
itemStyle,
|
||||
labelStyle,
|
||||
iconContainerStyle,
|
||||
}: Props) => (
|
||||
<View style={[styles.container, itemsContainerStyle]}>
|
||||
{items.map((route: NavigationRoute, index: number) => {
|
||||
@ -69,7 +71,13 @@ const DrawerNavigatorItems = ({
|
||||
>
|
||||
<View style={[styles.item, { backgroundColor }, itemStyle]}>
|
||||
{icon ? (
|
||||
<View style={[styles.icon, focused ? null : styles.inactiveIcon]}>
|
||||
<View
|
||||
style={[
|
||||
styles.icon,
|
||||
focused ? null : styles.inactiveIcon,
|
||||
iconContainerStyle,
|
||||
]}
|
||||
>
|
||||
{icon}
|
||||
</View>
|
||||
) : null}
|
||||
|
Loading…
x
Reference in New Issue
Block a user