mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-05-14 15:52:37 +08:00
fix: add flex: 1 to drawer content
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
DrawerContentOptions,
|
||||
} from '../types';
|
||||
|
||||
type Props = DrawerContentOptions & {
|
||||
type Props = Omit<DrawerContentOptions, 'contentContainerStyle' | 'style'> & {
|
||||
state: DrawerNavigationState;
|
||||
navigation: DrawerNavigationHelpers;
|
||||
descriptors: DrawerDescriptorMap;
|
||||
|
||||
Reference in New Issue
Block a user