// Metro module 4607 (f4608). import { forwardRef, useMemo } from "react"; import * as _Module17 from "react-native"; import { IOS_POINTER_STYLE } from "../../Styles/native/styleConstants"; import { useThemeContext, ThemeContextProvider } from "../../../../_bundle/Module3901"; import { createStyles } from "../../Styles/native/createStyles"; import Module712 from "../../../../_bundle/Module712"; import { useButtonPressAnimationProps } from "./ButtonHooks.native"; import ReanimatedRexport from "../../../../modules/reanimated/ReanimatedRexport"; import { isNotNullish } from "../../../../utils/GlobalUtils"; import { isAndroid } from "../../../../utils/PlatformUtils"; let AnimatedComponent, AnimatedComponent2; const _excluded = ["style"]; const { Pressable, TouchableOpacity } = _Module17; const useStyles = createStyles((a0) => ({ button: { ...a0 === "primary-overlay" ? Module712.shadows.SHADOW_BUTTON_OVERLAY : {} }, disabled: { opacity: 0.5 } })); AnimatedComponent = ReanimatedRexport.createAnimatedComponent(Pressable); AnimatedComponent2 = ReanimatedRexport.createAnimatedComponent(TouchableOpacity); const r43 = forwardRef(function(a0, a1) { const { children, style, variant = "primary" } = a0; let disabled2 = a0.disabled; if (disabled2 === void 0) { disabled2 = false; } let loading = a0.loading; if (loading === void 0) { loading = false; } const busy = loading; const pressed = a0.pressed; let onPress = a0.onPress; const { onPressDisabled, onPressIn: onPressIn2, onPressOut: onPressOut2, onLongPress, onLayout, accessible } = a0; let accessibilityRole = a0.accessibilityRole; const { accessibilityLabel, accessibilityHint, accessibilityValue, accessibilityState, accessibilityActions, onAccessibilityAction, accessibilityElementsHidden, importantForAccessibility, pointerEvents, hitSlop, scaleAmountInPx } = a0; const styles = useStyles(variant); const disabled = disabled2 ? onPressDisabled == null : disabled2; if (disabled2) { onPress = onPressDisabled; } if (onPress == null) { onPress = void 0; } const buttonPressAnimationProps = useButtonPressAnimationProps(pressed, scaleAmountInPx, onLayout, onPressIn2, onPressOut2); const { style: style2, ...rest } = buttonPressAnimationProps; const r52 = pressed == null ? { animatedScaleStyles: void 0, buttonAnimationProps: { onLayout, onPressIn: onPressIn2, onPressOut: onPressOut2 } } : { animatedScaleStyles: style2, buttonAnimationProps: rest }; const { animatedScaleStyles, buttonAnimationProps } = r52; const memo = useMemo(() => ({ ...accessibilityState, disabled, busy }), [accessibilityState, disabled, busy]); const theme = useThemeContext().theme; const theme2 = variant !== "primary-overlay" ? variant === "secondary-overlay" ? theme === "light" ? "dark" : void 0 : void 0 : "light"; const r72 = theme2 != null ? {children} : children; const style3 = [styles.button, style, , , ,]; if (disabled2) { disabled2 = styles.disabled; } style3[2] = disabled2; style3[3] = animatedScaleStyles; style3[4] = IOS_POINTER_STYLE; if (accessibilityRole !== "none") { if (accessibilityRole == null) { accessibilityRole = "button"; } return {r72}; } const accessibilityLabel2 = accessibilityElementsHidden ? "" : [accessibilityLabel, accessibilityHint].filter(isNotNullish).join(", "); let r98 = accessible; if (r98 == null) { r98 = isAndroid(); } return { const onPressIn2 = buttonAnimationProps.onPressIn; if (onPressIn2 != null) { onPressIn2.call(buttonAnimationProps, event); } }} onPressOut={(event) => { const onPressOut2 = buttonAnimationProps.onPressOut; if (onPressOut2 != null) { onPressOut2.call(buttonAnimationProps, event); } }} hitSlop={hitSlop}>{r72}; }); export { r43 as BaseButton };