1 | import type { Component, MutableRefObject } from 'react';
|
2 | import type { AnimatedPropsAdapterFunction, ShadowNodeWrapper, SharedValue, WorkletFunction, AnimatedStyle } from '../commonTypes';
|
3 | import type { ImageStyle, NativeSyntheticEvent, TextStyle, ViewStyle, NativeScrollEvent } from 'react-native';
|
4 | import type { ViewDescriptorsSet } from '../ViewDescriptorsSet';
|
5 | import type { ReanimatedHTMLElement } from '../js-reanimated';
|
6 | export type DependencyList = Array<unknown> | undefined;
|
7 | export interface Descriptor {
|
8 | tag: number | ReanimatedHTMLElement;
|
9 | name: string;
|
10 | shadowNodeWrapper: ShadowNodeWrapper;
|
11 | }
|
12 | export interface AnimatedRef<T extends Component> {
|
13 | (component?: T): number | ShadowNodeWrapper | HTMLElement;
|
14 | current: T | null;
|
15 | getTag: () => number;
|
16 | }
|
17 | export type AnimatedRefOnJS = AnimatedRef<Component>;
|
18 |
|
19 | export type AnimatedRefOnUI = {
|
20 | (): number | ShadowNodeWrapper | null;
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 | viewName: SharedValue<string | null>;
|
27 | };
|
28 | type ReanimatedPayload = {
|
29 | eventName: string;
|
30 | };
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | export type ReanimatedEvent<Event extends object> = ReanimatedPayload & (Event extends {
|
37 | nativeEvent: infer NativeEvent extends object;
|
38 | } ? NativeEvent : Event);
|
39 | export type EventPayload<Event extends object> = Event extends {
|
40 | nativeEvent: infer NativeEvent extends object;
|
41 | } ? NativeEvent : Omit<Event, 'eventName'>;
|
42 | export type NativeEventWrapper<Event extends object> = {
|
43 | nativeEvent: Event;
|
44 | };
|
45 | export type DefaultStyle = ViewStyle | ImageStyle | TextStyle;
|
46 | export type RNNativeScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
|
47 | export type ReanimatedScrollEvent = ReanimatedEvent<RNNativeScrollEvent>;
|
48 | export interface IWorkletEventHandler<Event extends object> {
|
49 | updateEventHandler: (newWorklet: (event: ReanimatedEvent<Event>) => void, newEvents: string[]) => void;
|
50 | registerForEvents: (viewTag: number, fallbackEventName?: string) => void;
|
51 | unregisterFromEvents: (viewTag: number) => void;
|
52 | }
|
53 | export interface AnimatedStyleHandle<Style extends DefaultStyle = DefaultStyle> {
|
54 | viewDescriptors: ViewDescriptorsSet;
|
55 | initial: {
|
56 | value: AnimatedStyle<Style>;
|
57 | updater: () => AnimatedStyle<Style>;
|
58 | };
|
59 | }
|
60 | export interface JestAnimatedStyleHandle<Style extends DefaultStyle = DefaultStyle> extends AnimatedStyleHandle<Style> {
|
61 | jestAnimatedStyle: MutableRefObject<AnimatedStyle<Style>>;
|
62 | }
|
63 | export type UseAnimatedStyleInternal<Style extends DefaultStyle> = (updater: WorkletFunction<[], Style> | (() => Style), dependencies?: DependencyList | null, adapters?: AnimatedPropsAdapterFunction | AnimatedPropsAdapterFunction[] | null, isAnimatedProps?: boolean) => AnimatedStyleHandle<Style> | JestAnimatedStyleHandle<Style>;
|
64 | export {};
|
65 |
|
\ | No newline at end of file |