react-native-screen-transitions 3.4.0-alpha.5 → 3.4.0-alpha.7
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 +1058 -11
- package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js +27 -45
- package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js +39 -0
- package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +232 -0
- package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +2 -4
- 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-boundary-measure-and-store.js +4 -3
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +2 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/index.js +20 -214
- package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/providers/boundary-owner.provider.js +63 -0
- package/lib/commonjs/shared/components/create-boundary-component/providers/boundary-owner.provider.js.map +1 -0
- package/lib/commonjs/shared/components/create-transition-aware-component.js +29 -7
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/variations/float-overlay.js +1 -1
- package/lib/commonjs/shared/components/screen-container/hooks/use-backdrop-pointer-events.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/index.js +12 -8
- package/lib/commonjs/shared/components/screen-container/index.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +8 -10
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/content.js +7 -10
- package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +4 -4
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/surface-container.js +4 -4
- package/lib/commonjs/shared/components/screen-container/layers/surface-container.js.map +1 -1
- package/lib/commonjs/shared/constants.js +4 -1
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +33 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +2 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/screen-composer.js +1 -1
- package/lib/commonjs/shared/providers/screen/screen-composer.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/build-resolved-style-map.js +144 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/build-resolved-style-map.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js +28 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/split-normalized-style-maps.js +39 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/split-normalized-style-maps.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles/index.js +25 -0
- package/lib/commonjs/shared/providers/screen/styles/index.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/{styles.provider.js → styles/styles.provider.js} +47 -39
- package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js +21 -10
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +57 -31
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js +27 -45
- package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/module/component-stack/navigators/create-component-stack-navigator.js +1 -1
- package/lib/module/shared/components/create-boundary-component/components/boundary-target.js +34 -0
- package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +227 -0
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +2 -4
- 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-boundary-measure-and-store.js +4 -3
- package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +2 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/index.js +16 -213
- package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/providers/boundary-owner.provider.js +56 -0
- package/lib/module/shared/components/create-boundary-component/providers/boundary-owner.provider.js.map +1 -0
- package/lib/module/shared/components/create-transition-aware-component.js +30 -8
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/overlay/variations/float-overlay.js +1 -1
- package/lib/module/shared/components/overlay/variations/float-overlay.js.map +1 -1
- package/lib/module/shared/components/screen-container/hooks/use-backdrop-pointer-events.js.map +1 -1
- package/lib/module/shared/components/screen-container/index.js +12 -8
- package/lib/module/shared/components/screen-container/index.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +8 -10
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js +7 -10
- package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +4 -4
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/surface-container.js +4 -4
- package/lib/module/shared/components/screen-container/layers/surface-container.js.map +1 -1
- package/lib/module/shared/constants.js +4 -1
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +32 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +2 -0
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/module/shared/providers/screen/screen-composer.js +1 -1
- package/lib/module/shared/providers/screen/screen-composer.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/build-resolved-style-map.js +139 -0
- package/lib/module/shared/providers/screen/styles/helpers/build-resolved-style-map.js.map +1 -0
- package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js +23 -0
- package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js.map +1 -0
- package/lib/module/shared/providers/screen/styles/helpers/split-normalized-style-maps.js +34 -0
- package/lib/module/shared/providers/screen/styles/helpers/split-normalized-style-maps.js.map +1 -0
- package/lib/module/shared/providers/screen/styles/index.js +4 -0
- package/lib/module/shared/providers/screen/styles/index.js.map +1 -0
- package/lib/module/shared/providers/screen/{styles.provider.js → styles/styles.provider.js} +48 -40
- package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +2 -2
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/style-composers.js +21 -10
- package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/build.js +56 -29
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts +9 -15
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/blank-stack/types.d.ts +6 -4
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +1 -1
- package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts +209 -0
- package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts +8 -0
- package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +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-boundary-measure-and-store.d.ts +2 -8
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts +216 -12
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/providers/boundary-owner.provider.d.ts +35 -0
- package/lib/typescript/shared/components/create-boundary-component/providers/boundary-owner.provider.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/hooks/use-backdrop-pointer-events.d.ts +1 -1
- package/lib/typescript/shared/components/screen-container/hooks/use-backdrop-pointer-events.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts +5 -1
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/content.d.ts +3 -1
- package/lib/typescript/shared/components/screen-container/layers/content.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +1 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +209 -2
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +16 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/build-resolved-style-map.d.ts +11 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/build-resolved-style-map.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.d.ts +7 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/split-normalized-style-maps.d.ts +6 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/split-normalized-style-maps.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles/index.d.ts +2 -0
- package/lib/typescript/shared/providers/screen/styles/index.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/{styles.provider.d.ts → styles/styles.provider.d.ts} +3 -5
- package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -0
- package/lib/typescript/shared/types/animation.types.d.ts +16 -9
- package/lib/typescript/shared/types/animation.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/types/screen.types.d.ts +4 -5
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts +1 -11
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/blank-stack/navigators/create-blank-stack-navigator.tsx +37 -80
- package/src/blank-stack/types.ts +7 -4
- package/src/component-stack/navigators/create-component-stack-navigator.tsx +1 -1
- package/src/shared/components/create-boundary-component/components/boundary-target.tsx +45 -0
- package/src/shared/components/create-boundary-component/create-boundary-component.tsx +282 -0
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +2 -7
- package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +6 -10
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +3 -2
- package/src/shared/components/create-boundary-component/index.tsx +16 -252
- package/src/shared/components/create-boundary-component/providers/boundary-owner.provider.tsx +109 -0
- package/src/shared/components/create-transition-aware-component.tsx +33 -5
- package/src/shared/components/overlay/variations/float-overlay.tsx +1 -1
- package/src/shared/components/screen-container/hooks/use-backdrop-pointer-events.ts +1 -2
- package/src/shared/components/screen-container/index.tsx +12 -6
- package/src/shared/components/screen-container/layers/backdrop.tsx +13 -7
- package/src/shared/components/screen-container/layers/content.tsx +47 -43
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +6 -4
- package/src/shared/components/screen-container/layers/surface-container.tsx +4 -4
- package/src/shared/constants.ts +3 -0
- package/src/shared/index.ts +0 -1
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +49 -1
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +2 -0
- package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +2 -0
- package/src/shared/providers/screen/screen-composer.tsx +1 -1
- package/src/shared/providers/screen/styles/helpers/build-resolved-style-map.ts +185 -0
- package/src/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.ts +31 -0
- package/src/shared/providers/screen/styles/helpers/split-normalized-style-maps.ts +44 -0
- package/src/shared/providers/screen/styles/index.tsx +5 -0
- package/src/shared/providers/screen/styles/styles.provider.tsx +173 -0
- package/src/shared/types/animation.types.ts +18 -10
- package/src/shared/types/index.ts +0 -1
- package/src/shared/types/screen.types.ts +5 -5
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +2 -1
- package/src/shared/utils/bounds/helpers/style-composers.ts +11 -0
- package/src/shared/utils/bounds/zoom/build.ts +94 -59
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js +0 -43
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js.map +0 -1
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js +0 -234
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +0 -1
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js +0 -50
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +0 -1
- package/lib/commonjs/shared/providers/screen/styles.provider.js.map +0 -1
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js +0 -38
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js.map +0 -1
- package/lib/module/shared/hooks/animation/use-associated-style.js +0 -229
- package/lib/module/shared/hooks/animation/use-associated-style.js.map +0 -1
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js +0 -44
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +0 -1
- package/lib/module/shared/providers/screen/styles.provider.js.map +0 -1
- package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts +0 -13
- package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts.map +0 -1
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts +0 -32
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts +0 -14
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +0 -1
- package/src/shared/components/screen-container/deferred-visibility-host.tsx +0 -37
- package/src/shared/hooks/animation/use-associated-style.ts +0 -297
- package/src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts +0 -61
- package/src/shared/providers/screen/styles.provider.tsx +0 -164
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
children: React.ReactNode;
|
|
3
|
-
};
|
|
4
|
-
/**
|
|
5
|
-
* Hides the full screen visual subtree while an interpolator explicitly reports
|
|
6
|
-
* that it is not safe to reveal yet.
|
|
7
|
-
*
|
|
8
|
-
* This sits above backdrop/content/mask/surface so a deferred transition does
|
|
9
|
-
* not leak raw first-paint UI from nested layers.
|
|
10
|
-
*/
|
|
11
|
-
export declare const DeferredVisibilityHost: import("react").MemoExoticComponent<({ children }: Props) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=deferred-visibility-host.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deferred-visibility-host.d.ts","sourceRoot":"","sources":["../../../../../src/shared/components/screen-container/deferred-visibility-host.tsx"],"names":[],"mappings":"AAMA,KAAK,KAAK,GAAG;IACZ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,qDAAuB,KAAK,6CAa7D,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type StyleProps } from "react-native-reanimated";
|
|
2
|
-
type Props = {
|
|
3
|
-
id?: string;
|
|
4
|
-
style?: StyleProps;
|
|
5
|
-
resetTransformOnUnset?: boolean;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Resolves the animated style associated with an `id` (styleId/bound tag), while
|
|
9
|
-
* guarding against transient glitches during shared-boundary transitions.
|
|
10
|
-
*
|
|
11
|
-
* Why this exists:
|
|
12
|
-
* - During push/pop, links and style maps can be briefly out of sync.
|
|
13
|
-
* - Without guards, boundaries can briefly drop back to raw local layout.
|
|
14
|
-
* - Cleanup must be deterministic so stale transform keys do not linger.
|
|
15
|
-
*
|
|
16
|
-
* Local style model (worklet state machine):
|
|
17
|
-
*
|
|
18
|
-
* transient empty style map -> hold-last-style
|
|
19
|
-
* otherwise -> live
|
|
20
|
-
*
|
|
21
|
-
* - `hold-last-style`: reuse last resolved style through short empty-map gaps.
|
|
22
|
-
* - `live`: apply current resolved style directly.
|
|
23
|
-
*
|
|
24
|
-
* For grouped tags (`group:id`), previous-screen transition evidence is only
|
|
25
|
-
* considered for the group's active member to avoid hiding non-active siblings.
|
|
26
|
-
*/
|
|
27
|
-
export declare const useAssociatedStyles: ({ id, resetTransformOnUnset, }?: Props) => {
|
|
28
|
-
associatedStyles: Readonly<{}>;
|
|
29
|
-
associatedProps: object;
|
|
30
|
-
};
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=use-associated-style.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-associated-style.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/animation/use-associated-style.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EAIf,MAAM,yBAAyB,CAAC;AAOjC,KAAK,KAAK,GAAG;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA4GF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mBAAmB,GAAI,iCAGjC,KAAU;;;CAqJZ,CAAC"}
|
package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { DeferredScreenStyleSignal, NormalizedTransitionInterpolatedStyle } from "../../../types/animation.types";
|
|
2
|
-
export type ScreenStyleResolutionMode = "pass-through" | "deferred" | "live";
|
|
3
|
-
export type ResolvedInterpolatedStyleOutput = {
|
|
4
|
-
stylesMap: NormalizedTransitionInterpolatedStyle;
|
|
5
|
-
resolutionMode: ScreenStyleResolutionMode;
|
|
6
|
-
wasLegacy: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const PASS_THROUGH_STYLE_OUTPUT: ResolvedInterpolatedStyleOutput;
|
|
9
|
-
export declare const resolveEffectiveResolutionMode: ({ resolutionMode, isSettled, }: {
|
|
10
|
-
resolutionMode: ScreenStyleResolutionMode;
|
|
11
|
-
isSettled: boolean;
|
|
12
|
-
}) => ScreenStyleResolutionMode;
|
|
13
|
-
export declare const resolveInterpolatedStyleOutput: (raw: Record<string, any> | DeferredScreenStyleSignal | null | undefined) => ResolvedInterpolatedStyleOutput;
|
|
14
|
-
//# sourceMappingURL=resolve-interpolated-style-output.d.ts.map
|
package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-interpolated-style-output.d.ts","sourceRoot":"","sources":["../../../../../../src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,yBAAyB,EACzB,qCAAqC,EACrC,MAAM,gCAAgC,CAAC;AAGxC,MAAM,MAAM,yBAAyB,GAAG,cAAc,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7E,MAAM,MAAM,+BAA+B,GAAG;IAC7C,SAAS,EAAE,qCAAqC,CAAC;IACjD,cAAc,EAAE,yBAAyB,CAAC;IAC1C,SAAS,EAAE,OAAO,CAAC;CACnB,CAAC;AAIF,eAAO,MAAM,yBAAyB,EAAE,+BAIvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,gCAG5C;IACF,cAAc,EAAE,yBAAyB,CAAC;IAC1C,SAAS,EAAE,OAAO,CAAC;CACnB,KAAG,yBAMH,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAC1C,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,yBAAyB,GAAG,IAAI,GAAG,SAAS,KACrE,+BAsBF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.provider.d.ts","sourceRoot":"","sources":["../../../../../src/shared/providers/screen/styles.provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAC5D,OAAO,EACN,KAAK,WAAW,EAGhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,6BAA6B,CAAC;AAIzF,OAAO,EAIN,KAAK,yBAAyB,EAC9B,MAAM,6CAA6C,CAAC;AAErD,KAAK,KAAK,GAAG;IACZ,QAAQ,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC/B,SAAS,EAAE,WAAW,CAAC,qCAAqC,CAAC,CAAC;IAC9D,kBAAkB,EAAE,WAAW,CAAC,qCAAqC,CAAC,EAAE,CAAC;IACzE,cAAc,EAAE,WAAW,CAAC,yBAAyB,CAAC,CAAC;CACvD,CAAC;AAEF,eAAO,MACN,oBAAoB,6BACpB,mBAAmB,qDACK,eAAe,gCAoIvC,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { memo } from "react";
|
|
2
|
-
import { StyleSheet } from "react-native";
|
|
3
|
-
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
4
|
-
import { HIDDEN_STYLE, VISIBLE_STYLE } from "../../constants";
|
|
5
|
-
import { useScreenStyles } from "../../providers/screen/styles.provider";
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Hides the full screen visual subtree while an interpolator explicitly reports
|
|
13
|
-
* that it is not safe to reveal yet.
|
|
14
|
-
*
|
|
15
|
-
* This sits above backdrop/content/mask/surface so a deferred transition does
|
|
16
|
-
* not leak raw first-paint UI from nested layers.
|
|
17
|
-
*/
|
|
18
|
-
export const DeferredVisibilityHost = memo(({ children }: Props) => {
|
|
19
|
-
const { resolutionMode } = useScreenStyles();
|
|
20
|
-
|
|
21
|
-
const animatedStyle = useAnimatedStyle(() => {
|
|
22
|
-
"worklet";
|
|
23
|
-
return resolutionMode.value === "deferred" ? HIDDEN_STYLE : VISIBLE_STYLE;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<Animated.View collapsable={false} style={[styles.host, animatedStyle]}>
|
|
28
|
-
{children}
|
|
29
|
-
</Animated.View>
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const styles = StyleSheet.create({
|
|
34
|
-
host: {
|
|
35
|
-
flex: 1,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type StyleProps,
|
|
3
|
-
useAnimatedProps,
|
|
4
|
-
useAnimatedStyle,
|
|
5
|
-
useSharedValue,
|
|
6
|
-
} from "react-native-reanimated";
|
|
7
|
-
import { NO_PROPS, NO_STYLES } from "../../constants";
|
|
8
|
-
import { useDescriptorDerivations } from "../../providers/screen/descriptors";
|
|
9
|
-
import { useScreenStyles } from "../../providers/screen/styles.provider";
|
|
10
|
-
import { AnimationStore } from "../../stores/animation.store";
|
|
11
|
-
import { BoundStore } from "../../stores/bounds";
|
|
12
|
-
|
|
13
|
-
type Props = {
|
|
14
|
-
id?: string;
|
|
15
|
-
style?: StyleProps;
|
|
16
|
-
resetTransformOnUnset?: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const TRANSIENT_EMPTY_GRACE_FRAMES = 2;
|
|
20
|
-
const IDENTITY_TRANSFORM = [
|
|
21
|
-
{ translateX: 0 },
|
|
22
|
-
{ translateY: 0 },
|
|
23
|
-
{ scaleX: 1 },
|
|
24
|
-
{ scaleY: 1 },
|
|
25
|
-
] as any;
|
|
26
|
-
const ALWAYS_RESET_STYLE_VALUES = {
|
|
27
|
-
zIndex: 0,
|
|
28
|
-
elevation: 0,
|
|
29
|
-
} as const;
|
|
30
|
-
|
|
31
|
-
type AssociatedStyleMode = "hold-last-style" | "live";
|
|
32
|
-
|
|
33
|
-
type GroupTagParts = {
|
|
34
|
-
group: string;
|
|
35
|
-
memberId: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
type KeyMeta = {
|
|
39
|
-
keys: Record<string, true>;
|
|
40
|
-
hasAny: boolean;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const hasAnyKeys = (record: Record<string, unknown>) => {
|
|
44
|
-
"worklet";
|
|
45
|
-
for (const _key in record) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const collectKeyMeta = (record: Record<string, unknown>): KeyMeta => {
|
|
52
|
-
"worklet";
|
|
53
|
-
const keys: Record<string, true> = {};
|
|
54
|
-
let hasAny = false;
|
|
55
|
-
for (const key in record) {
|
|
56
|
-
keys[key] = true;
|
|
57
|
-
hasAny = true;
|
|
58
|
-
}
|
|
59
|
-
return { keys, hasAny };
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const getGroupTagParts = (tag: string): GroupTagParts | null => {
|
|
63
|
-
"worklet";
|
|
64
|
-
const separatorIndex = tag.indexOf(":");
|
|
65
|
-
if (separatorIndex <= 0 || separatorIndex >= tag.length - 1) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
group: tag.slice(0, separatorIndex),
|
|
71
|
-
memberId: tag.slice(separatorIndex + 1),
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const allowPreviousTransitionEvidence = (tag: string): boolean => {
|
|
76
|
-
"worklet";
|
|
77
|
-
const groupTagParts = getGroupTagParts(tag);
|
|
78
|
-
if (!groupTagParts) {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// For grouped boundaries, only the active member can inherit
|
|
83
|
-
// transition evidence from the previous screen.
|
|
84
|
-
const activeGroupMemberId = BoundStore.getGroupActiveId(groupTagParts.group);
|
|
85
|
-
return (
|
|
86
|
-
activeGroupMemberId !== null &&
|
|
87
|
-
activeGroupMemberId === groupTagParts.memberId
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const buildUnsetPatch = ({
|
|
92
|
-
previousKeys,
|
|
93
|
-
currentKeys,
|
|
94
|
-
shouldDeferUnset,
|
|
95
|
-
resetTransformOnUnset,
|
|
96
|
-
}: {
|
|
97
|
-
previousKeys: Record<string, true>;
|
|
98
|
-
currentKeys: Record<string, true>;
|
|
99
|
-
shouldDeferUnset: boolean;
|
|
100
|
-
resetTransformOnUnset: boolean;
|
|
101
|
-
}) => {
|
|
102
|
-
"worklet";
|
|
103
|
-
const unsetPatch: Record<string, any> = {};
|
|
104
|
-
|
|
105
|
-
for (const key in previousKeys) {
|
|
106
|
-
if (currentKeys[key]) continue;
|
|
107
|
-
const shouldAlwaysUnset = key in ALWAYS_RESET_STYLE_VALUES;
|
|
108
|
-
if (shouldDeferUnset && !shouldAlwaysUnset) continue;
|
|
109
|
-
|
|
110
|
-
if (key === "transform" && resetTransformOnUnset) {
|
|
111
|
-
unsetPatch.transform = IDENTITY_TRANSFORM;
|
|
112
|
-
} else if (key in ALWAYS_RESET_STYLE_VALUES) {
|
|
113
|
-
unsetPatch[key] =
|
|
114
|
-
ALWAYS_RESET_STYLE_VALUES[
|
|
115
|
-
key as keyof typeof ALWAYS_RESET_STYLE_VALUES
|
|
116
|
-
];
|
|
117
|
-
} else {
|
|
118
|
-
unsetPatch[key] = undefined;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return unsetPatch;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Resolves the animated style associated with an `id` (styleId/bound tag), while
|
|
127
|
-
* guarding against transient glitches during shared-boundary transitions.
|
|
128
|
-
*
|
|
129
|
-
* Why this exists:
|
|
130
|
-
* - During push/pop, links and style maps can be briefly out of sync.
|
|
131
|
-
* - Without guards, boundaries can briefly drop back to raw local layout.
|
|
132
|
-
* - Cleanup must be deterministic so stale transform keys do not linger.
|
|
133
|
-
*
|
|
134
|
-
* Local style model (worklet state machine):
|
|
135
|
-
*
|
|
136
|
-
* transient empty style map -> hold-last-style
|
|
137
|
-
* otherwise -> live
|
|
138
|
-
*
|
|
139
|
-
* - `hold-last-style`: reuse last resolved style through short empty-map gaps.
|
|
140
|
-
* - `live`: apply current resolved style directly.
|
|
141
|
-
*
|
|
142
|
-
* For grouped tags (`group:id`), previous-screen transition evidence is only
|
|
143
|
-
* considered for the group's active member to avoid hiding non-active siblings.
|
|
144
|
-
*/
|
|
145
|
-
export const useAssociatedStyles = ({
|
|
146
|
-
id,
|
|
147
|
-
resetTransformOnUnset = false,
|
|
148
|
-
}: Props = {}) => {
|
|
149
|
-
const { stylesMap, ancestorStylesMaps } = useScreenStyles();
|
|
150
|
-
const { previousScreenKey, currentScreenKey, hasConfiguredInterpolator } =
|
|
151
|
-
useDescriptorDerivations();
|
|
152
|
-
const isAnimating = AnimationStore.getValue(currentScreenKey, "animating");
|
|
153
|
-
const isClosing = AnimationStore.getValue(currentScreenKey, "closing");
|
|
154
|
-
const previousAppliedKeys = useSharedValue<Record<string, true>>({});
|
|
155
|
-
const emptyGraceFrameCount = useSharedValue(0);
|
|
156
|
-
const lastResolvedBase = useSharedValue<Record<string, any> | null>(null);
|
|
157
|
-
|
|
158
|
-
const associatedStyles = useAnimatedStyle(() => {
|
|
159
|
-
"worklet";
|
|
160
|
-
|
|
161
|
-
if (!id) {
|
|
162
|
-
return NO_STYLES;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Check local slot first, then fall back to parent
|
|
166
|
-
const ownSlot = stylesMap.value[id];
|
|
167
|
-
|
|
168
|
-
const ancestorSlot = ancestorStylesMaps.find(
|
|
169
|
-
(ancestorMap) => ancestorMap.value[id],
|
|
170
|
-
)?.value[id];
|
|
171
|
-
|
|
172
|
-
const slot = ownSlot || ancestorSlot;
|
|
173
|
-
const base = slot?.style || NO_STYLES;
|
|
174
|
-
|
|
175
|
-
const { keys: currentKeys, hasAny: hasCurrentKeys } = collectKeyMeta(
|
|
176
|
-
base as Record<string, unknown>,
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
const hasPreviousKeys = hasAnyKeys(previousAppliedKeys.value);
|
|
180
|
-
const isTransitioning = isAnimating.get() !== 0 || isClosing.get() !== 0;
|
|
181
|
-
|
|
182
|
-
const canUsePreviousTransitionEvidence =
|
|
183
|
-
resetTransformOnUnset && allowPreviousTransitionEvidence(id);
|
|
184
|
-
|
|
185
|
-
const hasActiveLink =
|
|
186
|
-
resetTransformOnUnset &&
|
|
187
|
-
canUsePreviousTransitionEvidence &&
|
|
188
|
-
(BoundStore.hasPendingLink(id) ||
|
|
189
|
-
BoundStore.hasSourceLink(id, currentScreenKey) ||
|
|
190
|
-
BoundStore.hasDestinationLink(id, currentScreenKey));
|
|
191
|
-
|
|
192
|
-
const hasPreviousTransitionEvidence =
|
|
193
|
-
canUsePreviousTransitionEvidence &&
|
|
194
|
-
!!previousScreenKey &&
|
|
195
|
-
(!!BoundStore.getSnapshot(id, previousScreenKey) ||
|
|
196
|
-
BoundStore.hasBoundaryPresence(id, previousScreenKey));
|
|
197
|
-
|
|
198
|
-
const shouldProtectInFlightStyles =
|
|
199
|
-
resetTransformOnUnset && (hasActiveLink || hasPreviousTransitionEvidence);
|
|
200
|
-
|
|
201
|
-
if (hasCurrentKeys) {
|
|
202
|
-
lastResolvedBase.value = base as Record<string, any>;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const hasPersistedResolvedStyle = !!lastResolvedBase.value;
|
|
206
|
-
|
|
207
|
-
const isTransientEmptyGap =
|
|
208
|
-
hasConfiguredInterpolator &&
|
|
209
|
-
shouldProtectInFlightStyles &&
|
|
210
|
-
!isTransitioning &&
|
|
211
|
-
!hasCurrentKeys &&
|
|
212
|
-
(hasPreviousKeys || hasPersistedResolvedStyle);
|
|
213
|
-
|
|
214
|
-
// Keep styles stable for a couple of frames to absorb
|
|
215
|
-
// transient empty-map gaps on slower devices.
|
|
216
|
-
if (isTransientEmptyGap) {
|
|
217
|
-
emptyGraceFrameCount.value = emptyGraceFrameCount.value + 1;
|
|
218
|
-
} else {
|
|
219
|
-
emptyGraceFrameCount.value = 0;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const isWithinGapGrace =
|
|
223
|
-
isTransientEmptyGap &&
|
|
224
|
-
emptyGraceFrameCount.value <= TRANSIENT_EMPTY_GRACE_FRAMES;
|
|
225
|
-
|
|
226
|
-
const shouldDelayUnset =
|
|
227
|
-
resetTransformOnUnset &&
|
|
228
|
-
shouldProtectInFlightStyles &&
|
|
229
|
-
(isTransitioning || isWithinGapGrace);
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Associated-style state machine:
|
|
233
|
-
* - hold-last-style: transient empty frame; reuse last resolved style.
|
|
234
|
-
* - live: apply current resolved style normally.
|
|
235
|
-
*/
|
|
236
|
-
let mode: AssociatedStyleMode = "live";
|
|
237
|
-
if (shouldDelayUnset && !hasCurrentKeys && hasPersistedResolvedStyle) {
|
|
238
|
-
mode = "hold-last-style";
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const resolvedBase =
|
|
242
|
-
mode === "hold-last-style"
|
|
243
|
-
? (lastResolvedBase.value as Record<string, any>)
|
|
244
|
-
: (base as Record<string, any>);
|
|
245
|
-
|
|
246
|
-
const unsetPatch = buildUnsetPatch({
|
|
247
|
-
previousKeys: previousAppliedKeys.value,
|
|
248
|
-
currentKeys,
|
|
249
|
-
shouldDeferUnset: shouldDelayUnset,
|
|
250
|
-
resetTransformOnUnset,
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
if (shouldDelayUnset) {
|
|
254
|
-
previousAppliedKeys.value = {
|
|
255
|
-
...previousAppliedKeys.value,
|
|
256
|
-
...currentKeys,
|
|
257
|
-
};
|
|
258
|
-
} else {
|
|
259
|
-
previousAppliedKeys.value = currentKeys;
|
|
260
|
-
|
|
261
|
-
// Drop cached style when fully idle so future transitions
|
|
262
|
-
// start from a clean state.
|
|
263
|
-
if (!hasCurrentKeys && !shouldProtectInFlightStyles && !isTransitioning) {
|
|
264
|
-
lastResolvedBase.value = null;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const mergedBase = { ...unsetPatch, ...resolvedBase };
|
|
269
|
-
|
|
270
|
-
let opacity = 1;
|
|
271
|
-
|
|
272
|
-
if ("opacity" in mergedBase) {
|
|
273
|
-
opacity = mergedBase.opacity as number;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if ("opacity" in mergedBase) {
|
|
277
|
-
return mergedBase;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return { ...mergedBase, opacity };
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
const associatedProps = useAnimatedProps(() => {
|
|
284
|
-
"worklet";
|
|
285
|
-
|
|
286
|
-
if (!id) return NO_PROPS;
|
|
287
|
-
|
|
288
|
-
const ownSlot = stylesMap.value[id];
|
|
289
|
-
const ancestorSlot = ancestorStylesMaps.find(
|
|
290
|
-
(ancestorMap) => ancestorMap.value[id],
|
|
291
|
-
)?.value[id];
|
|
292
|
-
|
|
293
|
-
return (ownSlot || ancestorSlot)?.props ?? NO_PROPS;
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
return { associatedStyles, associatedProps };
|
|
297
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DeferredScreenStyleSignal,
|
|
3
|
-
NormalizedTransitionInterpolatedStyle,
|
|
4
|
-
} from "../../../types/animation.types";
|
|
5
|
-
import { normalizeInterpolatedStyle } from "../../../utils/normalize-interpolated-style";
|
|
6
|
-
|
|
7
|
-
export type ScreenStyleResolutionMode = "pass-through" | "deferred" | "live";
|
|
8
|
-
|
|
9
|
-
export type ResolvedInterpolatedStyleOutput = {
|
|
10
|
-
stylesMap: NormalizedTransitionInterpolatedStyle;
|
|
11
|
-
resolutionMode: ScreenStyleResolutionMode;
|
|
12
|
-
wasLegacy: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const EMPTY_STYLES = {} as NormalizedTransitionInterpolatedStyle;
|
|
16
|
-
|
|
17
|
-
export const PASS_THROUGH_STYLE_OUTPUT: ResolvedInterpolatedStyleOutput = {
|
|
18
|
-
stylesMap: EMPTY_STYLES,
|
|
19
|
-
resolutionMode: "pass-through",
|
|
20
|
-
wasLegacy: false,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const resolveEffectiveResolutionMode = ({
|
|
24
|
-
resolutionMode,
|
|
25
|
-
isSettled,
|
|
26
|
-
}: {
|
|
27
|
-
resolutionMode: ScreenStyleResolutionMode;
|
|
28
|
-
isSettled: boolean;
|
|
29
|
-
}): ScreenStyleResolutionMode => {
|
|
30
|
-
"worklet";
|
|
31
|
-
if (resolutionMode === "deferred" && isSettled) {
|
|
32
|
-
return "pass-through";
|
|
33
|
-
}
|
|
34
|
-
return resolutionMode;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const resolveInterpolatedStyleOutput = (
|
|
38
|
-
raw: Record<string, any> | DeferredScreenStyleSignal | null | undefined,
|
|
39
|
-
): ResolvedInterpolatedStyleOutput => {
|
|
40
|
-
"worklet";
|
|
41
|
-
|
|
42
|
-
if (raw === "defer") {
|
|
43
|
-
return {
|
|
44
|
-
stylesMap: EMPTY_STYLES,
|
|
45
|
-
resolutionMode: "deferred",
|
|
46
|
-
wasLegacy: false,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (raw == null) {
|
|
51
|
-
return PASS_THROUGH_STYLE_OUTPUT;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const { result, wasLegacy } = normalizeInterpolatedStyle(raw ?? EMPTY_STYLES);
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
stylesMap: result,
|
|
58
|
-
resolutionMode: "live",
|
|
59
|
-
wasLegacy,
|
|
60
|
-
};
|
|
61
|
-
};
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { type ReactNode, useContext, useMemo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
type SharedValue,
|
|
4
|
-
useDerivedValue,
|
|
5
|
-
useSharedValue,
|
|
6
|
-
} from "react-native-reanimated";
|
|
7
|
-
import { NO_STYLES } from "../../constants";
|
|
8
|
-
import type { NormalizedTransitionInterpolatedStyle } from "../../types/animation.types";
|
|
9
|
-
import createProvider from "../../utils/create-provider";
|
|
10
|
-
import { logger } from "../../utils/logger";
|
|
11
|
-
import { useScreenAnimationContext } from "./animation";
|
|
12
|
-
import {
|
|
13
|
-
PASS_THROUGH_STYLE_OUTPUT,
|
|
14
|
-
resolveEffectiveResolutionMode,
|
|
15
|
-
resolveInterpolatedStyleOutput,
|
|
16
|
-
type ScreenStyleResolutionMode,
|
|
17
|
-
} from "./helpers/resolve-interpolated-style-output";
|
|
18
|
-
|
|
19
|
-
type Props = {
|
|
20
|
-
children: ReactNode;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
type ScreenStylesContextValue = {
|
|
24
|
-
stylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
|
|
25
|
-
ancestorStylesMaps: SharedValue<NormalizedTransitionInterpolatedStyle>[];
|
|
26
|
-
resolutionMode: SharedValue<ScreenStyleResolutionMode>;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const {
|
|
30
|
-
ScreenStylesProvider,
|
|
31
|
-
ScreenStylesContext,
|
|
32
|
-
useScreenStylesContext: useScreenStyles,
|
|
33
|
-
} = createProvider("ScreenStyles", {
|
|
34
|
-
guarded: true,
|
|
35
|
-
})<Props, ScreenStylesContextValue>(
|
|
36
|
-
({ children }): { value: ScreenStylesContextValue; children: ReactNode } => {
|
|
37
|
-
const parentCtx = useContext(ScreenStylesContext);
|
|
38
|
-
|
|
39
|
-
const {
|
|
40
|
-
screenInterpolatorProps,
|
|
41
|
-
nextInterpolator,
|
|
42
|
-
currentInterpolator,
|
|
43
|
-
boundsAccessor,
|
|
44
|
-
} = useScreenAnimationContext();
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Tracks when user starts a gesture while another screen is still closing.
|
|
48
|
-
* This persists until both the gesture ends AND the closing animation completes.
|
|
49
|
-
*/
|
|
50
|
-
const isGesturingDuringCloseAnimation = useSharedValue(false);
|
|
51
|
-
const hasWarnedLegacy = useSharedValue(false);
|
|
52
|
-
|
|
53
|
-
const styleResolution = useDerivedValue<{
|
|
54
|
-
stylesMap: NormalizedTransitionInterpolatedStyle;
|
|
55
|
-
resolutionMode: ScreenStyleResolutionMode;
|
|
56
|
-
}>(() => {
|
|
57
|
-
"worklet";
|
|
58
|
-
const props = screenInterpolatorProps.value;
|
|
59
|
-
const { current, next, progress } = props;
|
|
60
|
-
const isDragging = current.gesture.dragging;
|
|
61
|
-
const isNextClosing = !!next?.closing;
|
|
62
|
-
|
|
63
|
-
if (isDragging && isNextClosing) {
|
|
64
|
-
isGesturingDuringCloseAnimation.value = true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!isDragging && !isNextClosing) {
|
|
68
|
-
isGesturingDuringCloseAnimation.value = false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const isInGestureMode =
|
|
72
|
-
isDragging || isGesturingDuringCloseAnimation.value;
|
|
73
|
-
|
|
74
|
-
// Select interpolator
|
|
75
|
-
// - If in gesture mode, use current screen's interpolator since we're driving
|
|
76
|
-
// the animation from this screen (dragging back to dismiss next).
|
|
77
|
-
const interpolator = isInGestureMode
|
|
78
|
-
? currentInterpolator
|
|
79
|
-
: (nextInterpolator ?? currentInterpolator);
|
|
80
|
-
|
|
81
|
-
if (!interpolator) {
|
|
82
|
-
return PASS_THROUGH_STYLE_OUTPUT;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Build effective props with corrected progress
|
|
86
|
-
// - Gesture mode: use current.progress only (avoids jumps during drag)
|
|
87
|
-
// - Normal: use derived progress as-is
|
|
88
|
-
|
|
89
|
-
let effectiveProgress = progress;
|
|
90
|
-
let effectiveNext = next;
|
|
91
|
-
|
|
92
|
-
if (isInGestureMode) {
|
|
93
|
-
effectiveProgress = current.progress;
|
|
94
|
-
effectiveNext = undefined;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
try {
|
|
98
|
-
const raw = interpolator({
|
|
99
|
-
...props,
|
|
100
|
-
progress: effectiveProgress,
|
|
101
|
-
next: effectiveNext,
|
|
102
|
-
bounds: boundsAccessor,
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
const { stylesMap, resolutionMode, wasLegacy } =
|
|
106
|
-
resolveInterpolatedStyleOutput(raw);
|
|
107
|
-
|
|
108
|
-
if (__DEV__ && wasLegacy && !hasWarnedLegacy.value) {
|
|
109
|
-
hasWarnedLegacy.value = true;
|
|
110
|
-
logger.warn(
|
|
111
|
-
"Flat interpolator return shape (contentStyle/backdropStyle) is deprecated. " +
|
|
112
|
-
"Use the nested format instead: { content: { style }, backdrop: { style } }.",
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
stylesMap,
|
|
118
|
-
resolutionMode: resolveEffectiveResolutionMode({
|
|
119
|
-
resolutionMode,
|
|
120
|
-
isSettled: current.settled === 1,
|
|
121
|
-
}),
|
|
122
|
-
};
|
|
123
|
-
} catch (err) {
|
|
124
|
-
if (__DEV__) {
|
|
125
|
-
console.warn(
|
|
126
|
-
"[react-native-screen-transitions] screenStyleInterpolator must be a worklet",
|
|
127
|
-
err,
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
stylesMap: NO_STYLES as NormalizedTransitionInterpolatedStyle,
|
|
132
|
-
resolutionMode: "live" as const,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
const stylesMap = useDerivedValue<NormalizedTransitionInterpolatedStyle>(
|
|
138
|
-
() => {
|
|
139
|
-
"worklet";
|
|
140
|
-
return styleResolution.value.stylesMap;
|
|
141
|
-
},
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
const resolutionMode = useDerivedValue<ScreenStyleResolutionMode>(() => {
|
|
145
|
-
"worklet";
|
|
146
|
-
return styleResolution.value.resolutionMode;
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
const value = useMemo<ScreenStylesContextValue>(() => {
|
|
150
|
-
// Build ancestor chain: [parent, grandparent, great-grandparent, ...]
|
|
151
|
-
const ancestorStylesMaps = parentCtx
|
|
152
|
-
? [parentCtx.stylesMap, ...parentCtx.ancestorStylesMaps]
|
|
153
|
-
: [];
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
stylesMap,
|
|
157
|
-
ancestorStylesMaps,
|
|
158
|
-
resolutionMode,
|
|
159
|
-
};
|
|
160
|
-
}, [resolutionMode, stylesMap, parentCtx]);
|
|
161
|
-
|
|
162
|
-
return { value, children };
|
|
163
|
-
},
|
|
164
|
-
);
|