import { useSharedValue } from 'react-native-reanimated'; import type { AnimationRootDisableAll } from '../types'; import { useCombinedAnimationDisabledState } from './useCombinedAnimationDisabledState'; export interface UsePopupRootAnimationOptions { animation?: AnimationRootDisableAll; } /** * Root animation hook for popup-like components (Dialog, Select, BottomSheet, Popover, etc.) * Manages component state transitions and animation coordination via a shared * `progress` value: 0 = idle/closed, 1 = fully open, 2 = dismissed. */ export function usePopupRootAnimation(options: UsePopupRootAnimationOptions) { const isAllAnimationsDisabled = useCombinedAnimationDisabledState(options.animation); const progress = useSharedValue(0); const isDragging = useSharedValue(false); const isGestureReleaseAnimationRunning = useSharedValue(false); return { isAllAnimationsDisabled, progress, isDragging, isGestureReleaseAnimationRunning, }; }