import type { Component, MutableRefObject } from 'react'; import type { AnimatedPropsAdapterFunction, ShadowNodeWrapper, SharedValue, WorkletFunction, AnimatedStyle } from '../commonTypes'; import type { ImageStyle, NativeSyntheticEvent, TextStyle, ViewStyle, NativeScrollEvent } from 'react-native'; import type { ViewDescriptorsSet } from '../ViewDescriptorsSet'; import type { ReanimatedHTMLElement } from '../js-reanimated'; export type DependencyList = Array | undefined; export interface Descriptor { tag: number | ReanimatedHTMLElement; name: string; shadowNodeWrapper: ShadowNodeWrapper; } export interface AnimatedRef { (component?: T): number | ShadowNodeWrapper | HTMLElement; current: T | null; getTag: () => number; } export type AnimatedRefOnJS = AnimatedRef; /** `AnimatedRef` is mapped to this type on the UI thread via a shareable handle. */ export type AnimatedRefOnUI = { (): number | ShadowNodeWrapper | null; /** * @remarks * `viewName` is required only on iOS with Paper and it's value is null on * other platforms. */ viewName: SharedValue; }; type ReanimatedPayload = { eventName: string; }; /** * This utility type is to convert type of events that would normally be sent by * React Native (they have `nativeEvent` field) to the type that is sent by * Reanimated. */ export type ReanimatedEvent = ReanimatedPayload & (Event extends { nativeEvent: infer NativeEvent extends object; } ? NativeEvent : Event); export type EventPayload = Event extends { nativeEvent: infer NativeEvent extends object; } ? NativeEvent : Omit; export type NativeEventWrapper = { nativeEvent: Event; }; export type DefaultStyle = ViewStyle | ImageStyle | TextStyle; export type RNNativeScrollEvent = NativeSyntheticEvent; export type ReanimatedScrollEvent = ReanimatedEvent; export interface IWorkletEventHandler { updateEventHandler: (newWorklet: (event: ReanimatedEvent) => void, newEvents: string[]) => void; registerForEvents: (viewTag: number, fallbackEventName?: string) => void; unregisterFromEvents: (viewTag: number) => void; } export interface AnimatedStyleHandle