import color from 'color'; import * as React from 'react'; import { View, ViewStyle, StyleSheet, StyleProp } from 'react-native'; import Text from '../Typography/Text'; import Divider from '../Divider'; import { withTheme } from '../../core/theming'; type Props = React.ComponentPropsWithRef & { /** * Title to show as the header for the section. */ title?: string; /** * Content of the `Drawer.Section`. */ children: React.ReactNode; style?: StyleProp; /** * @optional */ theme: ReactNativePaper.Theme; }; /** * A component to group content inside a navigation drawer. * *
*
* *
*
* * ## Usage * ```js * import * as React from 'react'; * import { Drawer } from 'react-native-paper'; * * const MyComponent = () => { * const [active, setActive] = React.useState(''); * * * return ( * * setActive('first')} * /> * setActive('second')} * /> * * ); * }; * * export default MyComponent; * ``` */ const DrawerSection = ({ children, title, theme, style, ...rest }: Props) => { const { colors, fonts } = theme; const titleColor = color(colors.text).alpha(0.54).rgb().string(); const font = fonts.medium; return ( {title && ( {title} )} {children} ); }; DrawerSection.displayName = 'Drawer.Section'; const styles = StyleSheet.create({ container: { marginBottom: 4, }, titleContainer: { height: 40, justifyContent: 'center', }, divider: { marginTop: 4, }, }); export default withTheme(DrawerSection);