react-native-screen-transitions 2.3.1 → 2.3.3
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/README.md +50 -12
- package/lib/commonjs/__configs__/index.js.map +1 -0
- package/lib/commonjs/{configs → __configs__}/presets.js +7 -3
- package/lib/commonjs/__configs__/presets.js.map +1 -0
- package/lib/commonjs/{configs → __configs__}/specs.js +1 -0
- package/lib/commonjs/__configs__/specs.js.map +1 -0
- package/lib/commonjs/components/controllers/screen-lifecycle.js +5 -5
- package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -1
- package/lib/commonjs/components/create-transition-aware-component.js +13 -32
- package/lib/commonjs/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/components/integrations/masked-view.js +3 -4
- package/lib/commonjs/components/integrations/masked-view.js.map +1 -1
- package/lib/commonjs/components/root-transition-aware.js +3 -3
- package/lib/commonjs/components/root-transition-aware.js.map +1 -1
- package/lib/commonjs/constants.js +103 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/hooks/animation/use-associated-style.js +3 -4
- package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/hooks/animation/use-screen-animation.js +6 -28
- package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/hooks/bounds/use-bound-registry.js +92 -31
- package/lib/commonjs/hooks/bounds/use-bound-registry.js.map +1 -1
- package/lib/commonjs/hooks/gestures/use-build-gestures.js +27 -41
- package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/index.js +3 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/utils/debounce.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/utils/useDismissedRouteError.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/views/FontProcessor.js +1 -1
- package/lib/commonjs/integrations/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/views/FontProcessor.native.js +1 -1
- package/lib/commonjs/integrations/native-stack/views/FontProcessor.native.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +2 -2
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/commonjs/providers/gestures.js +1 -9
- package/lib/commonjs/providers/gestures.js.map +1 -1
- package/lib/commonjs/{components/screen-transition-tree.js → providers/screen-transition-provider.js} +5 -5
- package/lib/commonjs/providers/screen-transition-provider.js.map +1 -0
- package/lib/commonjs/providers/transition-styles.js +4 -4
- package/lib/commonjs/providers/transition-styles.js.map +1 -1
- package/lib/commonjs/utils/animation/start-screen-transition.js +54 -0
- package/lib/commonjs/utils/animation/start-screen-transition.js.map +1 -0
- package/lib/commonjs/utils/bounds/index.js +6 -18
- package/lib/commonjs/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/utils/gesture/apply-offset-rules.js +12 -21
- package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -1
- package/lib/commonjs/utils/gesture/determine-dismissal.js +7 -55
- package/lib/commonjs/utils/gesture/determine-dismissal.js.map +1 -1
- package/lib/commonjs/utils/gesture/reset-gesture-values.js +46 -0
- package/lib/commonjs/utils/gesture/reset-gesture-values.js.map +1 -0
- package/lib/commonjs/utils/gesture/velocity.js +89 -0
- package/lib/commonjs/utils/gesture/velocity.js.map +1 -0
- package/lib/commonjs/utils/reanimated/version.js +12 -0
- package/lib/commonjs/utils/reanimated/version.js.map +1 -0
- package/lib/module/__configs__/index.js.map +1 -0
- package/lib/module/{configs → __configs__}/presets.js +7 -3
- package/lib/module/__configs__/presets.js.map +1 -0
- package/lib/module/{configs → __configs__}/specs.js +1 -0
- package/lib/module/__configs__/specs.js.map +1 -0
- package/lib/module/components/controllers/screen-lifecycle.js +5 -5
- package/lib/module/components/controllers/screen-lifecycle.js.map +1 -1
- package/lib/module/components/create-transition-aware-component.js +13 -32
- package/lib/module/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/components/integrations/masked-view.js +1 -2
- package/lib/module/components/integrations/masked-view.js.map +1 -1
- package/lib/module/components/root-transition-aware.js +3 -3
- package/lib/module/components/root-transition-aware.js.map +1 -1
- package/lib/module/constants.js +98 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/hooks/animation/use-associated-style.js +3 -4
- package/lib/module/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/hooks/animation/use-screen-animation.js +6 -28
- package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/hooks/bounds/use-bound-registry.js +93 -33
- package/lib/module/hooks/bounds/use-bound-registry.js.map +1 -1
- package/lib/module/hooks/gestures/use-build-gestures.js +22 -36
- package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/integrations/native-stack/utils/debounce.js.map +1 -1
- package/lib/module/integrations/native-stack/utils/useAnimatedHeaderHeight.js +1 -1
- package/lib/module/integrations/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -1
- package/lib/module/integrations/native-stack/utils/useDismissedRouteError.js +1 -1
- package/lib/module/integrations/native-stack/utils/useDismissedRouteError.js.map +1 -1
- package/lib/module/integrations/native-stack/views/FontProcessor.js +1 -1
- package/lib/module/integrations/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/module/integrations/native-stack/views/FontProcessor.native.js +2 -2
- package/lib/module/integrations/native-stack/views/FontProcessor.native.js.map +1 -1
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js +2 -2
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/module/providers/gestures.js +0 -8
- package/lib/module/providers/gestures.js.map +1 -1
- package/lib/module/{components/screen-transition-tree.js → providers/screen-transition-provider.js} +4 -4
- package/lib/module/providers/screen-transition-provider.js.map +1 -0
- package/lib/module/providers/transition-styles.js +4 -4
- package/lib/module/providers/transition-styles.js.map +1 -1
- package/lib/module/utils/animation/{run-transition.js → start-screen-transition.js} +15 -13
- package/lib/module/utils/animation/start-screen-transition.js.map +1 -0
- package/lib/module/utils/bounds/index.js +5 -17
- package/lib/module/utils/bounds/index.js.map +1 -1
- package/lib/module/utils/gesture/apply-offset-rules.js +1 -10
- package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -1
- package/lib/module/utils/gesture/determine-dismissal.js +7 -55
- package/lib/module/utils/gesture/determine-dismissal.js.map +1 -1
- package/lib/module/utils/gesture/reset-gesture-values.js +41 -0
- package/lib/module/utils/gesture/reset-gesture-values.js.map +1 -0
- package/lib/module/utils/gesture/velocity.js +85 -0
- package/lib/module/utils/gesture/velocity.js.map +1 -0
- package/lib/module/utils/reanimated/version.js +7 -0
- package/lib/module/utils/reanimated/version.js.map +1 -0
- package/lib/typescript/{configs → __configs__}/index.d.ts +1 -1
- package/lib/typescript/__configs__/index.d.ts.map +1 -0
- package/lib/typescript/__configs__/presets.d.ts.map +1 -0
- package/lib/typescript/__configs__/specs.d.ts.map +1 -0
- package/lib/typescript/components/create-transition-aware-component.d.ts +14 -2
- package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/components/integrations/masked-view.d.ts.map +1 -1
- package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
- package/lib/typescript/constants.d.ts +57 -0
- package/lib/typescript/constants.d.ts.map +1 -0
- package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -1
- package/lib/typescript/hooks/animation/use-screen-animation.d.ts +1 -1
- package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/hooks/bounds/use-bound-registry.d.ts +8 -9
- package/lib/typescript/hooks/bounds/use-bound-registry.d.ts.map +1 -1
- package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +100 -68
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/utils/debounce.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/utils/useAnimatedHeaderHeight.d.ts +2 -2
- package/lib/typescript/integrations/native-stack/utils/useDismissedRouteError.d.ts +2 -2
- package/lib/typescript/integrations/native-stack/utils/useDismissedRouteError.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/views/FontProcessor.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/views/FontProcessor.native.d.ts.map +1 -1
- package/lib/typescript/providers/gestures.d.ts +0 -1
- package/lib/typescript/providers/gestures.d.ts.map +1 -1
- package/lib/typescript/{components/screen-transition-tree.d.ts → providers/screen-transition-provider.d.ts} +2 -2
- package/lib/typescript/providers/screen-transition-provider.d.ts.map +1 -0
- package/lib/typescript/providers/transition-styles.d.ts.map +1 -1
- package/lib/typescript/types/core.d.ts +0 -8
- package/lib/typescript/types/core.d.ts.map +1 -1
- package/lib/typescript/utils/animation/start-screen-transition.d.ts +13 -0
- package/lib/typescript/utils/animation/start-screen-transition.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/_types/get-bounds.d.ts +2 -2
- package/lib/typescript/utils/bounds/_types/get-bounds.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/determine-dismissal.d.ts +0 -1
- package/lib/typescript/utils/gesture/determine-dismissal.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/reset-gesture-values.d.ts +16 -0
- package/lib/typescript/utils/gesture/reset-gesture-values.d.ts.map +1 -0
- package/lib/typescript/utils/gesture/velocity.d.ts +25 -0
- package/lib/typescript/utils/gesture/velocity.d.ts.map +1 -0
- package/lib/typescript/utils/reanimated/version.d.ts +2 -0
- package/lib/typescript/utils/reanimated/version.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/{configs → __configs__}/presets.ts +7 -1
- package/src/{configs → __configs__}/specs.ts +1 -0
- package/src/components/controllers/screen-lifecycle.tsx +5 -5
- package/src/components/create-transition-aware-component.tsx +23 -38
- package/src/components/integrations/masked-view.tsx +1 -3
- package/src/components/root-transition-aware.tsx +4 -8
- package/src/constants.ts +106 -0
- package/src/hooks/animation/use-associated-style.tsx +3 -4
- package/src/hooks/animation/use-screen-animation.tsx +15 -32
- package/src/hooks/bounds/use-bound-registry.tsx +112 -25
- package/src/hooks/gestures/use-build-gestures.tsx +31 -25
- package/src/index.ts +1 -1
- package/src/integrations/native-stack/utils/debounce.tsx +9 -9
- package/src/integrations/native-stack/utils/useAnimatedHeaderHeight.tsx +10 -10
- package/src/integrations/native-stack/utils/useDismissedRouteError.tsx +21 -21
- package/src/integrations/native-stack/views/FontProcessor.native.tsx +7 -7
- package/src/integrations/native-stack/views/FontProcessor.tsx +2 -2
- package/src/integrations/native-stack/views/NativeStackView.native.tsx +4 -4
- package/src/providers/gestures.tsx +0 -9
- package/src/{components/screen-transition-tree.tsx → providers/screen-transition-provider.tsx} +3 -3
- package/src/providers/transition-styles.tsx +6 -5
- package/src/types/core.ts +0 -9
- package/src/utils/animation/start-screen-transition.ts +61 -0
- package/src/utils/bounds/_types/get-bounds.ts +7 -7
- package/src/utils/bounds/index.ts +12 -19
- package/src/utils/gesture/apply-offset-rules.ts +9 -11
- package/src/utils/gesture/determine-dismissal.ts +18 -69
- package/src/utils/gesture/reset-gesture-values.ts +48 -0
- package/src/utils/gesture/velocity.ts +144 -0
- package/src/utils/reanimated/version.ts +5 -0
- package/lib/commonjs/components/bound-capture.js +0 -38
- package/lib/commonjs/components/bound-capture.js.map +0 -1
- package/lib/commonjs/components/screen-transition-tree.js.map +0 -1
- package/lib/commonjs/configs/index.js.map +0 -1
- package/lib/commonjs/configs/presets.js.map +0 -1
- package/lib/commonjs/configs/specs.js.map +0 -1
- package/lib/commonjs/utils/animation/run-transition.js +0 -52
- package/lib/commonjs/utils/animation/run-transition.js.map +0 -1
- package/lib/module/components/bound-capture.js +0 -33
- package/lib/module/components/bound-capture.js.map +0 -1
- package/lib/module/components/screen-transition-tree.js.map +0 -1
- package/lib/module/configs/index.js.map +0 -1
- package/lib/module/configs/presets.js.map +0 -1
- package/lib/module/configs/specs.js.map +0 -1
- package/lib/module/utils/animation/run-transition.js.map +0 -1
- package/lib/typescript/components/bound-capture.d.ts +0 -8
- package/lib/typescript/components/bound-capture.d.ts.map +0 -1
- package/lib/typescript/components/screen-transition-tree.d.ts.map +0 -1
- package/lib/typescript/configs/index.d.ts.map +0 -1
- package/lib/typescript/configs/presets.d.ts.map +0 -1
- package/lib/typescript/configs/specs.d.ts.map +0 -1
- package/lib/typescript/utils/animation/run-transition.d.ts +0 -12
- package/lib/typescript/utils/animation/run-transition.d.ts.map +0 -1
- package/src/components/bound-capture.tsx +0 -32
- package/src/utils/animation/run-transition.ts +0 -52
- /package/lib/commonjs/{configs → __configs__}/index.js +0 -0
- /package/lib/module/{configs → __configs__}/index.js +0 -0
- /package/lib/typescript/{configs → __configs__}/presets.d.ts +0 -0
- /package/lib/typescript/{configs → __configs__}/specs.d.ts +0 -0
- /package/src/{configs → __configs__}/index.ts +0 -0
|
@@ -39,14 +39,6 @@ export type TransitionAwareProps<T extends object> = AnimatedProps<T> & {
|
|
|
39
39
|
* </Transition.View>
|
|
40
40
|
*/
|
|
41
41
|
sharedBoundTag?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Eagerly measure this component on layout and store the result in the
|
|
44
|
-
* Bounds registry. Useful for nested shared elements that may not receive
|
|
45
|
-
* the press event but still need up-to-date measurements at navigation time.
|
|
46
|
-
*
|
|
47
|
-
* Only has an effect when used together with `sharedBoundTag`.
|
|
48
|
-
*/
|
|
49
|
-
measureOnLayout?: boolean;
|
|
50
42
|
};
|
|
51
43
|
export type TransitionConfig = {
|
|
52
44
|
open: TransitionSpec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG;IACvE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;OAcG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG;IACvE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;OAcG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,cAAc,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnimationMap } from "../../stores/animations";
|
|
2
|
+
import type { TransitionSpec } from "../../types/animation";
|
|
3
|
+
interface StartScreenTransitionProps {
|
|
4
|
+
target: "open" | "close";
|
|
5
|
+
spec?: TransitionSpec;
|
|
6
|
+
onAnimationFinish?: (finished: boolean) => void;
|
|
7
|
+
animations: AnimationMap;
|
|
8
|
+
/** Optional initial velocity for spring-based progress (units: progress/sec). */
|
|
9
|
+
initialVelocity?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const startScreenTransition: ({ target, spec, onAnimationFinish, animations, initialVelocity, }: StartScreenTransitionProps) => void;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=start-screen-transition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-screen-transition.d.ts","sourceRoot":"","sources":["../../../../src/utils/animation/start-screen-transition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,UAAU,0BAA0B;IACnC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,UAAU,EAAE,YAAY,CAAC;IACzB,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,qBAAqB,GAAI,mEAMnC,0BAA0B,SAwC5B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ScreenTransitionState } from "../../../types/animation";
|
|
2
|
+
import type { ScreenPhase } from "../../../types/core";
|
|
3
3
|
export type GetBoundsParams = {
|
|
4
4
|
id: string | null;
|
|
5
5
|
phase?: ScreenPhase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_types/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_types/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC7B,CAAC"}
|
|
@@ -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;AAU/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,oBAAoB,CAAC;AAoBxE,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;AA0MD,eAAO,MAAM,YAAY,GAAI,mEAO1B,yBAAyB,KAAG,cAyC9B,CAAC"}
|
|
@@ -1 +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;
|
|
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;AAU3D,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;AAsJD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,iHAS9B,2BAA2B,KAAG,YA+EhC,CAAC"}
|
|
@@ -19,7 +19,6 @@ interface DetermineDismissalProps {
|
|
|
19
19
|
}
|
|
20
20
|
export declare const determineDismissal: ({ event, directions, dimensions, gestureVelocityImpact, }: DetermineDismissalProps) => {
|
|
21
21
|
shouldDismiss: boolean;
|
|
22
|
-
velocity: number;
|
|
23
22
|
};
|
|
24
23
|
export {};
|
|
25
24
|
//# sourceMappingURL=determine-dismissal.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAmBD,eAAO,MAAM,kBAAkB,GAAI,2DAKhC,uBAAuB;;CAiCzB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GestureStateChangeEvent, PanGestureHandlerEventPayload } from "react-native-gesture-handler";
|
|
2
|
+
import type { GestureMap } from "../../stores/gestures";
|
|
3
|
+
import type { AnimationConfig } from "../../types/animation";
|
|
4
|
+
interface ResetGestureValuesProps {
|
|
5
|
+
spec?: AnimationConfig;
|
|
6
|
+
gestures: GestureMap;
|
|
7
|
+
shouldDismiss: boolean;
|
|
8
|
+
event: GestureStateChangeEvent<PanGestureHandlerEventPayload>;
|
|
9
|
+
dimensions: {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare const resetGestureValues: ({ spec, gestures, shouldDismiss, event, dimensions, }: ResetGestureValuesProps) => void;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=reset-gesture-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-gesture-values.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/reset-gesture-values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,uBAAuB,EACvB,6BAA6B,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,UAAU,uBAAuB;IAChC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,UAAU,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,uBAAuB,CAAC,6BAA6B,CAAC,CAAC;IAC9D,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED,eAAO,MAAM,kBAAkB,GAAI,uDAMhC,uBAAuB,SAwBzB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GestureStateChangeEvent, PanGestureHandlerEventPayload } from "react-native-gesture-handler";
|
|
2
|
+
import type { AnimationMap } from "../../stores/animations";
|
|
3
|
+
interface CalculateProgressProps {
|
|
4
|
+
animations: AnimationMap;
|
|
5
|
+
shouldDismiss: boolean;
|
|
6
|
+
event: GestureStateChangeEvent<PanGestureHandlerEventPayload>;
|
|
7
|
+
dimensions: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
directions: {
|
|
12
|
+
horizontal: boolean;
|
|
13
|
+
horizontalInverted: boolean;
|
|
14
|
+
vertical: boolean;
|
|
15
|
+
verticalInverted: boolean;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const velocity: {
|
|
19
|
+
normalize: (velocityPixelsPerSecond: number, screenSize: number) => number;
|
|
20
|
+
calculateRestoreVelocity: (currentValueNormalized: number, baseVelocityNormalized: number, threshold?: number) => number;
|
|
21
|
+
calculateProgressVelocity: ({ animations, shouldDismiss, event, dimensions, directions, }: CalculateProgressProps) => number;
|
|
22
|
+
shouldPassDismissalThreshold: (translationPixels: number, velocityPixelsPerSecond: number, screenSize: number, velocityWeight: number) => boolean;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=velocity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"velocity.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/velocity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,uBAAuB,EACvB,6BAA6B,EAC7B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,UAAU,sBAAsB;IAC/B,UAAU,EAAE,YAAY,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,uBAAuB,CAAC,6BAA6B,CAAC,CAAC;IAC9D,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,UAAU,EAAE;QACX,UAAU,EAAE,OAAO,CAAC;QACpB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,QAAQ,EAAE,OAAO,CAAC;QAClB,gBAAgB,EAAE,OAAO,CAAC;KAC1B,CAAC;CACF;AAwHD,eAAO,MAAM,QAAQ;yCA/GuB,MAAM,cAAc,MAAM;uDAc7C,MAAM,0BACN,MAAM,cACnB,MAAM;+FAkBf,sBAAsB;sDAyDL,MAAM,2BACA,MAAM,cACnB,MAAM,kBACF,MAAM;CAsBtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/utils/reanimated/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,eAEzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screen-transitions",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Easy screen transitions for React Native and Expo",
|
|
5
5
|
"author": "Ed",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"react": "*",
|
|
42
42
|
"react-native": "*",
|
|
43
43
|
"react-native-gesture-handler": ">=2.16.1",
|
|
44
|
-
"react-native-reanimated": ">=3.16.0",
|
|
44
|
+
"react-native-reanimated": ">=3.16.0 || >=4.0.0-",
|
|
45
45
|
"react-native-safe-area-context": "*",
|
|
46
46
|
"react-native-screens": ">=4.4.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@testing-library/react-native": "^13.2.0",
|
|
50
|
-
"@types/react": "~19.
|
|
50
|
+
"@types/react": "~19.1.10",
|
|
51
51
|
"react-native-builder-bob": "0.39.0",
|
|
52
52
|
"typescript": "catalog:"
|
|
53
53
|
},
|
|
@@ -246,11 +246,13 @@ export const SharedIGImage = (
|
|
|
246
246
|
normX,
|
|
247
247
|
[-1, 0, 1],
|
|
248
248
|
[-width * 0.7, 0, width * 0.7],
|
|
249
|
+
"clamp",
|
|
249
250
|
);
|
|
250
251
|
const dragY = interpolate(
|
|
251
252
|
normY,
|
|
252
253
|
[-1, 0, 1],
|
|
253
254
|
[-height * 0.4, 0, height * 0.4],
|
|
255
|
+
"clamp",
|
|
254
256
|
);
|
|
255
257
|
const dragXScale = interpolate(normX, [0, 1], [1, 0.8]);
|
|
256
258
|
const dragYScale = interpolate(normY, [0, 1], [1, 0.8]);
|
|
@@ -328,6 +330,7 @@ export const SharedIGImage = (
|
|
|
328
330
|
damping: 1000,
|
|
329
331
|
mass: 3,
|
|
330
332
|
overshootClamping: true,
|
|
333
|
+
//@ts-expect-error
|
|
331
334
|
restSpeedThreshold: 0.02,
|
|
332
335
|
},
|
|
333
336
|
close: {
|
|
@@ -335,6 +338,7 @@ export const SharedIGImage = (
|
|
|
335
338
|
damping: 1000,
|
|
336
339
|
mass: 3,
|
|
337
340
|
overshootClamping: true,
|
|
341
|
+
//@ts-expect-error
|
|
338
342
|
restSpeedThreshold: 0.02,
|
|
339
343
|
},
|
|
340
344
|
},
|
|
@@ -507,13 +511,15 @@ export const SharedAppleMusic = (
|
|
|
507
511
|
damping: 500,
|
|
508
512
|
mass: 3,
|
|
509
513
|
overshootClamping: true,
|
|
514
|
+
//@ts-expect-error
|
|
510
515
|
restSpeedThreshold: 0.02,
|
|
511
516
|
},
|
|
512
517
|
close: {
|
|
513
518
|
stiffness: 600,
|
|
514
519
|
damping: 60,
|
|
515
|
-
mass:
|
|
520
|
+
mass: 4,
|
|
516
521
|
overshootClamping: false,
|
|
522
|
+
//@ts-expect-error
|
|
517
523
|
restSpeedThreshold: 0.02,
|
|
518
524
|
restDisplacementThreshold: 0.002,
|
|
519
525
|
},
|
|
@@ -5,7 +5,7 @@ import { useKeys } from "../../providers/keys";
|
|
|
5
5
|
import { Animations } from "../../stores/animations";
|
|
6
6
|
import { NavigatorDismissState } from "../../stores/navigator-dismiss-state";
|
|
7
7
|
import { resetStoresForScreen } from "../../stores/utils/reset-stores-for-screen";
|
|
8
|
-
import {
|
|
8
|
+
import { startScreenTransition } from "../../utils/animation/start-screen-transition";
|
|
9
9
|
|
|
10
10
|
interface ScreenLifecycleProps {
|
|
11
11
|
children: React.ReactNode;
|
|
@@ -35,7 +35,7 @@ export const ScreenLifecycleController = ({
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
e.preventDefault();
|
|
38
|
-
const
|
|
38
|
+
const onAnimationFinish = (finished: boolean) => {
|
|
39
39
|
if (finished) {
|
|
40
40
|
current.navigation.dispatch(e.data.action);
|
|
41
41
|
|
|
@@ -46,16 +46,16 @@ export const ScreenLifecycleController = ({
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
startScreenTransition({
|
|
50
50
|
target: "close",
|
|
51
51
|
spec: current.options.transitionSpec,
|
|
52
|
-
|
|
52
|
+
onAnimationFinish,
|
|
53
53
|
animations,
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
const handleInitialize = useStableCallback(() => {
|
|
58
|
-
|
|
58
|
+
startScreenTransition({
|
|
59
59
|
target: "open",
|
|
60
60
|
spec: current.options.transitionSpec,
|
|
61
61
|
animations,
|
|
@@ -7,10 +7,8 @@ import { useAssociatedStyles } from "../hooks/animation/use-associated-style";
|
|
|
7
7
|
import { useBoundsRegistry } from "../hooks/bounds/use-bound-registry";
|
|
8
8
|
import { useScrollRegistry } from "../hooks/gestures/use-scroll-registry";
|
|
9
9
|
import { useGestureContext } from "../providers/gestures";
|
|
10
|
-
import { useKeys } from "../providers/keys";
|
|
11
10
|
import type { TransitionAwareProps } from "../types/core";
|
|
12
11
|
import type { Any } from "../types/utils";
|
|
13
|
-
import { BoundCapture } from "./bound-capture";
|
|
14
12
|
|
|
15
13
|
interface CreateTransitionAwareComponentOptions {
|
|
16
14
|
isScrollable?: boolean;
|
|
@@ -52,66 +50,53 @@ export function createTransitionAwareComponent<P extends object>(
|
|
|
52
50
|
const Inner = forwardRef<
|
|
53
51
|
React.ComponentRef<typeof AnimatedComponent>,
|
|
54
52
|
TransitionAwareProps<P>
|
|
55
|
-
>((props,
|
|
56
|
-
const {
|
|
57
|
-
|
|
58
|
-
style,
|
|
59
|
-
sharedBoundTag,
|
|
60
|
-
styleId,
|
|
61
|
-
onPress,
|
|
62
|
-
measureOnLayout,
|
|
63
|
-
...rest
|
|
64
|
-
} = props as Any;
|
|
53
|
+
>((props, _) => {
|
|
54
|
+
const { children, style, sharedBoundTag, styleId, onPress, ...rest } =
|
|
55
|
+
props as Any;
|
|
65
56
|
|
|
66
57
|
const animatedRef = useAnimatedRef<View>();
|
|
67
|
-
const { current } = useKeys();
|
|
68
58
|
|
|
69
59
|
const { associatedStyles } = useAssociatedStyles({
|
|
70
60
|
id: sharedBoundTag || styleId,
|
|
71
61
|
style,
|
|
72
62
|
});
|
|
73
63
|
|
|
74
|
-
const {
|
|
64
|
+
const {
|
|
65
|
+
handleTransitionLayout,
|
|
66
|
+
captureActiveOnPress,
|
|
67
|
+
MeasurementSyncProvider,
|
|
68
|
+
} = useBoundsRegistry({
|
|
75
69
|
sharedBoundTag,
|
|
76
70
|
animatedRef,
|
|
77
|
-
current,
|
|
78
71
|
style,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (isScrollable) {
|
|
82
|
-
return (
|
|
83
|
-
<ScrollableInner
|
|
84
|
-
{...(props as Any)}
|
|
85
|
-
ref={ref}
|
|
86
|
-
measureBounds={measureBounds}
|
|
87
|
-
handleLayout={handleLayout}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const onLayoutHandler = runOnUI(() => {
|
|
93
|
-
"worklet";
|
|
94
|
-
handleLayout();
|
|
95
|
-
if (measureOnLayout && sharedBoundTag) {
|
|
96
|
-
measureBounds();
|
|
97
|
-
}
|
|
72
|
+
onPress,
|
|
98
73
|
});
|
|
99
74
|
|
|
100
75
|
return (
|
|
101
|
-
<
|
|
76
|
+
<MeasurementSyncProvider>
|
|
102
77
|
<AnimatedComponent
|
|
103
78
|
{...(rest as Any)}
|
|
104
79
|
ref={animatedRef}
|
|
105
80
|
style={[style, associatedStyles]}
|
|
106
|
-
onPress={
|
|
107
|
-
onLayout={
|
|
81
|
+
onPress={captureActiveOnPress}
|
|
82
|
+
onLayout={runOnUI(handleTransitionLayout)}
|
|
83
|
+
collapsable={!sharedBoundTag}
|
|
108
84
|
>
|
|
109
85
|
{children}
|
|
110
86
|
</AnimatedComponent>
|
|
111
|
-
</
|
|
87
|
+
</MeasurementSyncProvider>
|
|
112
88
|
);
|
|
113
89
|
});
|
|
114
90
|
|
|
91
|
+
if (isScrollable) {
|
|
92
|
+
return memo(ScrollableInner) as React.MemoExoticComponent<
|
|
93
|
+
React.ForwardRefExoticComponent<
|
|
94
|
+
TransitionAwareProps<P> &
|
|
95
|
+
React.RefAttributes<React.ComponentRef<typeof Wrapped>>
|
|
96
|
+
>
|
|
97
|
+
>;
|
|
98
|
+
}
|
|
99
|
+
|
|
115
100
|
return memo(Inner) as React.MemoExoticComponent<
|
|
116
101
|
React.ForwardRefExoticComponent<
|
|
117
102
|
TransitionAwareProps<P> &
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type StyleProp, StyleSheet, View, type ViewStyle } from "react-native";
|
|
2
|
+
import { CONTAINER_STYLE_ID, MASK_STYLE_ID } from "../../constants";
|
|
2
3
|
import { createTransitionAwareComponent } from "../create-transition-aware-component";
|
|
3
4
|
|
|
4
5
|
const TransitionView = createTransitionAwareComponent(View);
|
|
@@ -11,9 +12,6 @@ try {
|
|
|
11
12
|
// noop
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const MASK_STYLE_ID = "_ROOT_MASKED";
|
|
15
|
-
const CONTAINER_STYLE_ID = "_ROOT_CONTAINER";
|
|
16
|
-
|
|
17
15
|
export default function MaskedView({
|
|
18
16
|
children,
|
|
19
17
|
style: userStyles = {},
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { memo } from "react";
|
|
2
2
|
import { StyleSheet, View } from "react-native";
|
|
3
|
-
import Animated, {
|
|
4
|
-
|
|
5
|
-
useAnimatedStyle,
|
|
6
|
-
} from "react-native-reanimated";
|
|
3
|
+
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
4
|
+
import { NO_STYLES } from "../constants";
|
|
7
5
|
import { useTransitionStyles } from "../providers/transition-styles";
|
|
8
6
|
|
|
9
7
|
type Props = {
|
|
10
8
|
children: React.ReactNode;
|
|
11
9
|
};
|
|
12
10
|
|
|
13
|
-
const EMPTY_STYLE = Object.freeze({} as StyleProps);
|
|
14
|
-
|
|
15
11
|
export const RootTransitionAware = memo(({ children }: Props) => {
|
|
16
12
|
const { stylesMap } = useTransitionStyles();
|
|
17
13
|
|
|
18
14
|
const animatedContentStyle = useAnimatedStyle(() => {
|
|
19
15
|
"worklet";
|
|
20
|
-
return stylesMap.value.contentStyle ||
|
|
16
|
+
return stylesMap.value.contentStyle || NO_STYLES;
|
|
21
17
|
});
|
|
22
18
|
|
|
23
19
|
const animatedOverlayStyle = useAnimatedStyle(() => {
|
|
24
20
|
"worklet";
|
|
25
|
-
return stylesMap.value.overlayStyle ||
|
|
21
|
+
return stylesMap.value.overlayStyle || NO_STYLES;
|
|
26
22
|
});
|
|
27
23
|
|
|
28
24
|
return (
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { ParamListBase, RouteProp } from "@react-navigation/native";
|
|
2
|
+
import type { ScaledSize } from "react-native";
|
|
3
|
+
import type { MeasuredDimensions } from "react-native-reanimated";
|
|
4
|
+
import type { ScreenTransitionState } from "./types/animation";
|
|
5
|
+
import type { BoundEntry } from "./types/bounds";
|
|
6
|
+
import type { ActivationArea } from "./types/gesture";
|
|
7
|
+
import type { Complete } from "./types/utils";
|
|
8
|
+
import type { BoundsBuilderOptions } from "./utils/bounds/_types/builder";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Masked view integration
|
|
12
|
+
*/
|
|
13
|
+
export const MASK_STYLE_ID = "_ROOT_MASKED";
|
|
14
|
+
export const CONTAINER_STYLE_ID = "_ROOT_CONTAINER";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Styles
|
|
18
|
+
*/
|
|
19
|
+
export const NO_STYLES = Object.freeze({});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Default screen transition state
|
|
23
|
+
*/
|
|
24
|
+
export const DEFAULT_SCREEN_TRANSITION_STATE: ScreenTransitionState =
|
|
25
|
+
Object.freeze({
|
|
26
|
+
progress: 0,
|
|
27
|
+
closing: 0,
|
|
28
|
+
animating: 0,
|
|
29
|
+
gesture: {
|
|
30
|
+
x: 0,
|
|
31
|
+
y: 0,
|
|
32
|
+
normalizedX: 0,
|
|
33
|
+
normalizedY: 0,
|
|
34
|
+
isDismissing: 0,
|
|
35
|
+
isDragging: 0,
|
|
36
|
+
},
|
|
37
|
+
bounds: {} as Record<string, BoundEntry>,
|
|
38
|
+
route: {} as RouteProp<ParamListBase>,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Bounds API Defaults
|
|
43
|
+
*/
|
|
44
|
+
export const NO_BOUNDS_MAP: Record<string, BoundEntry> = Object.freeze({});
|
|
45
|
+
export const EMPTY_BOUND_HELPER_RESULT = Object.freeze({});
|
|
46
|
+
export const EMPTY_BOUND_HELPER_RESULT_RAW = Object.freeze({
|
|
47
|
+
scaleX: 1,
|
|
48
|
+
scaleY: 1,
|
|
49
|
+
scale: 1,
|
|
50
|
+
translateX: 0,
|
|
51
|
+
translateY: 0,
|
|
52
|
+
width: 0,
|
|
53
|
+
height: 0,
|
|
54
|
+
});
|
|
55
|
+
export const ENTER_RANGE = [0, 1] as const;
|
|
56
|
+
export const EXIT_RANGE = [1, 2] as const;
|
|
57
|
+
export const FULLSCREEN_DIMENSIONS = (
|
|
58
|
+
dimensions: ScaledSize,
|
|
59
|
+
): MeasuredDimensions => {
|
|
60
|
+
"worklet";
|
|
61
|
+
return {
|
|
62
|
+
x: 0,
|
|
63
|
+
y: 0,
|
|
64
|
+
pageX: 0,
|
|
65
|
+
pageY: 0,
|
|
66
|
+
width: dimensions.width,
|
|
67
|
+
height: dimensions.height,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const DEFAULT_BUILDER_OPTIONS: Complete<
|
|
72
|
+
Omit<BoundsBuilderOptions, "id">
|
|
73
|
+
> = Object.freeze({
|
|
74
|
+
gestures: { x: 0, y: 0 },
|
|
75
|
+
toFullscreen: false,
|
|
76
|
+
absolute: false,
|
|
77
|
+
relative: true,
|
|
78
|
+
method: "transform",
|
|
79
|
+
contentScaleMode: "auto",
|
|
80
|
+
//
|
|
81
|
+
space: "relative",
|
|
82
|
+
target: "bound",
|
|
83
|
+
scaleMode: "match",
|
|
84
|
+
anchor: "center",
|
|
85
|
+
raw: false,
|
|
86
|
+
} as const);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Default gesture config
|
|
90
|
+
*/
|
|
91
|
+
export const GESTURE_VELOCITY_IMPACT = 0.3;
|
|
92
|
+
export const DEFAULT_GESTURE_DIRECTION = "horizontal";
|
|
93
|
+
export const DEFAULT_GESTURE_ENABLED = false;
|
|
94
|
+
export const DEFAULT_GESTURE_DRIVES_PROGRESS = true;
|
|
95
|
+
export const DEFAULT_GESTURE_ACTIVATION_AREA: ActivationArea = "screen";
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Default gesture offset
|
|
99
|
+
*/
|
|
100
|
+
export const GESTURE_ACTIVATION_THRESHOLD_X = 10;
|
|
101
|
+
export const GESTURE_ACTIVATION_THRESHOLD_Y = 10;
|
|
102
|
+
export const GESTURE_FAIL_TOLERANCE_X = 15;
|
|
103
|
+
export const GESTURE_FAIL_TOLERANCE_Y = 20;
|
|
104
|
+
export const DEFAULT_EDGE_DISTANCE_HORIZONTAL = 50;
|
|
105
|
+
export const DEFAULT_EDGE_DISTANCE_VERTICAL = 135;
|
|
106
|
+
export const DEFAULT_ACTIVATION_AREA = "screen" as const;
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
useDerivedValue,
|
|
5
5
|
useSharedValue,
|
|
6
6
|
} from "react-native-reanimated";
|
|
7
|
+
import { NO_STYLES } from "../../constants";
|
|
7
8
|
import { useTransitionStyles } from "../../providers/transition-styles";
|
|
8
9
|
|
|
9
10
|
type Props = {
|
|
@@ -11,8 +12,6 @@ type Props = {
|
|
|
11
12
|
style?: StyleProps;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
const EMPTY_STYLE = Object.freeze({});
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* This hook is used to get the associated styles for a given styleId / boundTag.
|
|
18
17
|
*/
|
|
@@ -41,9 +40,9 @@ export const useAssociatedStyles = ({ id }: Props = {}) => {
|
|
|
41
40
|
"worklet";
|
|
42
41
|
|
|
43
42
|
if (!id || !stylesMap) {
|
|
44
|
-
return
|
|
43
|
+
return NO_STYLES;
|
|
45
44
|
}
|
|
46
|
-
const base = stylesMap.value[id] ||
|
|
45
|
+
const base = stylesMap.value[id] || NO_STYLES;
|
|
47
46
|
|
|
48
47
|
let opacity = 1;
|
|
49
48
|
|
|
@@ -3,6 +3,10 @@ import { useMemo } from "react";
|
|
|
3
3
|
import { useWindowDimensions } from "react-native";
|
|
4
4
|
import { type SharedValue, useDerivedValue } from "react-native-reanimated";
|
|
5
5
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_SCREEN_TRANSITION_STATE,
|
|
8
|
+
NO_BOUNDS_MAP,
|
|
9
|
+
} from "../../constants";
|
|
6
10
|
import { useKeys } from "../../providers/keys";
|
|
7
11
|
import { Animations } from "../../stores/animations";
|
|
8
12
|
import { Bounds } from "../../stores/bounds";
|
|
@@ -11,7 +15,7 @@ import type {
|
|
|
11
15
|
ScreenInterpolationProps,
|
|
12
16
|
ScreenTransitionState,
|
|
13
17
|
} from "../../types/animation";
|
|
14
|
-
|
|
18
|
+
|
|
15
19
|
import type { NativeStackDescriptor } from "../../types/navigator";
|
|
16
20
|
import { derivations } from "../../utils/animation/derivations";
|
|
17
21
|
|
|
@@ -23,24 +27,6 @@ type BuiltState = {
|
|
|
23
27
|
route: RouteProp<ParamListBase>;
|
|
24
28
|
};
|
|
25
29
|
|
|
26
|
-
const EMPTY_BOUNDS = Object.freeze({}) as Record<string, BoundEntry>;
|
|
27
|
-
|
|
28
|
-
const FALLBACK: ScreenTransitionState = Object.freeze({
|
|
29
|
-
progress: 0,
|
|
30
|
-
closing: 0,
|
|
31
|
-
animating: 0,
|
|
32
|
-
gesture: {
|
|
33
|
-
x: 0,
|
|
34
|
-
y: 0,
|
|
35
|
-
normalizedX: 0,
|
|
36
|
-
normalizedY: 0,
|
|
37
|
-
isDismissing: 0,
|
|
38
|
-
isDragging: 0,
|
|
39
|
-
},
|
|
40
|
-
bounds: {} as Record<string, BoundEntry>,
|
|
41
|
-
route: {} as RouteProp<ParamListBase>,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
30
|
const unwrap = (
|
|
45
31
|
s: BuiltState | undefined,
|
|
46
32
|
key: string | undefined,
|
|
@@ -60,7 +46,7 @@ const unwrap = (
|
|
|
60
46
|
isDismissing: s.gesture.isDismissing.value,
|
|
61
47
|
isDragging: s.gesture.isDragging.value,
|
|
62
48
|
},
|
|
63
|
-
bounds: Bounds.getBounds(key) ||
|
|
49
|
+
bounds: Bounds.getBounds(key) || NO_BOUNDS_MAP,
|
|
64
50
|
route: s.route,
|
|
65
51
|
};
|
|
66
52
|
};
|
|
@@ -102,9 +88,14 @@ export function _useScreenAnimation() {
|
|
|
102
88
|
"worklet";
|
|
103
89
|
|
|
104
90
|
const previous = unwrap(prevAnimation, previousDescriptor?.route.key);
|
|
105
|
-
|
|
91
|
+
|
|
92
|
+
const next = nextDescriptor?.options?.enableTransitions
|
|
93
|
+
? unwrap(nextAnimation, nextDescriptor?.route.key)
|
|
94
|
+
: undefined;
|
|
95
|
+
|
|
106
96
|
const current =
|
|
107
|
-
unwrap(currentAnimation, currentDescriptor?.route.key) ??
|
|
97
|
+
unwrap(currentAnimation, currentDescriptor?.route.key) ??
|
|
98
|
+
DEFAULT_SCREEN_TRANSITION_STATE;
|
|
108
99
|
|
|
109
100
|
const {
|
|
110
101
|
progress,
|
|
@@ -138,17 +129,9 @@ export function _useScreenAnimation() {
|
|
|
138
129
|
},
|
|
139
130
|
);
|
|
140
131
|
|
|
141
|
-
|
|
142
|
-
// If the next screen doesn't opt-in to transitions, avoid falling back to the current
|
|
143
|
-
// screen's interpolator to prevent unintended global styles (e.g., scaling previous screens
|
|
144
|
-
// when presenting non-transitioning modals/sheets).
|
|
145
|
-
const nextEnabled = nextDescriptor?.options.enableTransitions;
|
|
146
|
-
const currentEnabled = currentDescriptor?.options.enableTransitions;
|
|
147
|
-
|
|
148
|
-
const nextInterpolator =
|
|
149
|
-
nextEnabled && nextDescriptor?.options.screenStyleInterpolator;
|
|
132
|
+
const nextInterpolator = nextDescriptor?.options.screenStyleInterpolator;
|
|
150
133
|
const currentInterpolator =
|
|
151
|
-
|
|
134
|
+
currentDescriptor?.options.screenStyleInterpolator;
|
|
152
135
|
|
|
153
136
|
const screenStyleInterpolator = nextInterpolator ?? currentInterpolator;
|
|
154
137
|
|