import { useCallback } from 'react'; import { Pressable } from 'react-native'; import { CheckFill } from 'rn-motion-ui-icons/icons/check-fill'; import { usePressState } from '../../../hooks/use-press-state'; import { useReducedMotion } from '../../../hooks/use-reduced-motion'; import { cn } from '../../../lib/cn'; import { FOCUS_VISIBLE_RING } from '../../../lib/focus-ring'; import { MotiView } from '../../../moti/components/view'; import { MOTION_SNAPPY, TIMING_FAST, TIMING_INSTANT } from '../../../theme/motion'; import { ThemedIcon } from '../../icon/themed-icon'; import { Text } from '../../typography/Text/text'; import type { ActionFABItem } from './action-fab'; type ActionFABOptionProps = { item: ActionFABItem; rank: number; close: () => void }; /** Content-width action pill. Rank zero sits nearest the trigger and enters first. */ export function ActionFABOption({ item, rank, close }: ActionFABOptionProps) { const reduce = useReducedMotion(); const { pressed, pressHandlers } = usePressState(); const handlePress = useCallback(() => { if (item.disabled) return; close(); item.onPress(); }, [item, close]); const token = item.destructive ? 'danger' : 'foreground'; const distance = 16 + Math.min(rank, 5) * 10; return ( {item.icon ? : null} {item.label} {item.selected ? : null} ); }