MCPcopy Create free account
hub / github.com/callstack/react-native-paper / DrawerSection

Function DrawerSection

src/components/Drawer/DrawerSection.tsx:66–115  ·  view source on GitHub ↗
({
  children,
  title,
  theme: themeOverrides,
  style,
  showDivider = true,
  titleMaxFontSizeMultiplier,
  ...rest
}: Props)

Source from the content-addressed store, hash-verified

64 * ```
65 */
66const DrawerSection = ({
67 children,
68 title,
69 theme: themeOverrides,
70 style,
71 showDivider = true,
72 titleMaxFontSizeMultiplier,
73 ...rest
74}: Props) => {
75 const theme = useInternalTheme(themeOverrides);
76 const { isV3 } = theme;
77 const titleColor = isV3
78 ? theme.colors.onSurfaceVariant
79 : color(theme.colors.text).alpha(0.54).rgb().string();
80 const titleMargin = isV3 ? 28 : 16;
81 const font = isV3 ? theme.fonts.titleSmall : theme.fonts.medium;
82
83 return (
84 <View style={[styles.container, style]} {...rest}>
85 {title && (
86 <View style={[styles.titleContainer, isV3 && styles.v3TitleContainer]}>
87 {title && (
88 <Text
89 variant="titleSmall"
90 numberOfLines={1}
91 style={[
92 {
93 color: titleColor,
94 marginLeft: titleMargin,
95 ...font,
96 },
97 ]}
98 maxFontSizeMultiplier={titleMaxFontSizeMultiplier}
99 >
100 {title}
101 </Text>
102 )}
103 </View>
104 )}
105 {children}
106 {showDivider && (
107 <Divider
108 {...(isV3 && { horizontalInset: true, bold: true })}
109 style={[styles.divider, isV3 && styles.v3Divider]}
110 theme={theme}
111 />
112 )}
113 </View>
114 );
115};
116
117DrawerSection.displayName = 'Drawer.Section';
118

Callers

nothing calls this directly

Calls 1

useInternalThemeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…