import * as React from 'react'; import { View, ViewStyle, StyleSheet, StyleProp, TextStyle, } from 'react-native'; import ListSubheader from './ListSubheader'; import { withTheme } from '../../core/theming'; type Props = React.ComponentPropsWithRef & { /** * Title text for the section. */ title?: string; /** * Content of the section. */ children: React.ReactNode; /** * @optional */ theme: ReactNativePaper.Theme; /** * Style that is passed to Title element. */ titleStyle?: StyleProp; style?: StyleProp; }; /** * A component used to group list items. * *
* *
* * ## Usage * ```js * import * as React from 'react'; * import { List } from 'react-native-paper'; * * const MyComponent = () => ( * * Some title * } /> * } * /> * * ); * * export default MyComponent; * ``` */ const ListSection = ({ children, title, titleStyle, style, ...rest }: Props) => ( {title ? {title} : null} {children} ); ListSection.displayName = 'List.Section'; const styles = StyleSheet.create({ container: { marginVertical: 8, }, }); export default withTheme(ListSection);