({
leadingIcon,
trailingIcon,
dense,
title,
disabled,
background,
onPress,
style,
containerStyle,
contentStyle,
titleStyle,
rippleColor: customRippleColor,
testID = 'menu-item',
accessibilityLabel,
accessibilityState,
theme: themeOverrides,
titleMaxFontSizeMultiplier = 1.5,
hitSlop,
}: Props)
| 131 | * ``` |
| 132 | */ |
| 133 | const MenuItem = ({ |
| 134 | leadingIcon, |
| 135 | trailingIcon, |
| 136 | dense, |
| 137 | title, |
| 138 | disabled, |
| 139 | background, |
| 140 | onPress, |
| 141 | style, |
| 142 | containerStyle, |
| 143 | contentStyle, |
| 144 | titleStyle, |
| 145 | rippleColor: customRippleColor, |
| 146 | testID = 'menu-item', |
| 147 | accessibilityLabel, |
| 148 | accessibilityState, |
| 149 | theme: themeOverrides, |
| 150 | titleMaxFontSizeMultiplier = 1.5, |
| 151 | hitSlop, |
| 152 | }: Props) => { |
| 153 | const theme = useInternalTheme(themeOverrides); |
| 154 | const { titleColor, iconColor, rippleColor } = getMenuItemColor({ |
| 155 | theme, |
| 156 | disabled, |
| 157 | customRippleColor, |
| 158 | }); |
| 159 | const { isV3 } = theme; |
| 160 | |
| 161 | const containerPadding = isV3 ? 12 : 8; |
| 162 | |
| 163 | const iconWidth = isV3 ? 24 : 40; |
| 164 | |
| 165 | const minWidth = MIN_WIDTH - (isV3 ? 12 : 16); |
| 166 | |
| 167 | const maxWidth = getContentMaxWidth({ |
| 168 | isV3, |
| 169 | iconWidth, |
| 170 | leadingIcon, |
| 171 | trailingIcon, |
| 172 | }); |
| 173 | |
| 174 | const titleTextStyle = { |
| 175 | color: titleColor, |
| 176 | ...(isV3 ? theme.fonts.bodyLarge : {}), |
| 177 | }; |
| 178 | |
| 179 | const newAccessibilityState = { ...accessibilityState, disabled }; |
| 180 | |
| 181 | return ( |
| 182 | <TouchableRipple |
| 183 | style={[ |
| 184 | styles.container, |
| 185 | { paddingHorizontal: containerPadding }, |
| 186 | dense && styles.md3DenseContainer, |
| 187 | style, |
| 188 | ]} |
| 189 | onPress={onPress} |
| 190 | disabled={disabled} |
nothing calls this directly
no test coverage detected
searching dependent graphs…