fix: add flex: 1 to drawer content

This commit is contained in:
satyajit.happy
2019-10-11 17:49:15 +02:00
parent c7da1e4145
commit 2b57702a62
3 changed files with 19 additions and 15 deletions

View File

@@ -133,10 +133,6 @@ export type DrawerContentOptions = {
* Background color for the inactive items in the drawer.
*/
inactiveBackgroundColor?: string;
/**
* Style object for the content section.
*/
contentContainerStyle?: ViewStyle;
/**
* Style object for the single item, which can contain an icon and/or a label.
*/
@@ -153,6 +149,14 @@ export type DrawerContentOptions = {
* Style object to overwrite `Text` style of the inactive label.
*/
inactiveLabelStyle?: StyleProp<TextStyle>;
/**
* Style object for the content section.
*/
contentContainerStyle?: StyleProp<ViewStyle>;
/**
* Style object for the wrapper view.
*/
style?: StyleProp<ViewStyle>;
};
export type DrawerNavigationEventMap = {

View File

@@ -1,14 +1,12 @@
import * as React from 'react';
import { ScrollView } from 'react-native';
import { ScrollView, StyleSheet } from 'react-native';
import { useSafeArea } from 'react-native-safe-area-context';
import DrawerItemList from './DrawerItemList';
import { DrawerContentComponentProps } from '../types';
export default function DrawerContent({
state,
navigation,
descriptors,
contentContainerStyle,
style,
drawerPosition,
...rest
}: DrawerContentComponentProps) {
@@ -24,13 +22,15 @@ export default function DrawerContent({
},
contentContainerStyle,
]}
style={[styles.container, style]}
>
<DrawerItemList
state={state}
navigation={navigation}
descriptors={descriptors}
{...rest}
/>
<DrawerItemList {...rest} />
</ScrollView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});

View File

@@ -11,7 +11,7 @@ import {
DrawerContentOptions,
} from '../types';
type Props = DrawerContentOptions & {
type Props = Omit<DrawerContentOptions, 'contentContainerStyle' | 'style'> & {
state: DrawerNavigationState;
navigation: DrawerNavigationHelpers;
descriptors: DrawerDescriptorMap;