(
{
disabled,
compact,
mode = 'text',
dark,
loading,
icon,
buttonColor: customButtonColor,
textColor: customTextColor,
rippleColor: customRippleColor,
children,
accessibilityLabel,
accessibilityHint,
accessibilityRole = 'button',
hitSlop,
onPress,
onPressIn,
onPressOut,
onLongPress,
delayLongPress,
style,
theme: themeOverrides,
uppercase: uppercaseProp,
contentStyle,
labelStyle,
testID = 'button',
accessible,
background,
maxFontSizeMultiplier,
touchableRef,
...rest
}: Props,
ref: React.ForwardedRef<View>
)
| 177 | * ``` |
| 178 | */ |
| 179 | const Button = ( |
| 180 | { |
| 181 | disabled, |
| 182 | compact, |
| 183 | mode = 'text', |
| 184 | dark, |
| 185 | loading, |
| 186 | icon, |
| 187 | buttonColor: customButtonColor, |
| 188 | textColor: customTextColor, |
| 189 | rippleColor: customRippleColor, |
| 190 | children, |
| 191 | accessibilityLabel, |
| 192 | accessibilityHint, |
| 193 | accessibilityRole = 'button', |
| 194 | hitSlop, |
| 195 | onPress, |
| 196 | onPressIn, |
| 197 | onPressOut, |
| 198 | onLongPress, |
| 199 | delayLongPress, |
| 200 | style, |
| 201 | theme: themeOverrides, |
| 202 | uppercase: uppercaseProp, |
| 203 | contentStyle, |
| 204 | labelStyle, |
| 205 | testID = 'button', |
| 206 | accessible, |
| 207 | background, |
| 208 | maxFontSizeMultiplier, |
| 209 | touchableRef, |
| 210 | ...rest |
| 211 | }: Props, |
| 212 | ref: React.ForwardedRef<View> |
| 213 | ) => { |
| 214 | const theme = useInternalTheme(themeOverrides); |
| 215 | const isMode = React.useCallback( |
| 216 | (modeToCompare: ButtonMode) => { |
| 217 | return mode === modeToCompare; |
| 218 | }, |
| 219 | [mode] |
| 220 | ); |
| 221 | const { roundness, isV3, animation } = theme; |
| 222 | const uppercase = uppercaseProp ?? !theme.isV3; |
| 223 | const isWeb = Platform.OS === 'web'; |
| 224 | |
| 225 | const hasPassedTouchHandler = hasTouchHandler({ |
| 226 | onPress, |
| 227 | onPressIn, |
| 228 | onPressOut, |
| 229 | onLongPress, |
| 230 | }); |
| 231 | |
| 232 | const isElevationEntitled = |
| 233 | !disabled && (isV3 ? isMode('elevated') : isMode('contained')); |
| 234 | const initialElevation = isV3 ? 1 : 2; |
| 235 | const activeElevation = isV3 ? 2 : 8; |
| 236 |
nothing calls this directly
no test coverage detected
searching dependent graphs…