import { FilledIconButton, FilledTonalIconButton, Host, IconButton, } from "@expo/ui/jetpack-compose"; import { size } from "@expo/ui/jetpack-compose/modifiers"; import { View } from "react-native"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; import { useAndroidControlSizing } from "./useAndroidControlSizing"; import { SymbolView, type AppSymbolName } from "./AppSymbol"; export function MaterialIconButton(props: { readonly accessibilityLabel: string; readonly icon: AppSymbolName; readonly onPress?: () => void; readonly disabled?: boolean; readonly selected?: boolean; readonly variant?: "standard" | "primary" | "tonal" | "danger"; readonly tintColorClassName?: string; }) { const { themeAppearance, themeVariables: colors } = useAppearancePreferences(); const { iconSize, buttonSize } = useAndroidControlSizing(); const variant = props.variant ?? "standard"; const Component = variant === "standard" ? IconButton : variant === "tonal" ? FilledTonalIconButton : FilledIconButton; const containerColor = variant === "primary" ? colors["--color-primary"] : variant === "danger" ? colors["--color-danger"] : colors["--color-secondary"]; const iconTint = props.disabled ? "accent-icon-subtle" : variant === "primary" ? "accent-primary-foreground" : variant === "danger" ? "accent-danger-foreground" : variant === "tonal" ? "accent-secondary-foreground" : (props.tintColorClassName ?? "accent-foreground"); return ( { if (!props.disabled) props.onPress?.(); }} style={{ width: buttonSize, height: buttonSize }} > {null} {/* Keep RN SVG measurement outside Compose; the native button owns touch and ripple. */} ); }