1 | 'use strict';
|
2 | import type { Ref, Component } from 'react';
|
3 | import type {
|
4 | StyleProps,
|
5 | BaseAnimationBuilder,
|
6 | ILayoutAnimationBuilder,
|
7 | EntryExitAnimationFunction,
|
8 | SharedTransition,
|
9 | SharedValue,
|
10 | } from '../reanimated2';
|
11 | import type {
|
12 | ViewDescriptorsSet,
|
13 | ViewRefSet,
|
14 | } from '../reanimated2/ViewDescriptorsSet';
|
15 | import type { SkipEnteringContext } from '../reanimated2/component/LayoutAnimationConfig';
|
16 | import type { ShadowNodeWrapper } from '../reanimated2/commonTypes';
|
17 | import type { ViewConfig } from '../ConfigHelper';
|
18 |
|
19 | export interface AnimatedProps extends Record<string, unknown> {
|
20 | viewDescriptors?: ViewDescriptorsSet;
|
21 | viewsRef?: ViewRefSet<unknown>;
|
22 | initial?: SharedValue<StyleProps>;
|
23 | }
|
24 |
|
25 | export interface ViewInfo {
|
26 | viewTag: number | HTMLElement | null;
|
27 | viewName: string | null;
|
28 | shadowNodeWrapper: ShadowNodeWrapper | null;
|
29 | viewConfig: ViewConfig;
|
30 | }
|
31 |
|
32 | export interface IInlinePropManager {
|
33 | attachInlineProps(
|
34 | animatedComponent: React.Component<unknown, unknown>,
|
35 | viewInfo: ViewInfo
|
36 | ): void;
|
37 | detachInlineProps(): void;
|
38 | }
|
39 |
|
40 | export interface IPropsFilter {
|
41 | filterNonAnimatedProps: (
|
42 | component: React.Component<unknown, unknown> & IAnimatedComponentInternal
|
43 | ) => Record<string, unknown>;
|
44 | }
|
45 |
|
46 | export interface IJSPropsUpdater {
|
47 | addOnJSPropsChangeListener(
|
48 | animatedComponent: React.Component<unknown, unknown> &
|
49 | IAnimatedComponentInternal
|
50 | ): void;
|
51 | removeOnJSPropsChangeListener(
|
52 | animatedComponent: React.Component<unknown, unknown> &
|
53 | IAnimatedComponentInternal
|
54 | ): void;
|
55 | }
|
56 |
|
57 | export type LayoutAnimationStaticContext = {
|
58 | presetName: string;
|
59 | };
|
60 |
|
61 | export type AnimatedComponentProps<P extends Record<string, unknown>> = P & {
|
62 | forwardedRef?: Ref<Component>;
|
63 | style?: NestedArray<StyleProps>;
|
64 | animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;
|
65 | animatedStyle?: StyleProps;
|
66 | layout?: (
|
67 | | BaseAnimationBuilder
|
68 | | ILayoutAnimationBuilder
|
69 | | typeof BaseAnimationBuilder
|
70 | ) &
|
71 | LayoutAnimationStaticContext;
|
72 | entering?: (
|
73 | | BaseAnimationBuilder
|
74 | | typeof BaseAnimationBuilder
|
75 | | EntryExitAnimationFunction
|
76 | | Keyframe
|
77 | ) &
|
78 | LayoutAnimationStaticContext;
|
79 | exiting?: (
|
80 | | BaseAnimationBuilder
|
81 | | typeof BaseAnimationBuilder
|
82 | | EntryExitAnimationFunction
|
83 | | Keyframe
|
84 | ) &
|
85 | LayoutAnimationStaticContext;
|
86 | sharedTransitionTag?: string;
|
87 | sharedTransitionStyle?: SharedTransition;
|
88 | };
|
89 |
|
90 | export interface AnimatedComponentRef extends Component {
|
91 | setNativeProps?: (props: Record<string, unknown>) => void;
|
92 | getScrollableNode?: () => AnimatedComponentRef;
|
93 | getAnimatableRef?: () => AnimatedComponentRef;
|
94 | }
|
95 |
|
96 | export interface IAnimatedComponentInternal {
|
97 | _styles: StyleProps[] | null;
|
98 | _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;
|
99 | _componentViewTag: number;
|
100 | _eventViewTag: number;
|
101 | _isFirstRender: boolean;
|
102 | jestAnimatedStyle: { value: StyleProps };
|
103 | _component: AnimatedComponentRef | HTMLElement | null;
|
104 | _sharedElementTransition: SharedTransition | null;
|
105 | _jsPropsUpdater: IJSPropsUpdater;
|
106 | _InlinePropManager: IInlinePropManager;
|
107 | _PropsFilter: IPropsFilter;
|
108 | _viewInfo?: ViewInfo;
|
109 | context: React.ContextType<typeof SkipEnteringContext>;
|
110 | }
|
111 |
|
112 | export type NestedArray<T> = T | NestedArray<T>[];
|
113 |
|
114 | export interface InitialComponentProps extends Record<string, unknown> {
|
115 | ref?: Ref<Component>;
|
116 | collapsable?: boolean;
|
117 | }
|