import React, { useMemo, useRef } from 'react'; import { ScrollView as ReactNativeScrollView, View as ReactNativeView } from 'react-native'; const View = (props: React.ComponentProps) => React.createElement(ReactNativeView, props); const ScrollView = (props: React.ComponentProps) => React.createElement(ReactNativeScrollView, props); const Animated = { View, ScrollView, createAnimatedComponent: (comp: T) => comp, }; export default Animated; export { Animated }; export function useSharedValue(init: number) { return useMemo(() => ({ value: init }), []); } export function useAnimatedStyle(fn: () => Record) { return fn(); } export function useAnimatedRef() { return useRef(null); } export function useScrollOffset() { return { value: 0 }; } export function withRepeat(val: T) { return val; } export function withTiming(val: T) { return val; } export function interpolate(val: number, inputRange: number[], outputRange: number[]) { if (inputRange.length < 2) return outputRange[0] ?? 0; const clamped = Math.max(inputRange[0], Math.min(val, inputRange[inputRange.length - 1])); for (let i = 0; i < inputRange.length - 1; i++) { if (clamped >= inputRange[i] && clamped <= inputRange[i + 1]) { const t = (clamped - inputRange[i]) / (inputRange[i + 1] - inputRange[i]); return outputRange[i] + t * (outputRange[i + 1] - outputRange[i]); } } return outputRange[outputRange.length - 1] ?? 0; } export const Easing = { linear: (t: number) => t, ease: (t: number) => t, bezier: () => (t: number) => t, };