UNPKG

react-native-reanimated

Version:

More powerful alternative to Animated library for React Native.

40 lines (39 loc) 2.15 kB
import type { Component, ComponentClass, FunctionComponent, Ref } from 'react'; import './reanimated2/layoutReanimation/animationsManager'; import type { BaseAnimationBuilder, EntryExitAnimationFunction, ILayoutAnimationBuilder } from './reanimated2/layoutReanimation'; import { SharedTransition } from './reanimated2/layoutReanimation'; import type { SharedValue, StyleProps } from './reanimated2/commonTypes'; import type { ViewDescriptorsSet, ViewRefSet } from './reanimated2/ViewDescriptorsSet'; import type { AnimateProps } from './reanimated2/helperTypes'; type NestedArray<T> = T | NestedArray<T>[]; interface AnimatedProps extends Record<string, unknown> { viewDescriptors?: ViewDescriptorsSet; viewsRef?: ViewRefSet<unknown>; initial?: SharedValue<StyleProps>; } export type AnimatedComponentProps<P extends Record<string, unknown>> = P & { forwardedRef?: Ref<Component>; style?: NestedArray<StyleProps>; animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>; animatedStyle?: StyleProps; layout?: BaseAnimationBuilder | ILayoutAnimationBuilder | typeof BaseAnimationBuilder; entering?: BaseAnimationBuilder | typeof BaseAnimationBuilder | EntryExitAnimationFunction | Keyframe; exiting?: BaseAnimationBuilder | typeof BaseAnimationBuilder | EntryExitAnimationFunction | Keyframe; sharedTransitionTag?: string; sharedTransitionStyle?: SharedTransition; }; type Options<P> = { setNativeProps: (ref: ComponentRef, props: P) => void; }; interface ComponentRef extends Component { setNativeProps?: (props: Record<string, unknown>) => void; getScrollableNode?: () => ComponentRef; getAnimatableRef?: () => ComponentRef; } export interface InitialComponentProps extends Record<string, unknown> { ref?: Ref<Component>; collapsable?: boolean; } export default function createAnimatedComponent<P extends object>(component: FunctionComponent<P>, options?: Options<P>): FunctionComponent<AnimateProps<P>>; export default function createAnimatedComponent<P extends object>(component: ComponentClass<P>, options?: Options<P>): ComponentClass<AnimateProps<P>>; export {};