UNPKG

4.45 kBTypeScriptView Raw
1import type { SharedTransitionAnimationsValues, CustomProgressAnimation } from '../animationBuilder/commonTypes';
2import { SharedTransitionType } from '../animationBuilder/commonTypes';
3import type { StyleProps } from '../../commonTypes';
4import { ReduceMotion } from '../../commonTypes';
5type AnimationFactory = (values: SharedTransitionAnimationsValues) => StyleProps;
6/**
7 * A SharedTransition builder class.
8 *
9 * @experimental
10 * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
11 */
12export declare class SharedTransition {
13 private _customAnimationFactory;
14 private _animation;
15 private _transitionDuration;
16 private _reduceMotion;
17 private _customProgressAnimation?;
18 private _progressAnimation?;
19 private _defaultTransitionType?;
20 private static _progressTransitionManager;
21 custom(customAnimationFactory: AnimationFactory): SharedTransition;
22 progressAnimation(progressAnimationCallback: CustomProgressAnimation): SharedTransition;
23 duration(duration: number): SharedTransition;
24 reduceMotion(_reduceMotion: ReduceMotion): this;
25 defaultTransitionType(transitionType: SharedTransitionType): SharedTransition;
26 registerTransition(viewTag: number, sharedTransitionTag: string, isUnmounting?: boolean): void;
27 unregisterTransition(viewTag: number, isUnmounting?: boolean): void;
28 getReduceMotion(): ReduceMotion;
29 private getTransitionAnimation;
30 private getProgressAnimation;
31 private buildAnimation;
32 private buildProgressAnimation;
33 /**
34 * Lets you create a custom shared transition animation. Other shared
35 * transition modifiers can be chained alongside this modifier.
36 *
37 * @param customAnimationFactory - Callback function that have to return an
38 * object with styles for the custom shared transition.
39 * @returns A {@link SharedTransition} object. Styles returned from this
40 * function need to be to the `sharedTransitionStyle` prop.
41 * @experimental
42 * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
43 */
44 static custom(customAnimationFactory: AnimationFactory): SharedTransition;
45 /**
46 * Lets you change the duration of the shared transition. Other shared
47 * transition modifiers can be chained alongside this modifier.
48 *
49 * @param duration - The duration of the shared transition animation in
50 * milliseconds.
51 * @experimental
52 * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
53 */
54 static duration(duration: number): SharedTransition;
55 /**
56 * Lets you create a shared transition animation bound to the progress between
57 * navigation screens. Other shared transition modifiers can be chained
58 * alongside this modifier.
59 *
60 * @param progressAnimationCallback - A callback called with the current
61 * progress value on every animation frame. It should return an object with
62 * styles for the shared transition.
63 * @experimental
64 * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
65 */
66 static progressAnimation(progressAnimationCallback: CustomProgressAnimation): SharedTransition;
67 /**
68 * Whether the transition is progress-bound or not. Other shared transition
69 * modifiers can be chained alongside this modifier.
70 *
71 * @param transitionType - Type of the transition. Configured with
72 * {@link SharedTransitionType} enum.
73 * @experimental
74 * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
75 */
76 static defaultTransitionType(transitionType: SharedTransitionType): SharedTransition;
77 /**
78 * Lets you adjust the behavior when the device's reduced motion accessibility
79 * setting is turned on. Other shared transition modifiers can be chained
80 * alongside this modifier.
81 *
82 * @param reduceMotion - Determines how the animation responds to the device's
83 * reduced motion accessibility setting. Default to `ReduceMotion.System` -
84 * {@link ReduceMotion}.
85 * @experimental
86 * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
87 */
88 static reduceMotion(reduceMotion: ReduceMotion): SharedTransition;
89}
90export {};
91//# sourceMappingURL=SharedTransition.d.ts.map
\No newline at end of file