import { Easing } from 'react-native-reanimated'; import type { DragConfig } from '../types'; /** Enable verbose per-frame drag debug logging. */ export const VERBOSE_DRAG_DEBUG = false; /** Enable targeted drop/hover debug logs (hover index changes + drop math). */ export const DROP_DEBUG_LOGS = false; /** Enable drop commit detection logs (UI vs JS commit). */ export const DROP_COMMIT_DEBUG = false; /** Unified animation timing configuration for consistency across all drag hooks. */ export const ANIMATION_TIMING = { SHIFT_DURATION: 100, DROP_SETTLE_DURATION: 150, SHADOW_FADE_DURATION: 100, COMPENSATION_DURATION: 100, SHIFT_TO_ZERO_DURATION: 120, OVERLAY_SETTLE_DURATION: 120, RETURN_TO_ORIGIN_DURATION: 150, DROP_SQUISH_DURATION: 80, ELEVATION_UP_DURATION: 150, ELEVATION_DOWN_DURATION: 150, } as const; /** Spring animation configurations for drag interactions. */ export const SPRING_CONFIGS = { DRAG_SCALE: { damping: 15, stiffness: 400 }, DROP_BOUNCE: { damping: 12, stiffness: 300 }, ELEVATION: { damping: 20, stiffness: 300 }, } as const; /** Timing animation configurations for drag interactions. */ export const TIMING_CONFIGS = { OVERLAY_SETTLE: { duration: ANIMATION_TIMING.OVERLAY_SETTLE_DURATION, easing: Easing.out(Easing.ease) }, RETURN_TO_ORIGIN: { duration: ANIMATION_TIMING.RETURN_TO_ORIGIN_DURATION, easing: Easing.out(Easing.ease) }, } as const; /** Configurable thresholds for drag calculations. */ export const DRAG_THRESHOLDS = { /** Offset factor for hover position calculation (0-0.5, where 0 = exact center). */ HOVER_OFFSET_FACTOR: 0.1, /** Hysteresis threshold - pointer must move this fraction into next item. */ HOVER_SWITCH_THRESHOLD: 0.6, /** Z-index for elevated (dragged) items. */ ELEVATED_Z_INDEX: 999, /** Minimum shift value to consider significant. */ SHIFT_SIGNIFICANCE_THRESHOLD: 1, /** Epsilon for floating point comparisons (~1/1000 pixel). */ FLOAT_EPSILON: 0.001, } as const; /** * Default drag configuration. * All values can be overridden via AnimatedFlashList config prop. */ export const DEFAULT_DRAG_CONFIG: DragConfig = { itemHeight: 95, dragScale: 1.03, dragShadowOpacity: 0.25, itemVerticalMargin: 8, longPressDuration: 200, edgeThreshold: 80, maxScrollSpeed: 10, dropBounceScale: 0.97, dropHapticEnabled: true, }; /** Create a merged drag config from defaults and overrides. */ export function createDragConfig(overrides?: Partial): DragConfig { if (!overrides) return DEFAULT_DRAG_CONFIG; return { ...DEFAULT_DRAG_CONFIG, ...overrides }; }