From 97883f10ccd72b4a71be7ebfed4d2a63cf3953ca Mon Sep 17 00:00:00 2001 From: Dave Pack Date: Wed, 1 Nov 2017 15:48:39 -0700 Subject: [PATCH] Override `forceInset` on DrawerItems. (#2872) Fixes second part of issue #2854. `itemsContainerForceInset` takes the same object as `forceInset` on SafeAreaView. It overrides the SafeAreaView container in DrawerItems. --- .../react-navigation/docs/api/navigators/DrawerNavigator.md | 1 + .../react-navigation/src/views/Drawer/DrawerNavigatorItems.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-navigation/docs/api/navigators/DrawerNavigator.md b/packages/react-navigation/docs/api/navigators/DrawerNavigator.md index 10970b82..bd759db9 100644 --- a/packages/react-navigation/docs/api/navigators/DrawerNavigator.md +++ b/packages/react-navigation/docs/api/navigators/DrawerNavigator.md @@ -145,6 +145,7 @@ const styles = StyleSheet.create({ - `inactiveTintColor` - label and icon color of the inactive label - `inactiveBackgroundColor` - background color of the inactive label - `onItemPress(route)` - function to be invoked when an item is pressed +- `itemsContainerForceInset` - override default forceInset on the SafeAreaView that wraps the items container component - `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 diff --git a/packages/react-navigation/src/views/Drawer/DrawerNavigatorItems.js b/packages/react-navigation/src/views/Drawer/DrawerNavigatorItems.js index 7350f224..3ed4427e 100644 --- a/packages/react-navigation/src/views/Drawer/DrawerNavigatorItems.js +++ b/packages/react-navigation/src/views/Drawer/DrawerNavigatorItems.js @@ -26,6 +26,7 @@ type Props = { getLabel: (scene: DrawerScene) => ?(React.Node | string), renderIcon: (scene: DrawerScene) => ?React.Node, onItemPress: (info: DrawerItem) => void, + itemsContainerForceInset?: Object, itemsContainerStyle?: ViewStyleProp, itemStyle?: ViewStyleProp, labelStyle?: TextStyleProp, @@ -46,12 +47,13 @@ const DrawerNavigatorItems = ({ getLabel, renderIcon, onItemPress, + itemsContainerForceInset = { horizontal: 'never', top: 'always' }, itemsContainerStyle, itemStyle, labelStyle, iconContainerStyle, }: Props) => ( - + {items.map((route: NavigationRoute, index: number) => { const focused = activeItemKey === route.key;