import { ReadonlySignal } from "@preact-signals/unified-signals"; import { AnimatableValue, DerivedValue, SharedValue, withSpring, withTiming } from "react-native-reanimated"; /** * * @example * ```tsx * import { useSharedValue } from "react-native-reanimated"; * import { useSignalOfSharedValue } from "@preact-signals/utils/integrations/reanimated"; * * function ExampleComponent() { * const sharedValue = useSharedValue(0); * const signal = useSignalOfSharedValue(sharedValue); * * useSignalEffect(() => { * // running some code on JS thread * }) * * * // ... rest of the component * } * ``` */ export declare const useSignalOfSharedValue: (shared: Readonly>) => ReadonlySignal; export declare const useComputedOfSharedValue: (shared: Readonly>, compute: (v: T) => TResult) => ReadonlySignal; /** * @description creates a shared value from a signal. * * @example * ```tsx * function ExampleComponent() { * const signal = useSignal(0); * const sharedValue = useSharedValueOfSignal(signal); * * // Now you can use the shared value in your component * // ... * * return ({ * opacity: sharedValue.value, * }))} />; * } * ``` */ export declare const useSharedValueOfSignal: (_sig: ReadonlySignal) => Readonly>; export type SignalInteropSetter = (target: TTarget, source: TSource) => unknown; export type SharedValueSetter = SignalInteropSetter, T>; export declare const useSharedValueOfAccessor: (accessor: () => T, setter?: SharedValueSetter) => DerivedValue; /** * @description applies withSpring or withTiming to shared value of accessor * @example * ```tsx * const maxLength = 10 * function ExampleComponent() { * const input = useSignal('') * const progress = useAnimatedSharedValueOfAccessor( * () => input.value.length / maxLength, * { * type: 'spring', * params: { * damping: 10, * } * }) * * return ( * * input.value = v} /> * ({ * alignSelf: 'stretch', * height: 10, * transform: [{ scaleX: progress.value }], * }))} /> * * ); * } * ``` * */ export declare const useAnimatedSharedValueOfAccessor: (accessor: () => T, animateOptions: { type: "timing"; params?: Parameters[1]; } | { type: "spring"; params?: Parameters[1]; }) => Readonly>; export declare const useSpringSharedValueOfAccessor: (accessor: () => T, params?: Parameters[1]) => Readonly>; export declare const useTimingSharedValueOfAccessor: (accessor: () => T, params?: Parameters[1]) => Readonly>;