react-native-screen-transitions 2.0.6 → 2.1.0
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/LICENSE +21 -0
- package/README.md +100 -77
- package/lib/commonjs/components/{bounds-activator.js → bound-capture.js} +4 -4
- package/lib/commonjs/components/bound-capture.js.map +1 -0
- package/lib/commonjs/components/controllers/screen-lifecycle.js +18 -4
- package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -1
- package/lib/commonjs/components/create-transition-aware-component.js +14 -12
- package/lib/commonjs/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/components/integrations/masked-view.js +52 -0
- package/lib/commonjs/components/integrations/masked-view.js.map +1 -0
- package/lib/commonjs/components/root-transition-aware.js +6 -15
- package/lib/commonjs/components/root-transition-aware.js.map +1 -1
- package/lib/commonjs/configs/index.js +4 -1
- package/lib/commonjs/configs/index.js.map +1 -1
- package/lib/commonjs/configs/presets.js +378 -7
- package/lib/commonjs/configs/presets.js.map +1 -1
- package/lib/commonjs/configs/specs.js +2 -1
- package/lib/commonjs/configs/specs.js.map +1 -1
- package/lib/commonjs/hooks/animation/use-associated-style.js +7 -10
- package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/hooks/animation/use-screen-animation.js +37 -37
- package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/hooks/bounds/use-bound-registry.js +73 -0
- package/lib/commonjs/hooks/bounds/use-bound-registry.js.map +1 -0
- package/lib/commonjs/hooks/gestures/use-build-gestures.js +156 -152
- package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js +28 -0
- package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
- package/lib/commonjs/hooks/gestures/use-scroll-registry.js +146 -0
- package/lib/commonjs/hooks/gestures/use-scroll-registry.js.map +1 -0
- package/lib/commonjs/index.js +3 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +7 -4
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/commonjs/providers/gestures.js +16 -16
- package/lib/commonjs/providers/gestures.js.map +1 -1
- package/lib/commonjs/providers/transition-styles.js +44 -0
- package/lib/commonjs/providers/transition-styles.js.map +1 -0
- package/lib/commonjs/stores/bounds.js +142 -1
- package/lib/commonjs/stores/bounds.js.map +1 -1
- package/lib/commonjs/stores/utils/reset-stores-for-screen.js +4 -2
- package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
- package/lib/commonjs/types/gesture.js +11 -0
- package/lib/commonjs/types/gesture.js.map +1 -1
- package/lib/commonjs/utils/animation/derivations.js +39 -0
- package/lib/commonjs/utils/animation/derivations.js.map +1 -0
- package/lib/commonjs/utils/animation/run-transition.js +6 -2
- package/lib/commonjs/utils/animation/run-transition.js.map +1 -1
- package/lib/commonjs/utils/bounds/_utils/flatten-styles.js.map +1 -0
- package/lib/commonjs/utils/bounds/_utils/geometry.js +179 -0
- package/lib/commonjs/utils/bounds/_utils/geometry.js.map +1 -0
- package/lib/commonjs/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
- package/lib/commonjs/utils/bounds/_utils/get-bounds.js.map +1 -0
- package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js +19 -0
- package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
- package/lib/commonjs/utils/bounds/_utils/style-composers.js +201 -0
- package/lib/commonjs/utils/bounds/_utils/style-composers.js.map +1 -0
- package/lib/commonjs/utils/bounds/constants.js +14 -3
- package/lib/commonjs/utils/bounds/constants.js.map +1 -1
- package/lib/commonjs/utils/bounds/index.js +210 -17
- package/lib/commonjs/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/utils/gesture/apply-offset-rules.js +233 -0
- package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -0
- package/lib/commonjs/utils/gesture/check-gesture-activation.js +231 -0
- package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -0
- package/lib/commonjs/utils/gesture/determine-dismissal.js +98 -0
- package/lib/commonjs/utils/gesture/determine-dismissal.js.map +1 -0
- package/lib/module/components/{bounds-activator.js → bound-capture.js} +2 -2
- package/lib/module/components/bound-capture.js.map +1 -0
- package/lib/module/components/controllers/screen-lifecycle.js +18 -4
- package/lib/module/components/controllers/screen-lifecycle.js.map +1 -1
- package/lib/module/components/create-transition-aware-component.js +14 -12
- package/lib/module/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/components/integrations/masked-view.js +48 -0
- package/lib/module/components/integrations/masked-view.js.map +1 -0
- package/lib/module/components/root-transition-aware.js +7 -16
- package/lib/module/components/root-transition-aware.js.map +1 -1
- package/lib/module/configs/index.js +6 -3
- package/lib/module/configs/index.js.map +1 -1
- package/lib/module/configs/presets.js +374 -6
- package/lib/module/configs/presets.js.map +1 -1
- package/lib/module/configs/specs.js +2 -1
- package/lib/module/configs/specs.js.map +1 -1
- package/lib/module/hooks/animation/use-associated-style.js +6 -10
- package/lib/module/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/hooks/animation/use-screen-animation.js +37 -37
- package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/hooks/bounds/use-bound-registry.js +68 -0
- package/lib/module/hooks/bounds/use-bound-registry.js.map +1 -0
- package/lib/module/hooks/gestures/use-build-gestures.js +156 -153
- package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/hooks/gestures/use-parent-gesture-registry.js +23 -0
- package/lib/module/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
- package/lib/module/hooks/gestures/use-scroll-registry.js +140 -0
- package/lib/module/hooks/gestures/use-scroll-registry.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js +7 -4
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/module/providers/gestures.js +16 -16
- package/lib/module/providers/gestures.js.map +1 -1
- package/lib/module/providers/transition-styles.js +39 -0
- package/lib/module/providers/transition-styles.js.map +1 -0
- package/lib/module/stores/bounds.js +142 -1
- package/lib/module/stores/bounds.js.map +1 -1
- package/lib/module/stores/utils/reset-stores-for-screen.js +4 -2
- package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
- package/lib/module/types/gesture.js +7 -0
- package/lib/module/types/gesture.js.map +1 -1
- package/lib/module/utils/animation/derivations.js +34 -0
- package/lib/module/utils/animation/derivations.js.map +1 -0
- package/lib/module/utils/animation/run-transition.js +6 -2
- package/lib/module/utils/animation/run-transition.js.map +1 -1
- package/lib/module/utils/bounds/_utils/flatten-styles.js.map +1 -0
- package/lib/module/utils/bounds/_utils/geometry.js +174 -0
- package/lib/module/utils/bounds/_utils/geometry.js.map +1 -0
- package/lib/module/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
- package/lib/module/utils/bounds/_utils/get-bounds.js.map +1 -0
- package/lib/module/utils/bounds/_utils/is-bounds-equal.js +14 -0
- package/lib/module/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
- package/lib/module/utils/bounds/_utils/style-composers.js +194 -0
- package/lib/module/utils/bounds/_utils/style-composers.js.map +1 -0
- package/lib/module/utils/bounds/constants.js +14 -3
- package/lib/module/utils/bounds/constants.js.map +1 -1
- package/lib/module/utils/bounds/index.js +208 -15
- package/lib/module/utils/bounds/index.js.map +1 -1
- package/lib/module/utils/gesture/apply-offset-rules.js +228 -0
- package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -0
- package/lib/module/utils/gesture/check-gesture-activation.js +226 -0
- package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -0
- package/lib/module/utils/gesture/determine-dismissal.js +93 -0
- package/lib/module/utils/gesture/determine-dismissal.js.map +1 -0
- package/lib/typescript/components/bound-capture.d.ts +8 -0
- package/lib/typescript/components/bound-capture.d.ts.map +1 -0
- package/lib/typescript/components/controllers/screen-lifecycle.d.ts.map +1 -1
- package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/components/integrations/masked-view.d.ts +6 -0
- package/lib/typescript/components/integrations/masked-view.d.ts.map +1 -0
- package/lib/typescript/components/root-transition-aware.d.ts +3 -3
- package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
- package/lib/typescript/configs/index.d.ts +3 -0
- package/lib/typescript/configs/index.d.ts.map +1 -1
- package/lib/typescript/configs/presets.d.ts +3 -0
- package/lib/typescript/configs/presets.d.ts.map +1 -1
- package/lib/typescript/configs/specs.d.ts.map +1 -1
- package/lib/typescript/hooks/animation/use-associated-style.d.ts +6 -4
- package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -1
- package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts → use-bound-registry.d.ts} +5 -4
- package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts.map → use-bound-registry.d.ts.map} +1 -1
- package/lib/typescript/hooks/gestures/use-build-gestures.d.ts +6 -5
- package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts +6 -0
- package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts.map +1 -0
- package/lib/typescript/hooks/gestures/{use-scroll-progress.d.ts → use-scroll-registry.d.ts} +2 -2
- package/lib/typescript/hooks/gestures/use-scroll-registry.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +13 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/providers/gestures.d.ts +4 -2
- package/lib/typescript/providers/gestures.d.ts.map +1 -1
- package/lib/typescript/providers/transition-styles.d.ts +8 -0
- package/lib/typescript/providers/transition-styles.d.ts.map +1 -0
- package/lib/typescript/stores/bounds.d.ts +11 -0
- package/lib/typescript/stores/bounds.d.ts.map +1 -1
- package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +3 -1
- package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
- package/lib/typescript/types/bounds.d.ts +5 -1
- package/lib/typescript/types/bounds.d.ts.map +1 -1
- package/lib/typescript/types/gesture.d.ts +14 -0
- package/lib/typescript/types/gesture.d.ts.map +1 -1
- package/lib/typescript/types/navigator.d.ts +5 -1
- package/lib/typescript/types/navigator.d.ts.map +1 -1
- package/lib/typescript/utils/animation/derivations.d.ts +19 -0
- package/lib/typescript/utils/animation/derivations.d.ts.map +1 -0
- package/lib/typescript/utils/animation/run-transition.d.ts +2 -1
- package/lib/typescript/utils/animation/run-transition.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_types/builder.d.ts +96 -14
- package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_types/geometry.d.ts +0 -1
- package/lib/typescript/utils/bounds/_types/geometry.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_utils/flatten-styles.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/{geometry.d.ts → _utils/geometry.d.ts} +8 -5
- package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts +4 -0
- package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts +7 -0
- package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/{style-composers.d.ts → _utils/style-composers.d.ts} +7 -10
- package/lib/typescript/utils/bounds/_utils/style-composers.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/constants.d.ts +5 -5
- package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/index.d.ts +2 -4
- package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +38 -0
- package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -0
- package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +38 -0
- package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -0
- package/lib/typescript/utils/gesture/determine-dismissal.d.ts +25 -0
- package/lib/typescript/utils/gesture/determine-dismissal.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/__tests__/geometry.test.ts +15 -12
- package/src/components/{bounds-activator.tsx → bound-capture.tsx} +1 -1
- package/src/components/controllers/screen-lifecycle.tsx +13 -5
- package/src/components/create-transition-aware-component.tsx +17 -11
- package/src/components/integrations/masked-view.tsx +56 -0
- package/src/components/root-transition-aware.tsx +31 -39
- package/src/configs/index.ts +20 -8
- package/src/configs/presets.ts +401 -6
- package/src/configs/specs.ts +1 -0
- package/src/hooks/animation/use-associated-style.tsx +12 -11
- package/src/hooks/animation/use-screen-animation.tsx +48 -49
- package/src/hooks/bounds/{use-bound-measurer.tsx → use-bound-registry.tsx} +32 -20
- package/src/hooks/gestures/use-build-gestures.tsx +193 -228
- package/src/hooks/gestures/use-parent-gesture-registry.tsx +18 -0
- package/src/hooks/gestures/use-scroll-registry.tsx +145 -0
- package/src/index.ts +2 -0
- package/src/integrations/native-stack/views/NativeStackView.native.tsx +8 -5
- package/src/providers/gestures.tsx +19 -22
- package/src/providers/transition-styles.tsx +52 -0
- package/src/stores/bounds.ts +156 -0
- package/src/stores/utils/reset-stores-for-screen.ts +7 -2
- package/src/types/bounds.ts +8 -1
- package/src/types/gesture.ts +19 -0
- package/src/types/navigator.ts +5 -1
- package/src/utils/animation/derivations.ts +38 -0
- package/src/utils/animation/run-transition.ts +4 -1
- package/src/utils/bounds/_types/builder.ts +127 -11
- package/src/utils/bounds/_types/geometry.ts +0 -1
- package/src/utils/bounds/_utils/geometry.ts +166 -0
- package/src/utils/bounds/_utils/get-bounds.ts +54 -0
- package/src/utils/bounds/_utils/is-bounds-equal.ts +24 -0
- package/src/utils/bounds/_utils/style-composers.ts +216 -0
- package/src/utils/bounds/constants.ts +37 -22
- package/src/utils/bounds/index.ts +269 -19
- package/src/utils/gesture/apply-offset-rules.ts +314 -0
- package/src/utils/gesture/check-gesture-activation.ts +310 -0
- package/src/utils/gesture/determine-dismissal.ts +131 -0
- package/lib/commonjs/components/bounds-activator.js.map +0 -1
- package/lib/commonjs/hooks/bounds/use-bound-measurer.js +0 -52
- package/lib/commonjs/hooks/bounds/use-bound-measurer.js.map +0 -1
- package/lib/commonjs/hooks/gestures/use-scroll-progress.js +0 -57
- package/lib/commonjs/hooks/gestures/use-scroll-progress.js.map +0 -1
- package/lib/commonjs/utils/bounds/build-bound-styles.js +0 -145
- package/lib/commonjs/utils/bounds/build-bound-styles.js.map +0 -1
- package/lib/commonjs/utils/bounds/flatten-styles.js.map +0 -1
- package/lib/commonjs/utils/bounds/geometry.js +0 -94
- package/lib/commonjs/utils/bounds/geometry.js.map +0 -1
- package/lib/commonjs/utils/bounds/get-bounds.js.map +0 -1
- package/lib/commonjs/utils/bounds/style-composers.js +0 -199
- package/lib/commonjs/utils/bounds/style-composers.js.map +0 -1
- package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js +0 -81
- package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
- package/lib/commonjs/utils/gesture/normalize-gesture-translation.js +0 -21
- package/lib/commonjs/utils/gesture/normalize-gesture-translation.js.map +0 -1
- package/lib/module/components/bounds-activator.js.map +0 -1
- package/lib/module/hooks/bounds/use-bound-measurer.js +0 -47
- package/lib/module/hooks/bounds/use-bound-measurer.js.map +0 -1
- package/lib/module/hooks/gestures/use-scroll-progress.js +0 -52
- package/lib/module/hooks/gestures/use-scroll-progress.js.map +0 -1
- package/lib/module/utils/bounds/build-bound-styles.js +0 -141
- package/lib/module/utils/bounds/build-bound-styles.js.map +0 -1
- package/lib/module/utils/bounds/flatten-styles.js.map +0 -1
- package/lib/module/utils/bounds/geometry.js +0 -89
- package/lib/module/utils/bounds/geometry.js.map +0 -1
- package/lib/module/utils/bounds/get-bounds.js.map +0 -1
- package/lib/module/utils/bounds/style-composers.js +0 -191
- package/lib/module/utils/bounds/style-composers.js.map +0 -1
- package/lib/module/utils/gesture/apply-gesture-activation-criteria.js +0 -76
- package/lib/module/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
- package/lib/module/utils/gesture/normalize-gesture-translation.js +0 -16
- package/lib/module/utils/gesture/normalize-gesture-translation.js.map +0 -1
- package/lib/typescript/components/bounds-activator.d.ts +0 -8
- package/lib/typescript/components/bounds-activator.d.ts.map +0 -1
- package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/build-bound-styles.d.ts +0 -4
- package/lib/typescript/utils/bounds/build-bound-styles.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/flatten-styles.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/geometry.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/get-bounds.d.ts +0 -4
- package/lib/typescript/utils/bounds/get-bounds.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/style-composers.d.ts.map +0 -1
- package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts +0 -17
- package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts.map +0 -1
- package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts +0 -6
- package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts.map +0 -1
- package/src/hooks/gestures/use-scroll-progress.tsx +0 -60
- package/src/utils/bounds/build-bound-styles.ts +0 -184
- package/src/utils/bounds/geometry.ts +0 -113
- package/src/utils/bounds/get-bounds.ts +0 -56
- package/src/utils/bounds/style-composers.ts +0 -172
- package/src/utils/gesture/apply-gesture-activation-criteria.ts +0 -109
- package/src/utils/gesture/normalize-gesture-translation.ts +0 -20
- /package/lib/commonjs/utils/bounds/{flatten-styles.js → _utils/flatten-styles.js} +0 -0
- /package/lib/module/utils/bounds/{flatten-styles.js → _utils/flatten-styles.js} +0 -0
- /package/lib/typescript/utils/bounds/{flatten-styles.d.ts → _utils/flatten-styles.d.ts} +0 -0
- /package/src/utils/bounds/{flatten-styles.ts → _utils/flatten-styles.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-bounds-equal.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_utils/is-bounds-equal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,eAAO,MAAM,aAAa,GAAI,oCAI3B;IACF,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;CACvB,YAYA,CAAC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { BoundsBuilderOptions } from "
|
|
3
|
-
import type { ContentTransformGeometry, RelativeGeometry } from "
|
|
4
|
-
/**
|
|
5
|
-
* Common interpolation helper signature used by composers.
|
|
6
|
-
* It maps from a -> b over the already-determined progress range.
|
|
7
|
-
*/
|
|
8
|
-
export type Interp = (a: number, b: number) => number;
|
|
1
|
+
import { type MeasuredDimensions, type StyleProps } from "react-native-reanimated";
|
|
2
|
+
import type { BoundsBuilderOptions } from "../_types/builder";
|
|
3
|
+
import type { ContentTransformGeometry, RelativeGeometry } from "../_types/geometry";
|
|
9
4
|
/**
|
|
10
5
|
* Element-level (relative) params shared by size/transform composers.
|
|
11
6
|
* - start/end: absolute window bounds of the element in previous/next phases
|
|
@@ -16,7 +11,8 @@ export type ElementComposeParams = {
|
|
|
16
11
|
start: MeasuredDimensions;
|
|
17
12
|
end: MeasuredDimensions;
|
|
18
13
|
geometry: RelativeGeometry;
|
|
19
|
-
|
|
14
|
+
progress: number;
|
|
15
|
+
ranges: readonly [number, number];
|
|
20
16
|
computeOptions: BoundsBuilderOptions;
|
|
21
17
|
};
|
|
22
18
|
/**
|
|
@@ -29,7 +25,8 @@ export type ContentComposeParams = {
|
|
|
29
25
|
start: MeasuredDimensions;
|
|
30
26
|
end: MeasuredDimensions;
|
|
31
27
|
geometry: ContentTransformGeometry;
|
|
32
|
-
|
|
28
|
+
progress: number;
|
|
29
|
+
ranges: readonly [number, number];
|
|
33
30
|
computeOptions: BoundsBuilderOptions;
|
|
34
31
|
};
|
|
35
32
|
export declare function composeSizeAbsolute(params: ElementComposeParams): StyleProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-composers.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_utils/style-composers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EACX,wBAAwB,EACxB,gBAAgB,EAChB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAgC5E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAkC5E;AAED,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,oBAAoB,GAC1B,UAAU,CA6BZ;AAED,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,oBAAoB,GAC1B,UAAU,CAoCZ;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CA+B5E"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ScaledSize } from
|
|
2
|
-
import type { MeasuredDimensions } from
|
|
3
|
-
import type { Complete } from
|
|
4
|
-
import type { BoundsBuilderOptions } from
|
|
1
|
+
import type { ScaledSize } from "react-native";
|
|
2
|
+
import type { MeasuredDimensions } from "react-native-reanimated";
|
|
3
|
+
import type { Complete } from "../../types/utils";
|
|
4
|
+
import type { BoundsBuilderOptions } from "./_types/builder";
|
|
5
5
|
export declare const FULLSCREEN_DIMENSIONS: (dimensions: ScaledSize) => MeasuredDimensions;
|
|
6
|
-
export declare const DEFAULT_BUILDER_OPTIONS: Complete<BoundsBuilderOptions
|
|
6
|
+
export declare const DEFAULT_BUILDER_OPTIONS: Complete<Omit<BoundsBuilderOptions, "id">>;
|
|
7
7
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,GACjC,YAAY,UAAU,KACpB,kBAUF,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC7C,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAmBtB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScaledSize } from "react-native";
|
|
2
|
-
import type { ScreenPhase } from "../../types/core";
|
|
3
2
|
import type { ScreenTransitionState } from "../../types/animation";
|
|
3
|
+
import type { BoundsAccessor } from "../../types/bounds";
|
|
4
4
|
export interface BuildBoundsAccessorParams {
|
|
5
5
|
activeBoundId: string | null;
|
|
6
6
|
current: ScreenTransitionState;
|
|
@@ -9,7 +9,5 @@ export interface BuildBoundsAccessorParams {
|
|
|
9
9
|
progress: number;
|
|
10
10
|
dimensions: ScaledSize;
|
|
11
11
|
}
|
|
12
|
-
export declare const
|
|
13
|
-
get: (id?: string, phase?: ScreenPhase) => import("../../types/bounds").BoundEntry;
|
|
14
|
-
};
|
|
12
|
+
export declare const createBounds: ({ activeBoundId, current, previous, next, progress, dimensions, }: BuildBoundsAccessorParams) => BoundsAccessor;
|
|
15
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,oBAAoB,CAAC;AAqBxE,MAAM,WAAW,yBAAyB;IACzC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACvB;AAwND,eAAO,MAAM,YAAY,GAAI,mEAO1B,yBAAyB,KAAG,cAyC9B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ScaledSize } from "react-native";
|
|
2
|
+
import type { GestureStateManagerType } from "react-native-gesture-handler/lib/typescript/handlers/gestures/gestureStateManager";
|
|
3
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
4
|
+
import { type GestureActivationArea, GestureOffsetState } from "../../types/gesture";
|
|
5
|
+
type Directions = {
|
|
6
|
+
vertical: boolean;
|
|
7
|
+
verticalInverted: boolean;
|
|
8
|
+
horizontal: boolean;
|
|
9
|
+
horizontalInverted: boolean;
|
|
10
|
+
};
|
|
11
|
+
interface CheckGestureActivationProps {
|
|
12
|
+
initialTouch: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
touch: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
directions: Directions;
|
|
21
|
+
manager?: GestureStateManagerType;
|
|
22
|
+
gestureOffsetState: SharedValue<GestureOffsetState>;
|
|
23
|
+
activationArea?: GestureActivationArea;
|
|
24
|
+
dimensions: ScaledSize;
|
|
25
|
+
responseDistance?: number;
|
|
26
|
+
}
|
|
27
|
+
interface ReturnValues {
|
|
28
|
+
isSwipingDown: boolean;
|
|
29
|
+
isSwipingUp: boolean;
|
|
30
|
+
isSwipingRight: boolean;
|
|
31
|
+
isSwipingLeft: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Since we're using onTouchesMove to activate our pan, faillOffset and activateOffset don't actually work. In that case we'll create this function to use in onTouchesMove which acts simarly to the original functionality.
|
|
35
|
+
*/
|
|
36
|
+
export declare const applyOffsetRules: ({ initialTouch, touch, directions, manager, gestureOffsetState, activationArea, dimensions, responseDistance, }: CheckGestureActivationProps) => ReturnValues;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=apply-offset-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-offset-rules.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/apply-offset-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mFAAmF,CAAC;AACjI,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAEN,KAAK,qBAAqB,EAC1B,kBAAkB,EAElB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,UAAU,GAAG;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,UAAU,2BAA2B;IACpC,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AA8BD,UAAU,YAAY;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACvB;AAiKD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,iHAS9B,2BAA2B,KAAG,YA+EhC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ScaledSize } from "react-native";
|
|
2
|
+
import type { GestureStateManagerType } from "react-native-gesture-handler/lib/typescript/handlers/gestures/gestureStateManager";
|
|
3
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
4
|
+
import { type GestureActivationArea, GestureOffsetState } from "../../types/gesture";
|
|
5
|
+
type Directions = {
|
|
6
|
+
vertical: boolean;
|
|
7
|
+
verticalInverted: boolean;
|
|
8
|
+
horizontal: boolean;
|
|
9
|
+
horizontalInverted: boolean;
|
|
10
|
+
};
|
|
11
|
+
interface CheckGestureActivationProps {
|
|
12
|
+
initialTouch: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
touch: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
directions: Directions;
|
|
21
|
+
manager?: GestureStateManagerType;
|
|
22
|
+
gestureOffsetState: SharedValue<GestureOffsetState>;
|
|
23
|
+
activationArea?: GestureActivationArea;
|
|
24
|
+
dimensions: ScaledSize;
|
|
25
|
+
responseDistance?: number;
|
|
26
|
+
}
|
|
27
|
+
interface ReturnValues {
|
|
28
|
+
isSwipingDown: boolean;
|
|
29
|
+
isSwipingUp: boolean;
|
|
30
|
+
isSwipingRight: boolean;
|
|
31
|
+
isSwipingLeft: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Since we're using onTouchesMove to activate our pan, faillOffset and activateOffset don't actually work. In that case we'll create this function to use in onTouchesMove which acts simarly to the original functionality.
|
|
35
|
+
*/
|
|
36
|
+
export declare const applyOffsetRules: ({ initialTouch, touch, directions, manager, gestureOffsetState, activationArea, dimensions, responseDistance, }: CheckGestureActivationProps) => ReturnValues;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=check-gesture-activation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-gesture-activation.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/check-gesture-activation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mFAAmF,CAAC;AACjI,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAEN,KAAK,qBAAqB,EAC1B,kBAAkB,EAElB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,UAAU,GAAG;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,UAAU,2BAA2B;IACpC,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AA8BD,UAAU,YAAY;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACvB;AAiKD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,iHAS9B,2BAA2B,KAAG,YA2EhC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface DetermineDismissalProps {
|
|
2
|
+
event: {
|
|
3
|
+
translationX: number;
|
|
4
|
+
translationY: number;
|
|
5
|
+
velocityX: number;
|
|
6
|
+
velocityY: number;
|
|
7
|
+
};
|
|
8
|
+
directions: {
|
|
9
|
+
vertical: boolean;
|
|
10
|
+
verticalInverted: boolean;
|
|
11
|
+
horizontal: boolean;
|
|
12
|
+
horizontalInverted: boolean;
|
|
13
|
+
};
|
|
14
|
+
dimensions: {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
gestureVelocityImpact: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const determineDismissal: ({ event, directions, dimensions, gestureVelocityImpact, }: DetermineDismissalProps) => {
|
|
21
|
+
shouldDismiss: boolean;
|
|
22
|
+
velocity: number;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=determine-dismissal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"determine-dismissal.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/determine-dismissal.ts"],"names":[],"mappings":"AAOA,UAAU,uBAAuB;IAChC,KAAK,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,UAAU,EAAE;QACX,QAAQ,EAAE,OAAO,CAAC;QAClB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,UAAU,EAAE,OAAO,CAAC;QACpB,kBAAkB,EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,qBAAqB,EAAE,MAAM,CAAC;CAC9B;AAuCD,eAAO,MAAM,kBAAkB,GAAI,2DAKhC,uBAAuB;;;CAgEzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screen-transitions",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Easy screen transitions for React Native and Expo",
|
|
5
5
|
"author": "Ed",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
]
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "92afaa07f6b9c279851d6aef805ecbfefdbcc4df"
|
|
69
69
|
}
|
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "bun:test";
|
|
|
2
2
|
import {
|
|
3
3
|
computeContentTransformGeometry,
|
|
4
4
|
computeRelativeGeometry,
|
|
5
|
-
} from "../utils/bounds/geometry";
|
|
5
|
+
} from "../utils/bounds/_utils/geometry";
|
|
6
6
|
|
|
7
7
|
describe("computeRelativeGeometry", () => {
|
|
8
8
|
it("calculates correct relative geometry when entering", () => {
|
|
@@ -29,7 +29,6 @@ describe("computeRelativeGeometry", () => {
|
|
|
29
29
|
expect(result.dy).toBe(-180); // center diff Y
|
|
30
30
|
expect(result.scaleX).toBe(0.5); // width ratio
|
|
31
31
|
expect(result.scaleY).toBe(0.5); // height ratio
|
|
32
|
-
expect(result.ranges).toEqual([0, 1]);
|
|
33
32
|
expect(result.entering).toBe(true);
|
|
34
33
|
});
|
|
35
34
|
|
|
@@ -39,7 +38,6 @@ describe("computeRelativeGeometry", () => {
|
|
|
39
38
|
|
|
40
39
|
const result = computeRelativeGeometry({ start, end, entering: false });
|
|
41
40
|
|
|
42
|
-
expect(result.ranges).toEqual([1, 2]);
|
|
43
41
|
expect(result.entering).toBe(false);
|
|
44
42
|
});
|
|
45
43
|
});
|
|
@@ -47,7 +45,7 @@ describe("computeRelativeGeometry", () => {
|
|
|
47
45
|
describe("computeContentTransformGeometry", () => {
|
|
48
46
|
const dimensions = { width: 375, height: 812, scale: 1, fontScale: 1 };
|
|
49
47
|
|
|
50
|
-
it("
|
|
48
|
+
it("uniform chooses min scale when aspect ratio differs significantly", () => {
|
|
51
49
|
const start = {
|
|
52
50
|
x: 0,
|
|
53
51
|
y: 0,
|
|
@@ -63,15 +61,15 @@ describe("computeContentTransformGeometry", () => {
|
|
|
63
61
|
end,
|
|
64
62
|
entering: true,
|
|
65
63
|
dimensions,
|
|
66
|
-
|
|
64
|
+
anchor: "center",
|
|
65
|
+
scaleMode: "uniform",
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
expect(result.s).toBe(0.5);
|
|
70
69
|
expect(result.entering).toBe(true);
|
|
71
|
-
expect(result.ranges).toEqual([0, 1]);
|
|
72
70
|
});
|
|
73
71
|
|
|
74
|
-
it("calculates transform with
|
|
72
|
+
it("calculates transform with match mode (average of sx/sy)", () => {
|
|
75
73
|
const start = {
|
|
76
74
|
x: 0,
|
|
77
75
|
y: 0,
|
|
@@ -87,13 +85,16 @@ describe("computeContentTransformGeometry", () => {
|
|
|
87
85
|
end,
|
|
88
86
|
entering: true,
|
|
89
87
|
dimensions,
|
|
90
|
-
|
|
88
|
+
anchor: "center",
|
|
89
|
+
// match mode uses the average of sx and sy
|
|
90
|
+
scaleMode: "match",
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
// sx = 100/200 = 0.5, sy = 100/50 = 2 -> (0.5 + 2) / 2 = 1.25
|
|
94
|
+
expect(result.s).toBeCloseTo(1.25, 5);
|
|
94
95
|
});
|
|
95
96
|
|
|
96
|
-
it("
|
|
97
|
+
it("uniform chooses max scale when aspect ratios are similar", () => {
|
|
97
98
|
const start = { x: 0, y: 0, pageX: 0, pageY: 0, width: 100, height: 100 };
|
|
98
99
|
const end = { x: 0, y: 0, pageX: 0, pageY: 0, width: 200, height: 195 };
|
|
99
100
|
|
|
@@ -102,7 +103,8 @@ describe("computeContentTransformGeometry", () => {
|
|
|
102
103
|
end,
|
|
103
104
|
entering: true,
|
|
104
105
|
dimensions,
|
|
105
|
-
|
|
106
|
+
anchor: "center",
|
|
107
|
+
scaleMode: "uniform",
|
|
106
108
|
});
|
|
107
109
|
|
|
108
110
|
expect(result.s).toBeCloseTo(0.512, 2);
|
|
@@ -118,7 +120,8 @@ describe("computeContentTransformGeometry", () => {
|
|
|
118
120
|
end,
|
|
119
121
|
entering: true,
|
|
120
122
|
dimensions,
|
|
121
|
-
|
|
123
|
+
anchor: "center",
|
|
124
|
+
scaleMode: "uniform",
|
|
122
125
|
});
|
|
123
126
|
|
|
124
127
|
expect(result.s).toBeDefined();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect } from "react";
|
|
2
|
+
import { useParentGestureRegistry } from "../../hooks/gestures/use-parent-gesture-registry";
|
|
2
3
|
import useStableCallback from "../../hooks/use-stable-callback";
|
|
3
4
|
import { useKeys } from "../../providers/keys";
|
|
4
5
|
import { Animations } from "../../stores/animations";
|
|
@@ -23,21 +24,25 @@ export const ScreenLifecycleController = ({
|
|
|
23
24
|
|
|
24
25
|
// Don't run e.preventDefault when the dismissal was on the local root
|
|
25
26
|
if (requestedDismissOnNavigator) {
|
|
26
|
-
resetStoresForScreen(current);
|
|
27
|
+
resetStoresForScreen(current, { clearActive: true });
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
// Don't run e.preventDefault when this is the first screen of the stack
|
|
31
32
|
if (current.navigation.getState().index === 0) {
|
|
32
|
-
resetStoresForScreen(current);
|
|
33
|
+
resetStoresForScreen(current, { clearActive: true });
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
e.preventDefault();
|
|
37
38
|
const onFinish = (finished: boolean) => {
|
|
38
39
|
if (finished) {
|
|
39
|
-
resetStoresForScreen(current);
|
|
40
40
|
current.navigation.dispatch(e.data.action);
|
|
41
|
+
|
|
42
|
+
// we'll ensure the dispatch is complete before resetting stores
|
|
43
|
+
requestAnimationFrame(() => {
|
|
44
|
+
resetStoresForScreen(current, { clearActive: false });
|
|
45
|
+
});
|
|
41
46
|
}
|
|
42
47
|
};
|
|
43
48
|
|
|
@@ -57,8 +62,6 @@ export const ScreenLifecycleController = ({
|
|
|
57
62
|
});
|
|
58
63
|
});
|
|
59
64
|
|
|
60
|
-
useLayoutEffect(handleInitialize, []);
|
|
61
|
-
|
|
62
65
|
useEffect(() => {
|
|
63
66
|
const unsubscribe = current.navigation.addListener(
|
|
64
67
|
"beforeRemove",
|
|
@@ -68,5 +71,10 @@ export const ScreenLifecycleController = ({
|
|
|
68
71
|
return unsubscribe;
|
|
69
72
|
}, [current.navigation, handleBeforeRemove]);
|
|
70
73
|
|
|
74
|
+
useLayoutEffect(handleInitialize, []);
|
|
75
|
+
|
|
76
|
+
// important for t.a scrollviews inside nested navigators.
|
|
77
|
+
useParentGestureRegistry();
|
|
78
|
+
|
|
71
79
|
return children;
|
|
72
80
|
};
|
|
@@ -4,13 +4,13 @@ import type { View } from "react-native";
|
|
|
4
4
|
import { GestureDetector } from "react-native-gesture-handler";
|
|
5
5
|
import Animated, { runOnUI, useAnimatedRef } from "react-native-reanimated";
|
|
6
6
|
import { useAssociatedStyles } from "../hooks/animation/use-associated-style";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useBoundsRegistry } from "../hooks/bounds/use-bound-registry";
|
|
8
|
+
import { useScrollRegistry } from "../hooks/gestures/use-scroll-registry";
|
|
9
9
|
import { useGestureContext } from "../providers/gestures";
|
|
10
10
|
import { useKeys } from "../providers/keys";
|
|
11
11
|
import type { TransitionAwareProps } from "../types/core";
|
|
12
12
|
import type { Any } from "../types/utils";
|
|
13
|
-
import {
|
|
13
|
+
import { BoundCapture } from "./bound-capture";
|
|
14
14
|
|
|
15
15
|
interface CreateTransitionAwareComponentOptions {
|
|
16
16
|
isScrollable?: boolean;
|
|
@@ -29,11 +29,10 @@ export function createTransitionAwareComponent<P extends object>(
|
|
|
29
29
|
TransitionAwareProps<P>
|
|
30
30
|
>((props: Any, ref) => {
|
|
31
31
|
const { nativeGesture } = useGestureContext();
|
|
32
|
-
|
|
33
|
-
const { scrollHandler, onContentSizeChange, onLayout } = useScrollProgress({
|
|
32
|
+
const { scrollHandler, onContentSizeChange, onLayout } = useScrollRegistry({
|
|
34
33
|
onScroll: props.onScroll,
|
|
35
34
|
onContentSizeChange: props.onContentSizeChange,
|
|
36
|
-
onLayout: props.onLayout,
|
|
35
|
+
onLayout: props.onLayout,
|
|
37
36
|
});
|
|
38
37
|
|
|
39
38
|
return (
|
|
@@ -64,7 +63,7 @@ export function createTransitionAwareComponent<P extends object>(
|
|
|
64
63
|
id: sharedBoundTag || styleId,
|
|
65
64
|
});
|
|
66
65
|
|
|
67
|
-
const {
|
|
66
|
+
const { measureBounds, handleLayout } = useBoundsRegistry({
|
|
68
67
|
sharedBoundTag,
|
|
69
68
|
animatedRef,
|
|
70
69
|
current,
|
|
@@ -72,21 +71,28 @@ export function createTransitionAwareComponent<P extends object>(
|
|
|
72
71
|
});
|
|
73
72
|
|
|
74
73
|
if (isScrollable) {
|
|
75
|
-
return
|
|
74
|
+
return (
|
|
75
|
+
<ScrollableInner
|
|
76
|
+
{...(props as Any)}
|
|
77
|
+
ref={ref}
|
|
78
|
+
measureBounds={measureBounds}
|
|
79
|
+
handleLayout={handleLayout}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
return (
|
|
79
|
-
<
|
|
85
|
+
<BoundCapture sharedBoundTag={sharedBoundTag} measure={measureBounds}>
|
|
80
86
|
<AnimatedComponent
|
|
81
87
|
{...(rest as Any)}
|
|
82
88
|
ref={animatedRef}
|
|
83
89
|
style={[style, associatedStyles]}
|
|
84
90
|
onPress={onPress}
|
|
85
|
-
onLayout={runOnUI(
|
|
91
|
+
onLayout={runOnUI(handleLayout)}
|
|
86
92
|
>
|
|
87
93
|
{children}
|
|
88
94
|
</AnimatedComponent>
|
|
89
|
-
</
|
|
95
|
+
</BoundCapture>
|
|
90
96
|
);
|
|
91
97
|
});
|
|
92
98
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type StyleProp, StyleSheet, View, type ViewStyle } from "react-native";
|
|
2
|
+
import { createTransitionAwareComponent } from "../create-transition-aware-component";
|
|
3
|
+
|
|
4
|
+
const TransitionView = createTransitionAwareComponent(View);
|
|
5
|
+
|
|
6
|
+
let LazyMaskedView = View;
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
LazyMaskedView = require("@react-native-masked-view/masked-view").default;
|
|
10
|
+
} catch (_) {
|
|
11
|
+
// noop
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const MASK_STYLE_ID = "_ROOT_MASKED";
|
|
15
|
+
const CONTAINER_STYLE_ID = "_ROOT_CONTAINER";
|
|
16
|
+
|
|
17
|
+
export default function MaskedView({
|
|
18
|
+
children,
|
|
19
|
+
style: userStyles = {},
|
|
20
|
+
}: {
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
}) {
|
|
24
|
+
if (LazyMaskedView === View) {
|
|
25
|
+
return children;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<LazyMaskedView
|
|
30
|
+
style={styles.root}
|
|
31
|
+
// @ts-expect-error
|
|
32
|
+
maskElement={
|
|
33
|
+
<TransitionView styleId={MASK_STYLE_ID} style={styles.rootMask} />
|
|
34
|
+
}
|
|
35
|
+
>
|
|
36
|
+
<TransitionView
|
|
37
|
+
styleId={CONTAINER_STYLE_ID}
|
|
38
|
+
style={[styles.rootContainer, userStyles]}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
</TransitionView>
|
|
42
|
+
</LazyMaskedView>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
root: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
},
|
|
50
|
+
rootMask: {
|
|
51
|
+
backgroundColor: "white",
|
|
52
|
+
},
|
|
53
|
+
rootContainer: {
|
|
54
|
+
flex: 1,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
import { memo } from "react";
|
|
2
|
-
import { StyleSheet } from "react-native";
|
|
3
|
-
import Animated, {
|
|
4
|
-
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import Animated, {
|
|
4
|
+
type StyleProps,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
} from "react-native-reanimated";
|
|
7
|
+
import { useTransitionStyles } from "../providers/transition-styles";
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
type Props = {
|
|
7
10
|
children: React.ReactNode;
|
|
8
|
-
}
|
|
11
|
+
};
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
({ children }: RootTransitionAwareProps) => {
|
|
12
|
-
const { screenInterpolatorProps, screenStyleInterpolator } =
|
|
13
|
-
_useScreenAnimation();
|
|
13
|
+
const EMPTY_STYLE = Object.freeze({} as StyleProps);
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (!screenStyleInterpolator) {
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
const props = screenInterpolatorProps.value;
|
|
21
|
-
return screenStyleInterpolator(props).contentStyle || {};
|
|
22
|
-
});
|
|
15
|
+
export const RootTransitionAware = memo(({ children }: Props) => {
|
|
16
|
+
const stylesMap = useTransitionStyles();
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
return (
|
|
30
|
-
screenStyleInterpolator(screenInterpolatorProps.value).overlayStyle ||
|
|
31
|
-
{}
|
|
32
|
-
);
|
|
33
|
-
});
|
|
18
|
+
const animatedContentStyle = useAnimatedStyle(() => {
|
|
19
|
+
"worklet";
|
|
20
|
+
return stylesMap.value.contentStyle || EMPTY_STYLE;
|
|
21
|
+
});
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
const animatedOverlayStyle = useAnimatedStyle(() => {
|
|
24
|
+
"worklet";
|
|
25
|
+
return stylesMap.value.overlayStyle || EMPTY_STYLE;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View style={styles.container}>
|
|
30
|
+
<Animated.View
|
|
31
|
+
style={[StyleSheet.absoluteFillObject, animatedOverlayStyle]}
|
|
32
|
+
pointerEvents="none"
|
|
33
|
+
/>
|
|
34
|
+
<Animated.View style={[styles.content, animatedContentStyle]}>
|
|
35
|
+
{children}
|
|
44
36
|
</Animated.View>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
);
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
});
|
|
48
40
|
|
|
49
41
|
const styles = StyleSheet.create({
|
|
50
42
|
container: {
|
package/src/configs/index.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
DraggableCard,
|
|
3
|
+
ElasticCard,
|
|
4
|
+
SharedAppleMusic,
|
|
5
|
+
SharedIGImage,
|
|
6
|
+
SharedXImage,
|
|
7
|
+
SlideFromBottom,
|
|
8
|
+
SlideFromTop,
|
|
9
|
+
ZoomIn,
|
|
10
|
+
} from "./presets";
|
|
11
|
+
import { DefaultSpec } from "./specs";
|
|
3
12
|
|
|
4
13
|
export const specs = {
|
|
5
|
-
|
|
14
|
+
DefaultSpec,
|
|
6
15
|
};
|
|
7
16
|
|
|
8
17
|
export const presets = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
SlideFromTop,
|
|
19
|
+
ZoomIn,
|
|
20
|
+
SlideFromBottom,
|
|
21
|
+
DraggableCard,
|
|
22
|
+
ElasticCard,
|
|
23
|
+
SharedIGImage,
|
|
24
|
+
SharedAppleMusic,
|
|
25
|
+
SharedXImage,
|
|
14
26
|
};
|