react-native-screen-transitions 3.4.0-beta.0 → 3.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +6 -5
- package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +4 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +28 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.js → use-pre-transition-measurement.js} +7 -5
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
- package/lib/commonjs/shared/constants.js +1 -2
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js +9 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/clear.js +23 -167
- package/lib/commonjs/shared/stores/bounds/internals/clear.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/presence.js +0 -3
- package/lib/commonjs/shared/stores/bounds/internals/presence.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/registry.js +0 -5
- package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js +0 -3
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/state.js +1 -83
- package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/constants.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +5 -5
- package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +6 -6
- package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +70 -0
- package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
- package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +9 -9
- package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
- package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/index.js +16 -44
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +135 -31
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js +8 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/math.js +34 -1
- package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +6 -5
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +4 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +29 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.js → use-pre-transition-measurement.js} +5 -3
- package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
- package/lib/module/shared/constants.js +1 -2
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/providers/register-bounds.provider.js +9 -1
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/clear.js +24 -168
- package/lib/module/shared/stores/bounds/internals/clear.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/presence.js +1 -4
- package/lib/module/shared/stores/bounds/internals/presence.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/registry.js +1 -6
- package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/resolver.js +1 -4
- package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/state.js +0 -78
- package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
- package/lib/module/shared/utils/bounds/constants.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +3 -3
- package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +5 -5
- package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
- package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +64 -0
- package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
- package/lib/module/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +7 -7
- package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
- package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
- package/lib/module/shared/utils/bounds/index.js +14 -42
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/build.js +138 -34
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/config.js +7 -0
- package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/math.js +31 -0
- package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +14 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.d.ts → use-pre-transition-measurement.d.ts} +2 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts.map +1 -0
- package/lib/typescript/shared/constants.d.ts +0 -1
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +1 -1
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts +7 -0
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/clear.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/presence.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/state.d.ts +0 -3
- package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +72 -0
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +1 -1
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts +7 -0
- package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{interpolators.d.ts → create-interpolators.d.ts} +3 -3
- package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{link-accessor.d.ts → create-link-accessor.d.ts} +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +20 -0
- package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{style-composers.d.ts → styles/composers.d.ts} +4 -4
- package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{compute-bounds-styles.d.ts → styles/compute.d.ts} +3 -3
- package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{interpolate-style.d.ts → styles/interpolate-link-style.d.ts} +2 -2
- package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/styles/styles.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/options.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +7 -0
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +17 -0
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/components/create-boundary-component/create-boundary-component.tsx +6 -5
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +6 -1
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +28 -13
- package/src/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.ts → use-pre-transition-measurement.ts} +8 -5
- package/src/shared/constants.ts +0 -1
- package/src/shared/index.ts +2 -0
- package/src/shared/providers/register-bounds.provider.tsx +8 -1
- package/src/shared/stores/bounds/internals/clear.ts +47 -220
- package/src/shared/stores/bounds/internals/presence.ts +1 -4
- package/src/shared/stores/bounds/internals/registry.ts +1 -11
- package/src/shared/stores/bounds/internals/resolver.ts +1 -9
- package/src/shared/stores/bounds/internals/state.ts +0 -98
- package/src/shared/types/bounds.types.ts +74 -0
- package/src/shared/types/index.ts +2 -0
- package/src/shared/utils/bounds/{helpers/constants.ts → constants.ts} +1 -1
- package/src/shared/utils/bounds/helpers/{resolve-bound-tag.ts → create-bound-tag.ts} +2 -2
- package/src/shared/utils/bounds/helpers/{interpolators.ts → create-interpolators.ts} +19 -12
- package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +100 -0
- package/src/shared/utils/bounds/helpers/{style-composers.ts → styles/composers.ts} +119 -53
- package/src/shared/utils/bounds/helpers/{compute-bounds-styles.ts → styles/compute.ts} +9 -9
- package/src/shared/utils/bounds/helpers/{interpolate-style.ts → styles/interpolate-link-style.ts} +9 -4
- package/src/shared/utils/bounds/index.ts +13 -53
- package/src/shared/utils/bounds/types/options.ts +3 -2
- package/src/shared/utils/bounds/zoom/build.ts +169 -61
- package/src/shared/utils/bounds/zoom/config.ts +9 -0
- package/src/shared/utils/bounds/zoom/math.ts +57 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js +0 -41
- package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/constants.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js +0 -20
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js +0 -36
- package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/constants.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolate.js +0 -16
- package/lib/module/shared/utils/bounds/helpers/interpolate.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/styles.js.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +0 -14
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/constants.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolate-style.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts +0 -2
- package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +0 -7
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +0 -1
- package/src/shared/utils/bounds/helpers/build-bounds-options.ts +0 -48
- package/src/shared/utils/bounds/helpers/interpolate.ts +0 -19
- /package/lib/commonjs/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
- /package/lib/commonjs/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
- /package/lib/module/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
- /package/lib/module/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
- /package/lib/typescript/shared/utils/bounds/{helpers/constants.d.ts → constants.d.ts} +0 -0
- /package/lib/typescript/shared/utils/bounds/helpers/{styles.d.ts → styles/styles.d.ts} +0 -0
- /package/src/shared/utils/bounds/helpers/{link-accessor.ts → create-link-accessor.ts} +0 -0
- /package/src/shared/utils/bounds/helpers/{styles.ts → styles/styles.ts} +0 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
Extrapolation,
|
|
3
|
+
interpolate,
|
|
4
|
+
type MeasuredDimensions,
|
|
5
|
+
} from "react-native-reanimated";
|
|
2
6
|
import { ENTER_RANGE, EXIT_RANGE } from "../../../constants";
|
|
3
7
|
import { BoundStore } from "../../../stores/bounds";
|
|
4
8
|
import type { ScreenInterpolationProps } from "../../../types/animation.types";
|
|
5
9
|
import type { BoundId } from "../types/options";
|
|
6
|
-
import {
|
|
7
|
-
import { interpolateLinkStyle } from "./interpolate-style";
|
|
8
|
-
import type { LinkAccessor } from "./link-accessor";
|
|
10
|
+
import type { LinkAccessor } from "./create-link-accessor";
|
|
11
|
+
import { interpolateLinkStyle } from "./styles/interpolate-link-style";
|
|
9
12
|
|
|
10
13
|
type InterpolatorParams = {
|
|
11
14
|
getProps: () => Omit<ScreenInterpolationProps, "bounds">;
|
|
@@ -55,10 +58,12 @@ export const createInterpolators = ({
|
|
|
55
58
|
const currentValue = currentSnapshot?.bounds?.[property] ?? fb;
|
|
56
59
|
const targetValue = targetSnapshot?.bounds?.[property] ?? fb;
|
|
57
60
|
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
return interpolate(
|
|
62
|
+
props.progress,
|
|
63
|
+
range,
|
|
64
|
+
[targetValue, currentValue],
|
|
65
|
+
Extrapolation.CLAMP,
|
|
66
|
+
);
|
|
62
67
|
};
|
|
63
68
|
|
|
64
69
|
const interpolateBoundsFromLink = (
|
|
@@ -77,10 +82,12 @@ export const createInterpolators = ({
|
|
|
77
82
|
const sourceValue = link?.source?.bounds?.[property] ?? fb;
|
|
78
83
|
const destinationValue = link?.destination?.bounds?.[property] ?? fb;
|
|
79
84
|
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
return interpolate(
|
|
86
|
+
props.progress,
|
|
87
|
+
range,
|
|
88
|
+
[sourceValue, destinationValue],
|
|
89
|
+
Extrapolation.CLAMP,
|
|
90
|
+
);
|
|
84
91
|
};
|
|
85
92
|
|
|
86
93
|
const interpolateBounds = (
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BoundStore,
|
|
3
|
+
type ResolvedTransitionPair,
|
|
4
|
+
} from "../../../stores/bounds";
|
|
5
|
+
import type { ScreenInterpolationProps } from "../../../types/animation.types";
|
|
6
|
+
import { DEFAULT_BOUNDS_OPTIONS } from "../constants";
|
|
7
|
+
import type {
|
|
8
|
+
BoundId,
|
|
9
|
+
BoundsOptions,
|
|
10
|
+
BoundsOptionsResult,
|
|
11
|
+
} from "../types/options";
|
|
12
|
+
import { createBoundTag } from "./create-bound-tag";
|
|
13
|
+
import { computeBoundStyles } from "./styles/compute";
|
|
14
|
+
|
|
15
|
+
type BaseInterpolatorProps = Omit<ScreenInterpolationProps, "bounds">;
|
|
16
|
+
|
|
17
|
+
type ComputeResolvedBoundsStylesParams<T extends BoundsOptions> = {
|
|
18
|
+
props: BaseInterpolatorProps;
|
|
19
|
+
options: T;
|
|
20
|
+
resolvedPair?: ResolvedTransitionPair;
|
|
21
|
+
syncGroupActiveId?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type BuildBoundsOptionsParams = {
|
|
25
|
+
props: Omit<ScreenInterpolationProps, "bounds">;
|
|
26
|
+
id?: BoundId;
|
|
27
|
+
group?: string;
|
|
28
|
+
overrides?: Partial<BoundsOptions>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const buildBoundsOptions = ({
|
|
32
|
+
props,
|
|
33
|
+
id,
|
|
34
|
+
group,
|
|
35
|
+
overrides,
|
|
36
|
+
}: BuildBoundsOptionsParams): BoundsOptions => {
|
|
37
|
+
"worklet";
|
|
38
|
+
|
|
39
|
+
const tag = createBoundTag({ id, group });
|
|
40
|
+
const currentScreenKey = props.current?.route.key;
|
|
41
|
+
|
|
42
|
+
const boundaryConfig =
|
|
43
|
+
tag && currentScreenKey
|
|
44
|
+
? BoundStore.getBoundaryConfig(tag, currentScreenKey)
|
|
45
|
+
: null;
|
|
46
|
+
|
|
47
|
+
const resolved = {
|
|
48
|
+
...DEFAULT_BOUNDS_OPTIONS,
|
|
49
|
+
...(boundaryConfig ?? {}),
|
|
50
|
+
...(overrides ?? {}),
|
|
51
|
+
id: tag ?? "",
|
|
52
|
+
group,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return resolved;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const syncGroupActiveMember = (group?: string, id?: BoundId) => {
|
|
59
|
+
"worklet";
|
|
60
|
+
if (!group || id == null || id === "") return;
|
|
61
|
+
|
|
62
|
+
const normalizedId = String(id);
|
|
63
|
+
|
|
64
|
+
if (BoundStore.getGroupActiveId(group) === normalizedId) return;
|
|
65
|
+
|
|
66
|
+
BoundStore.setGroupActiveId(group, normalizedId);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const prepareBoundStyles = <T extends BoundsOptions>({
|
|
70
|
+
props,
|
|
71
|
+
options,
|
|
72
|
+
resolvedPair,
|
|
73
|
+
syncGroupActiveId = true,
|
|
74
|
+
}: ComputeResolvedBoundsStylesParams<T>): BoundsOptionsResult<T> => {
|
|
75
|
+
"worklet";
|
|
76
|
+
|
|
77
|
+
if (syncGroupActiveId) {
|
|
78
|
+
syncGroupActiveMember(options.group, options.id);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const resolved = buildBoundsOptions({
|
|
82
|
+
props,
|
|
83
|
+
id: options.id,
|
|
84
|
+
group: options.group,
|
|
85
|
+
overrides: options,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return computeBoundStyles(
|
|
89
|
+
{
|
|
90
|
+
id: resolved.id,
|
|
91
|
+
previous: props.previous,
|
|
92
|
+
current: props.current,
|
|
93
|
+
next: props.next,
|
|
94
|
+
progress: props.progress,
|
|
95
|
+
dimensions: props.layouts.screen,
|
|
96
|
+
},
|
|
97
|
+
resolved,
|
|
98
|
+
resolvedPair,
|
|
99
|
+
) as BoundsOptionsResult<T>;
|
|
100
|
+
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Extrapolation,
|
|
3
|
+
interpolate,
|
|
4
|
+
type MeasuredDimensions,
|
|
5
|
+
type StyleProps,
|
|
6
|
+
} from "react-native-reanimated";
|
|
7
|
+
import { VISIBLE_STYLE } from "../../../../constants";
|
|
3
8
|
import type {
|
|
4
9
|
ContentTransformGeometry,
|
|
5
10
|
RelativeGeometry,
|
|
6
|
-
} from "
|
|
7
|
-
import type { BoundsAnchor, BoundsOptions } from "
|
|
8
|
-
import { interpolateClamped } from "./interpolate";
|
|
11
|
+
} from "../../types/geometry";
|
|
12
|
+
import type { BoundsAnchor, BoundsOptions } from "../../types/options";
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* Element-level (relative) params shared by size/transform composers.
|
|
@@ -108,20 +112,31 @@ export function composeSizeAbsolute(params: ElementComposeParams): StyleProps {
|
|
|
108
112
|
const startAnchor = getAnchorPoint(start, anchor);
|
|
109
113
|
const endAnchor = getAnchorPoint(end, anchor);
|
|
110
114
|
|
|
111
|
-
const width =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
end.
|
|
115
|
-
|
|
115
|
+
const width = interpolate(
|
|
116
|
+
progress,
|
|
117
|
+
ranges,
|
|
118
|
+
[start.width, end.width],
|
|
119
|
+
Extrapolation.CLAMP,
|
|
120
|
+
);
|
|
121
|
+
const height = interpolate(
|
|
122
|
+
progress,
|
|
123
|
+
ranges,
|
|
124
|
+
[start.height, end.height],
|
|
125
|
+
Extrapolation.CLAMP,
|
|
126
|
+
);
|
|
116
127
|
|
|
117
|
-
const anchorX =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
const anchorX = interpolate(
|
|
129
|
+
progress,
|
|
130
|
+
ranges,
|
|
131
|
+
[startAnchor.x, endAnchor.x],
|
|
132
|
+
Extrapolation.CLAMP,
|
|
133
|
+
);
|
|
134
|
+
const anchorY = interpolate(
|
|
135
|
+
progress,
|
|
136
|
+
ranges,
|
|
137
|
+
[startAnchor.y, endAnchor.y],
|
|
138
|
+
Extrapolation.CLAMP,
|
|
139
|
+
);
|
|
125
140
|
const anchorOffset = getAnchorOffset({ width, height, anchor });
|
|
126
141
|
|
|
127
142
|
const translateX = anchorX - anchorOffset.x;
|
|
@@ -154,19 +169,30 @@ export function composeSizeRelative(params: ElementComposeParams): StyleProps {
|
|
|
154
169
|
const baseX = geometry.entering ? end.pageX : start.pageX;
|
|
155
170
|
const baseY = geometry.entering ? end.pageY : start.pageY;
|
|
156
171
|
|
|
157
|
-
const width =
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
end.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
const width = interpolate(
|
|
173
|
+
progress,
|
|
174
|
+
ranges,
|
|
175
|
+
[start.width, end.width],
|
|
176
|
+
Extrapolation.CLAMP,
|
|
177
|
+
);
|
|
178
|
+
const height = interpolate(
|
|
179
|
+
progress,
|
|
180
|
+
ranges,
|
|
181
|
+
[start.height, end.height],
|
|
182
|
+
Extrapolation.CLAMP,
|
|
183
|
+
);
|
|
184
|
+
const anchorX = interpolate(
|
|
185
|
+
progress,
|
|
186
|
+
ranges,
|
|
187
|
+
[startAnchor.x, endAnchor.x],
|
|
188
|
+
Extrapolation.CLAMP,
|
|
189
|
+
);
|
|
190
|
+
const anchorY = interpolate(
|
|
191
|
+
progress,
|
|
192
|
+
ranges,
|
|
193
|
+
[startAnchor.y, endAnchor.y],
|
|
194
|
+
Extrapolation.CLAMP,
|
|
195
|
+
);
|
|
170
196
|
const anchorOffset = getAnchorOffset({ width, height, anchor });
|
|
171
197
|
|
|
172
198
|
const translateX = anchorX - (baseX + anchorOffset.x);
|
|
@@ -197,17 +223,47 @@ export function composeTransformAbsolute(
|
|
|
197
223
|
const { start, end, geometry, progress, ranges, computeOptions } = params;
|
|
198
224
|
|
|
199
225
|
const translateX = geometry.entering
|
|
200
|
-
?
|
|
201
|
-
|
|
226
|
+
? interpolate(
|
|
227
|
+
progress,
|
|
228
|
+
ranges,
|
|
229
|
+
[start.pageX, end.pageX],
|
|
230
|
+
Extrapolation.CLAMP,
|
|
231
|
+
)
|
|
232
|
+
: interpolate(
|
|
233
|
+
progress,
|
|
234
|
+
ranges,
|
|
235
|
+
[end.pageX, start.pageX],
|
|
236
|
+
Extrapolation.CLAMP,
|
|
237
|
+
);
|
|
202
238
|
const translateY = geometry.entering
|
|
203
|
-
?
|
|
204
|
-
|
|
239
|
+
? interpolate(
|
|
240
|
+
progress,
|
|
241
|
+
ranges,
|
|
242
|
+
[start.pageY, end.pageY],
|
|
243
|
+
Extrapolation.CLAMP,
|
|
244
|
+
)
|
|
245
|
+
: interpolate(
|
|
246
|
+
progress,
|
|
247
|
+
ranges,
|
|
248
|
+
[end.pageY, start.pageY],
|
|
249
|
+
Extrapolation.CLAMP,
|
|
250
|
+
);
|
|
205
251
|
const scaleX = geometry.entering
|
|
206
|
-
?
|
|
207
|
-
:
|
|
252
|
+
? interpolate(progress, ranges, [geometry.scaleX, 1], Extrapolation.CLAMP)
|
|
253
|
+
: interpolate(
|
|
254
|
+
progress,
|
|
255
|
+
ranges,
|
|
256
|
+
[1, 1 / geometry.scaleX],
|
|
257
|
+
Extrapolation.CLAMP,
|
|
258
|
+
);
|
|
208
259
|
const scaleY = geometry.entering
|
|
209
|
-
?
|
|
210
|
-
:
|
|
260
|
+
? interpolate(progress, ranges, [geometry.scaleY, 1], Extrapolation.CLAMP)
|
|
261
|
+
: interpolate(
|
|
262
|
+
progress,
|
|
263
|
+
ranges,
|
|
264
|
+
[1, 1 / geometry.scaleY],
|
|
265
|
+
Extrapolation.CLAMP,
|
|
266
|
+
);
|
|
211
267
|
|
|
212
268
|
if (computeOptions.raw) {
|
|
213
269
|
return {
|
|
@@ -232,17 +288,27 @@ export function composeTransformRelative(
|
|
|
232
288
|
const { geometry, computeOptions, progress, ranges } = params;
|
|
233
289
|
|
|
234
290
|
const translateX = geometry.entering
|
|
235
|
-
?
|
|
236
|
-
:
|
|
291
|
+
? interpolate(progress, ranges, [geometry.dx, 0], Extrapolation.CLAMP)
|
|
292
|
+
: interpolate(progress, ranges, [0, -geometry.dx], Extrapolation.CLAMP);
|
|
237
293
|
const translateY = geometry.entering
|
|
238
|
-
?
|
|
239
|
-
:
|
|
294
|
+
? interpolate(progress, ranges, [geometry.dy, 0], Extrapolation.CLAMP)
|
|
295
|
+
: interpolate(progress, ranges, [0, -geometry.dy], Extrapolation.CLAMP);
|
|
240
296
|
const scaleX = geometry.entering
|
|
241
|
-
?
|
|
242
|
-
:
|
|
297
|
+
? interpolate(progress, ranges, [geometry.scaleX, 1], Extrapolation.CLAMP)
|
|
298
|
+
: interpolate(
|
|
299
|
+
progress,
|
|
300
|
+
ranges,
|
|
301
|
+
[1, 1 / geometry.scaleX],
|
|
302
|
+
Extrapolation.CLAMP,
|
|
303
|
+
);
|
|
243
304
|
const scaleY = geometry.entering
|
|
244
|
-
?
|
|
245
|
-
:
|
|
305
|
+
? interpolate(progress, ranges, [geometry.scaleY, 1], Extrapolation.CLAMP)
|
|
306
|
+
: interpolate(
|
|
307
|
+
progress,
|
|
308
|
+
ranges,
|
|
309
|
+
[1, 1 / geometry.scaleY],
|
|
310
|
+
Extrapolation.CLAMP,
|
|
311
|
+
);
|
|
246
312
|
|
|
247
313
|
if (computeOptions.raw) {
|
|
248
314
|
return {
|
|
@@ -278,14 +344,14 @@ export function composeContentStyle(params: ContentComposeParams): StyleProps {
|
|
|
278
344
|
const { s, tx, ty, entering } = geometry;
|
|
279
345
|
|
|
280
346
|
const translateX = entering
|
|
281
|
-
?
|
|
282
|
-
:
|
|
347
|
+
? interpolate(progress, ranges, [tx, 0], Extrapolation.CLAMP)
|
|
348
|
+
: interpolate(progress, ranges, [0, tx], Extrapolation.CLAMP);
|
|
283
349
|
const translateY = entering
|
|
284
|
-
?
|
|
285
|
-
:
|
|
350
|
+
? interpolate(progress, ranges, [ty, 0], Extrapolation.CLAMP)
|
|
351
|
+
: interpolate(progress, ranges, [0, ty], Extrapolation.CLAMP);
|
|
286
352
|
const scale = entering
|
|
287
|
-
?
|
|
288
|
-
:
|
|
353
|
+
? interpolate(progress, ranges, [s, 1], Extrapolation.CLAMP)
|
|
354
|
+
: interpolate(progress, ranges, [1, s], Extrapolation.CLAMP);
|
|
289
355
|
|
|
290
356
|
if (raw) {
|
|
291
357
|
return {
|
|
@@ -6,22 +6,22 @@ import {
|
|
|
6
6
|
FULLSCREEN_DIMENSIONS,
|
|
7
7
|
HIDDEN_STYLE,
|
|
8
8
|
NO_STYLES,
|
|
9
|
-
} from "
|
|
9
|
+
} from "../../../../constants";
|
|
10
10
|
import {
|
|
11
11
|
BoundStore,
|
|
12
12
|
type ResolvedTransitionPair,
|
|
13
|
-
} from "
|
|
14
|
-
import type { ScreenTransitionState } from "
|
|
15
|
-
import type { Layout } from "
|
|
13
|
+
} from "../../../../stores/bounds";
|
|
14
|
+
import type { ScreenTransitionState } from "../../../../types/animation.types";
|
|
15
|
+
import type { Layout } from "../../../../types/screen.types";
|
|
16
16
|
import type {
|
|
17
17
|
BoundId,
|
|
18
18
|
BoundsComputeParams,
|
|
19
19
|
BoundsOptions,
|
|
20
|
-
} from "
|
|
20
|
+
} from "../../types/options";
|
|
21
21
|
import {
|
|
22
22
|
computeContentTransformGeometry,
|
|
23
23
|
computeRelativeGeometry,
|
|
24
|
-
} from "
|
|
24
|
+
} from "../geometry";
|
|
25
25
|
import {
|
|
26
26
|
composeContentStyle,
|
|
27
27
|
composeSizeAbsolute,
|
|
@@ -29,9 +29,9 @@ import {
|
|
|
29
29
|
composeTransformAbsolute,
|
|
30
30
|
composeTransformRelative,
|
|
31
31
|
type ElementComposeParams,
|
|
32
|
-
} from "./
|
|
32
|
+
} from "./composers";
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const resolveStartEnd = (params: {
|
|
35
35
|
id: BoundId;
|
|
36
36
|
previous?: ScreenTransitionState;
|
|
37
37
|
current?: ScreenTransitionState;
|
|
@@ -135,7 +135,7 @@ export const computeBoundStyles = (
|
|
|
135
135
|
currentScreenKey,
|
|
136
136
|
sourceScreenKey,
|
|
137
137
|
destinationScreenKey,
|
|
138
|
-
} =
|
|
138
|
+
} = resolveStartEnd({
|
|
139
139
|
id,
|
|
140
140
|
previous,
|
|
141
141
|
current,
|
package/src/shared/utils/bounds/helpers/{interpolate-style.ts → styles/interpolate-link-style.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { Extrapolation, interpolate } from "react-native-reanimated";
|
|
2
|
+
import { ENTER_RANGE, EXIT_RANGE } from "../../../../constants";
|
|
3
|
+
import type { BoundsLink } from "../../../../types/bounds.types";
|
|
4
4
|
|
|
5
5
|
type InterpolateStyleOptions = {
|
|
6
6
|
fallback?: number;
|
|
@@ -34,5 +34,10 @@ export function interpolateLinkStyle(
|
|
|
34
34
|
|
|
35
35
|
const range = entering ? ENTER_RANGE : EXIT_RANGE;
|
|
36
36
|
|
|
37
|
-
return
|
|
37
|
+
return interpolate(
|
|
38
|
+
progress,
|
|
39
|
+
range,
|
|
40
|
+
[sourceValue, destValue],
|
|
41
|
+
Extrapolation.CLAMP,
|
|
42
|
+
);
|
|
38
43
|
}
|
|
@@ -1,75 +1,35 @@
|
|
|
1
|
-
import { BoundStore, type ResolvedTransitionPair } from "../../stores/bounds";
|
|
2
|
-
import type { ScreenInterpolationProps } from "../../types/animation.types";
|
|
3
1
|
import type {
|
|
4
2
|
BoundsAccessor,
|
|
5
3
|
BoundsInterpolationProps,
|
|
6
4
|
BoundsNavigationZoomOptions,
|
|
7
5
|
} from "../../types/bounds.types";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { resolveBoundTag } from "./helpers/resolve-bound-tag";
|
|
6
|
+
import { createBoundTag } from "./helpers/create-bound-tag";
|
|
7
|
+
import { createInterpolators } from "./helpers/create-interpolators";
|
|
8
|
+
import { createLinkAccessor } from "./helpers/create-link-accessor";
|
|
9
|
+
import { prepareBoundStyles } from "./helpers/prepare-bound-styles";
|
|
13
10
|
import type { BoundsOptions } from "./types/options";
|
|
14
11
|
import { buildZoomStyles } from "./zoom/build";
|
|
15
12
|
|
|
16
|
-
const syncGroupActiveMember = (group?: string, id?: string | number) => {
|
|
17
|
-
"worklet";
|
|
18
|
-
if (!group) return;
|
|
19
|
-
if (id === undefined || id === null || id === "") return;
|
|
20
|
-
|
|
21
|
-
const normalizedId = String(id);
|
|
22
|
-
if (BoundStore.getGroupActiveId(group) === normalizedId) return;
|
|
23
|
-
|
|
24
|
-
BoundStore.setGroupActiveId(group, normalizedId);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
13
|
export const createBoundsAccessor = (
|
|
28
14
|
getProps: () => BoundsInterpolationProps,
|
|
29
15
|
): BoundsAccessor => {
|
|
30
16
|
"worklet";
|
|
31
17
|
|
|
32
|
-
const
|
|
33
|
-
resolvedOptions: BoundsOptions,
|
|
34
|
-
props: Omit<ScreenInterpolationProps, "bounds">,
|
|
35
|
-
resolvedPair?: ResolvedTransitionPair,
|
|
36
|
-
) => {
|
|
37
|
-
"worklet";
|
|
38
|
-
return computeBoundStyles(
|
|
39
|
-
{
|
|
40
|
-
id: resolvedOptions.id,
|
|
41
|
-
previous: props.previous,
|
|
42
|
-
current: props.current,
|
|
43
|
-
next: props.next,
|
|
44
|
-
progress: props.progress,
|
|
45
|
-
dimensions: props.layouts.screen,
|
|
46
|
-
},
|
|
47
|
-
resolvedOptions,
|
|
48
|
-
resolvedPair,
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const computeElementBoundsStyles = (params?: BoundsOptions) => {
|
|
18
|
+
const computeBounds = (params?: BoundsOptions) => {
|
|
53
19
|
"worklet";
|
|
54
20
|
const props = getProps();
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
syncGroupActiveMember(group, id);
|
|
58
|
-
|
|
59
|
-
const resolved = buildBoundsOptions({
|
|
21
|
+
const options = (params ?? { id: "" }) as BoundsOptions;
|
|
22
|
+
const computed = prepareBoundStyles({
|
|
60
23
|
props,
|
|
61
|
-
|
|
62
|
-
group,
|
|
63
|
-
overrides: params,
|
|
64
|
-
mode: "style",
|
|
65
|
-
resolveBoundTag,
|
|
24
|
+
options,
|
|
66
25
|
});
|
|
67
|
-
|
|
68
|
-
const computed = computeForResolvedOptions(resolved, props);
|
|
69
26
|
// Navigation helpers are intentionally opinionated. Only the resolved
|
|
70
27
|
// tag from `id`/`group` is allowed to flow into `navigation.zoom()`;
|
|
71
28
|
// base bounds overrides like `target`, `anchor`, or `scaleMode` must not.
|
|
72
|
-
const navigationTag =
|
|
29
|
+
const navigationTag = createBoundTag({
|
|
30
|
+
id: options.id,
|
|
31
|
+
group: options.group,
|
|
32
|
+
});
|
|
73
33
|
|
|
74
34
|
const target = Object.isExtensible(computed) ? computed : { ...computed };
|
|
75
35
|
|
|
@@ -97,7 +57,7 @@ export const createBoundsAccessor = (
|
|
|
97
57
|
getLink,
|
|
98
58
|
});
|
|
99
59
|
|
|
100
|
-
return Object.assign(
|
|
60
|
+
return Object.assign(computeBounds, {
|
|
101
61
|
getSnapshot,
|
|
102
62
|
getLink,
|
|
103
63
|
interpolateStyle,
|
|
@@ -112,8 +112,9 @@ export type BoundsOptions = {
|
|
|
112
112
|
/**
|
|
113
113
|
* Coordinate space selection.
|
|
114
114
|
*
|
|
115
|
-
*
|
|
116
|
-
* `"absolute"`
|
|
115
|
+
* - `"relative"` composes movement relative to the current element's layout box
|
|
116
|
+
* - `"absolute"` composes movement in screen/window coordinates
|
|
117
|
+
*
|
|
117
118
|
* @default "relative"
|
|
118
119
|
*/
|
|
119
120
|
space?: BoundsSpace;
|