({
icon,
label,
active,
disabled,
theme: themeOverrides,
rippleColor: customRippleColor,
style,
onPress,
background,
accessibilityLabel,
right,
labelMaxFontSizeMultiplier,
hitSlop,
...rest
}: Props)
| 92 | * ``` |
| 93 | */ |
| 94 | const DrawerItem = ({ |
| 95 | icon, |
| 96 | label, |
| 97 | active, |
| 98 | disabled, |
| 99 | theme: themeOverrides, |
| 100 | rippleColor: customRippleColor, |
| 101 | style, |
| 102 | onPress, |
| 103 | background, |
| 104 | accessibilityLabel, |
| 105 | right, |
| 106 | labelMaxFontSizeMultiplier, |
| 107 | hitSlop, |
| 108 | ...rest |
| 109 | }: Props) => { |
| 110 | const theme = useInternalTheme(themeOverrides); |
| 111 | const { roundness, isV3 } = theme; |
| 112 | |
| 113 | const backgroundColor = active |
| 114 | ? isV3 |
| 115 | ? theme.colors.secondaryContainer |
| 116 | : color(theme.colors.primary).alpha(0.12).rgb().string() |
| 117 | : undefined; |
| 118 | const contentColor = active |
| 119 | ? isV3 |
| 120 | ? theme.colors.onSecondaryContainer |
| 121 | : theme.colors.primary |
| 122 | : isV3 |
| 123 | ? theme.colors.onSurfaceVariant |
| 124 | : color(theme.colors.text).alpha(0.68).rgb().string(); |
| 125 | |
| 126 | const labelMargin = icon ? (isV3 ? 12 : 32) : 0; |
| 127 | const borderRadius = (isV3 ? 7 : 1) * roundness; |
| 128 | const rippleColor = isV3 |
| 129 | ? color(contentColor).alpha(0.12).rgb().string() |
| 130 | : undefined; |
| 131 | const font = isV3 ? theme.fonts.labelLarge : theme.fonts.medium; |
| 132 | |
| 133 | return ( |
| 134 | <View {...rest}> |
| 135 | <TouchableRipple |
| 136 | borderless |
| 137 | disabled={disabled} |
| 138 | background={background} |
| 139 | onPress={onPress} |
| 140 | style={[ |
| 141 | styles.container, |
| 142 | { backgroundColor, borderRadius }, |
| 143 | isV3 && styles.v3Container, |
| 144 | style, |
| 145 | ]} |
| 146 | accessibilityRole="button" |
| 147 | accessibilityState={{ selected: active }} |
| 148 | accessibilityLabel={accessibilityLabel} |
| 149 | rippleColor={customRippleColor || rippleColor} |
| 150 | theme={theme} |
| 151 | hitSlop={hitSlop} |
nothing calls this directly
no test coverage detected
searching dependent graphs…