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
package/package.json
CHANGED
|
@@ -23,7 +23,10 @@ import type {
|
|
|
23
23
|
BlankStackNavigatorProps,
|
|
24
24
|
} from "../types";
|
|
25
25
|
|
|
26
|
-
type BlankStackNavigatorInnerProps =
|
|
26
|
+
type BlankStackNavigatorInnerProps = Omit<
|
|
27
|
+
BlankStackNavigatorProps,
|
|
28
|
+
keyof BlankStackFactoryOptions
|
|
29
|
+
> & {
|
|
27
30
|
DISABLE_NATIVE_SCREENS?: boolean;
|
|
28
31
|
DISABLE_NATIVE_SCREEN_CONTAINER?: boolean;
|
|
29
32
|
};
|
|
@@ -77,49 +80,39 @@ function BlankStackNavigatorInner({
|
|
|
77
80
|
);
|
|
78
81
|
}
|
|
79
82
|
|
|
80
|
-
function
|
|
81
|
-
independent,
|
|
82
|
-
enableNativeScreens,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (!independent || isNested) {
|
|
98
|
-
return navigator;
|
|
99
|
-
}
|
|
83
|
+
function BlankStackNavigator({
|
|
84
|
+
independent = false,
|
|
85
|
+
enableNativeScreens = true,
|
|
86
|
+
...rest
|
|
87
|
+
}: BlankStackNavigatorProps) {
|
|
88
|
+
const isNested = React.useContext(BlankStackContext);
|
|
89
|
+
|
|
90
|
+
const navigator = (
|
|
91
|
+
<BlankStackNavigatorInner
|
|
92
|
+
{...rest}
|
|
93
|
+
{...(!enableNativeScreens && {
|
|
94
|
+
DISABLE_NATIVE_SCREENS: true,
|
|
95
|
+
})}
|
|
96
|
+
DISABLE_NATIVE_SCREEN_CONTAINER={independent}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<NavigationContainer>
|
|
104
|
-
<BlankStackContext.Provider value={true}>
|
|
105
|
-
{navigator}
|
|
106
|
-
</BlankStackContext.Provider>
|
|
107
|
-
</NavigationContainer>
|
|
108
|
-
</NavigationIndependentTree>
|
|
109
|
-
);
|
|
100
|
+
if (!independent || isNested) {
|
|
101
|
+
return navigator;
|
|
110
102
|
}
|
|
111
103
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
104
|
+
return (
|
|
105
|
+
<NavigationIndependentTree>
|
|
106
|
+
<NavigationContainer>
|
|
107
|
+
<BlankStackContext.Provider value={true}>
|
|
108
|
+
{navigator}
|
|
109
|
+
</BlankStackContext.Provider>
|
|
110
|
+
</NavigationContainer>
|
|
111
|
+
</NavigationIndependentTree>
|
|
112
|
+
);
|
|
117
113
|
}
|
|
118
114
|
|
|
119
|
-
|
|
120
|
-
independent: false,
|
|
121
|
-
enableNativeScreens: true,
|
|
122
|
-
});
|
|
115
|
+
BlankStackNavigator.displayName = "BlankStackNavigator";
|
|
123
116
|
|
|
124
117
|
type BlankStackTypeBag<
|
|
125
118
|
ParamList extends ParamListBase,
|
|
@@ -147,14 +140,13 @@ type BlankStackTypeBag<
|
|
|
147
140
|
* it participates in the current navigation tree and uses native screen
|
|
148
141
|
* primitives on supported native platforms.
|
|
149
142
|
*
|
|
150
|
-
*
|
|
143
|
+
* Blank stack also accepts navigator-specific props for embedded-flow behavior:
|
|
151
144
|
* - `independent: true` creates an isolated navigator for nested flows
|
|
152
145
|
* - `enableNativeScreens: false` renders the stack with regular views instead
|
|
153
146
|
* of `react-native-screens`
|
|
154
147
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* itself is hosted.
|
|
148
|
+
* In the dynamic API, pass these to `<Stack.Navigator />`.
|
|
149
|
+
* In the static API, pass them in the same config object as `screens`.
|
|
158
150
|
*/
|
|
159
151
|
export function createBlankStackNavigator<
|
|
160
152
|
const ParamList extends ParamListBase,
|
|
@@ -163,42 +155,7 @@ export function createBlankStackNavigator<
|
|
|
163
155
|
ParamList,
|
|
164
156
|
NavigatorID
|
|
165
157
|
>,
|
|
166
|
-
|
|
167
|
-
export function createBlankStackNavigator<
|
|
168
|
-
const ParamList extends ParamListBase,
|
|
169
|
-
const NavigatorID extends string | undefined = undefined,
|
|
170
|
-
const TypeBag extends NavigatorTypeBagBase = BlankStackTypeBag<
|
|
171
|
-
ParamList,
|
|
172
|
-
NavigatorID
|
|
173
|
-
>,
|
|
174
|
-
>(
|
|
175
|
-
/**
|
|
176
|
-
* Factory-level hosting options for the blank stack.
|
|
177
|
-
*/
|
|
178
|
-
options: BlankStackFactoryOptions,
|
|
179
|
-
): TypedNavigator<TypeBag, StaticConfig<TypeBag>>;
|
|
180
|
-
export function createBlankStackNavigator<
|
|
181
|
-
const ParamList extends ParamListBase,
|
|
182
|
-
const NavigatorID extends string | undefined = undefined,
|
|
183
|
-
const TypeBag extends NavigatorTypeBagBase = BlankStackTypeBag<
|
|
184
|
-
ParamList,
|
|
185
|
-
NavigatorID
|
|
186
|
-
>,
|
|
187
|
-
const Config extends StaticConfig<TypeBag> &
|
|
188
|
-
BlankStackFactoryOptions = StaticConfig<TypeBag> & BlankStackFactoryOptions,
|
|
158
|
+
const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,
|
|
189
159
|
>(config?: Config): TypedNavigator<TypeBag, Config> {
|
|
190
|
-
|
|
191
|
-
independent = false,
|
|
192
|
-
enableNativeScreens = true,
|
|
193
|
-
...staticConfig
|
|
194
|
-
} = (config ?? {}) as StaticConfig<TypeBag> & BlankStackFactoryOptions;
|
|
195
|
-
|
|
196
|
-
const Navigator = createBlankStackNavigatorComponent({
|
|
197
|
-
independent,
|
|
198
|
-
enableNativeScreens,
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
return createNavigatorFactory(Navigator)(
|
|
202
|
-
(config ? (staticConfig as StaticConfig<TypeBag>) : undefined) as Config,
|
|
203
|
-
);
|
|
160
|
+
return createNavigatorFactory(BlankStackNavigator)(config);
|
|
204
161
|
}
|
package/src/blank-stack/types.ts
CHANGED
|
@@ -52,10 +52,12 @@ export type BlankStackNavigationHelpers = NavigationHelpers<
|
|
|
52
52
|
>;
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Additional props accepted by the blank stack navigator.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
57
|
+
* These can be passed to `<BlankStack.Navigator />` in the dynamic API, and
|
|
58
|
+
* they are also supported as top-level keys in static navigator config.
|
|
59
|
+
*
|
|
60
|
+
* The exported name is kept for backward compatibility.
|
|
59
61
|
*/
|
|
60
62
|
export interface BlankStackFactoryOptions {
|
|
61
63
|
/**
|
|
@@ -120,7 +122,8 @@ export type BlankStackNavigatorProps = DefaultNavigatorOptions<
|
|
|
120
122
|
BlankStackNavigationEventMap,
|
|
121
123
|
BlankStackNavigationProp<ParamListBase>
|
|
122
124
|
> &
|
|
123
|
-
StackRouterOptions
|
|
125
|
+
StackRouterOptions &
|
|
126
|
+
BlankStackFactoryOptions;
|
|
124
127
|
|
|
125
128
|
export type BlankStackDescriptor = Descriptor<
|
|
126
129
|
BlankStackNavigationOptions,
|
|
@@ -98,7 +98,7 @@ function IsolatedComponentStackNavigator(props: ComponentStackNavigatorProps) {
|
|
|
98
98
|
/**
|
|
99
99
|
* @deprecated Component stack was originally introduced for independent,
|
|
100
100
|
* embedded navigation flows. Blank stack now supports that use case directly
|
|
101
|
-
* via
|
|
101
|
+
* via navigator props such as `<BlankStack.Navigator independent />`, with
|
|
102
102
|
* `enableNativeScreens` available when you need to switch between native
|
|
103
103
|
* screens and regular views. Prefer blank stack for new work; component stack
|
|
104
104
|
* will be removed in a future release.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { memo, useLayoutEffect } from "react";
|
|
3
|
+
import type { View } from "react-native";
|
|
4
|
+
import Animated, { useAnimatedRef } from "react-native-reanimated";
|
|
5
|
+
import {
|
|
6
|
+
TARGET_OUTSIDE_OWNER_WARNING,
|
|
7
|
+
useBoundaryOwnerContext,
|
|
8
|
+
} from "../providers/boundary-owner.provider";
|
|
9
|
+
|
|
10
|
+
type BoundaryTargetProps = React.ComponentProps<typeof Animated.View>;
|
|
11
|
+
|
|
12
|
+
export const BoundaryTarget = memo(function BoundaryTarget(
|
|
13
|
+
props: BoundaryTargetProps,
|
|
14
|
+
) {
|
|
15
|
+
const { style, ...rest } = props;
|
|
16
|
+
const targetAnimatedRef = useAnimatedRef<View>();
|
|
17
|
+
const ownerContext = useBoundaryOwnerContext();
|
|
18
|
+
const isActiveTarget = ownerContext?.activeTargetRef === targetAnimatedRef;
|
|
19
|
+
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
if (!ownerContext) {
|
|
22
|
+
if (__DEV__) {
|
|
23
|
+
console.warn(TARGET_OUTSIDE_OWNER_WARNING);
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ownerContext.registerTargetRef(targetAnimatedRef);
|
|
29
|
+
return () => {
|
|
30
|
+
ownerContext.unregisterTargetRef(targetAnimatedRef);
|
|
31
|
+
};
|
|
32
|
+
}, [ownerContext, targetAnimatedRef]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Animated.View
|
|
36
|
+
{...rest}
|
|
37
|
+
ref={targetAnimatedRef}
|
|
38
|
+
style={[
|
|
39
|
+
style,
|
|
40
|
+
isActiveTarget ? ownerContext.associatedTargetStyles : undefined,
|
|
41
|
+
]}
|
|
42
|
+
collapsable={false}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
});
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ComponentType,
|
|
3
|
+
forwardRef,
|
|
4
|
+
memo,
|
|
5
|
+
useCallback,
|
|
6
|
+
useMemo,
|
|
7
|
+
} from "react";
|
|
8
|
+
import type { View } from "react-native";
|
|
9
|
+
import Animated, {
|
|
10
|
+
runOnUI,
|
|
11
|
+
useAnimatedRef,
|
|
12
|
+
useAnimatedStyle,
|
|
13
|
+
} from "react-native-reanimated";
|
|
14
|
+
import { NO_STYLES } from "../../constants";
|
|
15
|
+
import { useDescriptorDerivations } from "../../providers/screen/descriptors";
|
|
16
|
+
import { useScreenStyles } from "../../providers/screen/styles";
|
|
17
|
+
import { AnimationStore } from "../../stores/animation.store";
|
|
18
|
+
import { BoundStore } from "../../stores/bounds";
|
|
19
|
+
import { prepareStyleForBounds } from "../../utils/bounds/helpers/styles";
|
|
20
|
+
import { useAutoSourceMeasurement } from "./hooks/use-auto-source-measurement";
|
|
21
|
+
import { useBoundaryMeasureAndStore } from "./hooks/use-boundary-measure-and-store";
|
|
22
|
+
import { useBoundaryPresence } from "./hooks/use-boundary-presence";
|
|
23
|
+
import { useGroupActiveMeasurement } from "./hooks/use-group-active-measurement";
|
|
24
|
+
import { useGroupActiveSourceMeasurement } from "./hooks/use-group-active-source-measurement";
|
|
25
|
+
import { useInitialLayoutHandler } from "./hooks/use-initial-layout-handler";
|
|
26
|
+
import { usePendingDestinationMeasurement } from "./hooks/use-pending-destination-measurement";
|
|
27
|
+
import { usePendingDestinationRetryMeasurement } from "./hooks/use-pending-destination-retry-measurement";
|
|
28
|
+
import { useScrollSettledMeasurement } from "./hooks/use-scroll-settled-measurement";
|
|
29
|
+
import {
|
|
30
|
+
BoundaryOwnerProvider,
|
|
31
|
+
useBoundaryOwner,
|
|
32
|
+
} from "./providers/boundary-owner.provider";
|
|
33
|
+
import type { BoundaryComponentProps, BoundaryConfigProps } from "./types";
|
|
34
|
+
import { buildBoundaryMatchKey } from "./utils/build-boundary-match-key";
|
|
35
|
+
|
|
36
|
+
interface CreateBoundaryComponentOptions {
|
|
37
|
+
alreadyAnimated?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function createBoundaryComponent<P extends object>(
|
|
41
|
+
Wrapped: ComponentType<P>,
|
|
42
|
+
options: CreateBoundaryComponentOptions = {},
|
|
43
|
+
) {
|
|
44
|
+
const { alreadyAnimated = false } = options;
|
|
45
|
+
const AnimatedComponent = alreadyAnimated
|
|
46
|
+
? Wrapped
|
|
47
|
+
: Animated.createAnimatedComponent(Wrapped);
|
|
48
|
+
|
|
49
|
+
const Inner = forwardRef<
|
|
50
|
+
React.ComponentRef<typeof AnimatedComponent>,
|
|
51
|
+
BoundaryComponentProps<P>
|
|
52
|
+
>((props, _ref) => {
|
|
53
|
+
const ownerRef = useAnimatedRef<View>();
|
|
54
|
+
const {
|
|
55
|
+
enabled = true,
|
|
56
|
+
group,
|
|
57
|
+
id,
|
|
58
|
+
anchor,
|
|
59
|
+
scaleMode,
|
|
60
|
+
target,
|
|
61
|
+
method,
|
|
62
|
+
style,
|
|
63
|
+
onPress,
|
|
64
|
+
...rest
|
|
65
|
+
} = props as any;
|
|
66
|
+
|
|
67
|
+
const sharedBoundTag = buildBoundaryMatchKey({ group, id });
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
previousScreenKey: preferredSourceScreenKey,
|
|
71
|
+
currentScreenKey,
|
|
72
|
+
nextScreenKey,
|
|
73
|
+
ancestorKeys,
|
|
74
|
+
navigatorKey,
|
|
75
|
+
ancestorNavigatorKeys,
|
|
76
|
+
hasConfiguredInterpolator,
|
|
77
|
+
} = useDescriptorDerivations();
|
|
78
|
+
|
|
79
|
+
const runtimeEnabled = enabled && hasConfiguredInterpolator;
|
|
80
|
+
const hasNextScreen = !!nextScreenKey;
|
|
81
|
+
const shouldUpdateDestination = !hasNextScreen;
|
|
82
|
+
const boundaryConfig = useMemo<BoundaryConfigProps | undefined>(() => {
|
|
83
|
+
if (
|
|
84
|
+
anchor === undefined &&
|
|
85
|
+
scaleMode === undefined &&
|
|
86
|
+
target === undefined &&
|
|
87
|
+
method === undefined
|
|
88
|
+
) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
anchor,
|
|
94
|
+
scaleMode,
|
|
95
|
+
target,
|
|
96
|
+
method,
|
|
97
|
+
};
|
|
98
|
+
}, [anchor, scaleMode, target, method]);
|
|
99
|
+
|
|
100
|
+
const isAnimating = AnimationStore.getValue(currentScreenKey, "animating");
|
|
101
|
+
|
|
102
|
+
const preparedStyles = useMemo(() => prepareStyleForBounds(style), [style]);
|
|
103
|
+
const { elementStylesMap } = useScreenStyles();
|
|
104
|
+
|
|
105
|
+
const associatedStyles = useAnimatedStyle(() => {
|
|
106
|
+
"worklet";
|
|
107
|
+
|
|
108
|
+
const baseStyle =
|
|
109
|
+
(elementStylesMap.value[sharedBoundTag]?.style as
|
|
110
|
+
| Record<string, any>
|
|
111
|
+
| undefined) ?? (NO_STYLES as Record<string, any>);
|
|
112
|
+
|
|
113
|
+
if ("opacity" in baseStyle) {
|
|
114
|
+
return baseStyle;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return { ...baseStyle, opacity: 1 };
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const associatedStackingStyles = useAnimatedStyle(() => {
|
|
121
|
+
"worklet";
|
|
122
|
+
const baseStyle =
|
|
123
|
+
(elementStylesMap.value[sharedBoundTag]?.style as
|
|
124
|
+
| Record<string, any>
|
|
125
|
+
| undefined) ?? (NO_STYLES as Record<string, any>);
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
zIndex: (baseStyle.zIndex as number | undefined) ?? 0,
|
|
129
|
+
elevation: (baseStyle.elevation as number | undefined) ?? 0,
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const { contextValue, measuredRef, hasActiveTarget } = useBoundaryOwner({
|
|
134
|
+
ownerRef,
|
|
135
|
+
associatedTargetStyles: enabled ? associatedStyles : undefined,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const maybeMeasureAndStore = useBoundaryMeasureAndStore({
|
|
139
|
+
enabled,
|
|
140
|
+
sharedBoundTag,
|
|
141
|
+
preferredSourceScreenKey,
|
|
142
|
+
currentScreenKey,
|
|
143
|
+
ancestorKeys,
|
|
144
|
+
navigatorKey,
|
|
145
|
+
ancestorNavigatorKeys,
|
|
146
|
+
isAnimating,
|
|
147
|
+
preparedStyles,
|
|
148
|
+
measuredAnimatedRef: measuredRef,
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const shouldRunDestinationEffects = runtimeEnabled && !hasNextScreen;
|
|
152
|
+
|
|
153
|
+
// Register/unregister this boundary in the presence map so source/destination
|
|
154
|
+
// matching can resolve across screens (including ancestor relationships).
|
|
155
|
+
useBoundaryPresence({
|
|
156
|
+
enabled: runtimeEnabled,
|
|
157
|
+
sharedBoundTag,
|
|
158
|
+
currentScreenKey,
|
|
159
|
+
ancestorKeys,
|
|
160
|
+
navigatorKey,
|
|
161
|
+
ancestorNavigatorKeys,
|
|
162
|
+
boundaryConfig,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// On the source screen, capture source bounds when a matching destination
|
|
166
|
+
// appears on the next screen.
|
|
167
|
+
useAutoSourceMeasurement({
|
|
168
|
+
enabled: runtimeEnabled,
|
|
169
|
+
sharedBoundTag,
|
|
170
|
+
nextScreenKey,
|
|
171
|
+
maybeMeasureAndStore,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Primary destination capture: once a pending source link exists for this tag,
|
|
175
|
+
// measure destination bounds and complete the pair.
|
|
176
|
+
usePendingDestinationMeasurement({
|
|
177
|
+
sharedBoundTag,
|
|
178
|
+
enabled: shouldRunDestinationEffects,
|
|
179
|
+
expectedSourceScreenKey: preferredSourceScreenKey,
|
|
180
|
+
maybeMeasureAndStore,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Reliability fallback: retry destination capture during transition progress
|
|
184
|
+
// when the initial pending-destination attempt happens before layout is ready.
|
|
185
|
+
usePendingDestinationRetryMeasurement({
|
|
186
|
+
sharedBoundTag,
|
|
187
|
+
enabled: shouldRunDestinationEffects,
|
|
188
|
+
currentScreenKey,
|
|
189
|
+
expectedSourceScreenKey: preferredSourceScreenKey,
|
|
190
|
+
animating: isAnimating,
|
|
191
|
+
maybeMeasureAndStore,
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// Grouped boundaries (e.g. paged/detail UIs): re-measure when this boundary
|
|
195
|
+
// becomes the active member so destination bounds stay accurate.
|
|
196
|
+
useGroupActiveMeasurement({
|
|
197
|
+
enabled: runtimeEnabled,
|
|
198
|
+
group,
|
|
199
|
+
id,
|
|
200
|
+
currentScreenKey,
|
|
201
|
+
shouldUpdateDestination,
|
|
202
|
+
maybeMeasureAndStore,
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// Source-side grouped retargeting: when an unfocused/source boundary
|
|
206
|
+
// becomes the active member, refresh its snapshot and source link so
|
|
207
|
+
// close transitions do not use stale pre-scroll geometry.
|
|
208
|
+
useGroupActiveSourceMeasurement({
|
|
209
|
+
enabled: runtimeEnabled,
|
|
210
|
+
group,
|
|
211
|
+
id,
|
|
212
|
+
hasNextScreen,
|
|
213
|
+
isAnimating,
|
|
214
|
+
maybeMeasureAndStore,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// While idle on source screens, re-measure after scroll settles so a later
|
|
218
|
+
// close transition starts from up-to-date source geometry.
|
|
219
|
+
useScrollSettledMeasurement({
|
|
220
|
+
enabled: runtimeEnabled,
|
|
221
|
+
group,
|
|
222
|
+
hasNextScreen,
|
|
223
|
+
isAnimating,
|
|
224
|
+
maybeMeasureAndStore,
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// Destination mount-time capture path: onLayout schedules a one-time UI-thread
|
|
228
|
+
// initial measurement when transitions are active.
|
|
229
|
+
useInitialLayoutHandler({
|
|
230
|
+
enabled: runtimeEnabled,
|
|
231
|
+
sharedBoundTag,
|
|
232
|
+
currentScreenKey,
|
|
233
|
+
ancestorKeys,
|
|
234
|
+
expectedSourceScreenKey: preferredSourceScreenKey,
|
|
235
|
+
maybeMeasureAndStore,
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
const handlePress = useCallback(
|
|
239
|
+
(...args: unknown[]) => {
|
|
240
|
+
// Press path has priority: capture source before user onPress/navigation.
|
|
241
|
+
if (group) {
|
|
242
|
+
runOnUI(BoundStore.setGroupActiveId)(group, String(id));
|
|
243
|
+
}
|
|
244
|
+
runOnUI(maybeMeasureAndStore)({ intent: "capture-source" });
|
|
245
|
+
|
|
246
|
+
if (typeof onPress === "function") {
|
|
247
|
+
onPress(...args);
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
[group, id, maybeMeasureAndStore, onPress],
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
const resolvedOnPress =
|
|
254
|
+
typeof onPress === "function" ? handlePress : undefined;
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<BoundaryOwnerProvider value={contextValue}>
|
|
258
|
+
<AnimatedComponent
|
|
259
|
+
{...rest}
|
|
260
|
+
ref={ownerRef}
|
|
261
|
+
style={[
|
|
262
|
+
style,
|
|
263
|
+
enabled
|
|
264
|
+
? hasActiveTarget
|
|
265
|
+
? associatedStackingStyles
|
|
266
|
+
: associatedStyles
|
|
267
|
+
: undefined,
|
|
268
|
+
]}
|
|
269
|
+
onPress={resolvedOnPress}
|
|
270
|
+
collapsable={false}
|
|
271
|
+
/>
|
|
272
|
+
</BoundaryOwnerProvider>
|
|
273
|
+
);
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
return memo(Inner) as unknown as React.MemoExoticComponent<
|
|
277
|
+
React.ForwardRefExoticComponent<
|
|
278
|
+
BoundaryComponentProps<P> &
|
|
279
|
+
React.RefAttributes<React.ComponentRef<typeof Wrapped>>
|
|
280
|
+
>
|
|
281
|
+
>;
|
|
282
|
+
}
|
|
@@ -193,14 +193,9 @@ export const resolveInitialLayoutMeasurementIntent = (params: {
|
|
|
193
193
|
|
|
194
194
|
if (!enabled) return null;
|
|
195
195
|
if (!hasSharedBoundTag || hasMeasuredOnLayout) return null;
|
|
196
|
+
if (!isAnyAnimating) return null;
|
|
196
197
|
|
|
197
|
-
|
|
198
|
-
return "snapshot-only";
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return hasPendingLinkFromSource
|
|
202
|
-
? ["snapshot-only", "complete-destination"]
|
|
203
|
-
: "snapshot-only";
|
|
198
|
+
return hasPendingLinkFromSource ? "complete-destination" : null;
|
|
204
199
|
};
|
|
205
200
|
|
|
206
201
|
export const resolveGroupActiveMeasurementAction = (params: {
|
package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type StyleProps,
|
|
8
8
|
} from "react-native-reanimated";
|
|
9
9
|
import useStableCallbackValue from "../../../hooks/use-stable-callback-value";
|
|
10
|
+
import { useLayoutAnchorContext } from "../../../providers/layout-anchor.provider";
|
|
10
11
|
import { BoundStore } from "../../../stores/bounds";
|
|
11
12
|
import { applyMeasuredBoundsWrites } from "../../../stores/bounds/helpers/apply-measured-bounds-writes";
|
|
12
13
|
import { resolvePendingSourceKey } from "../helpers/resolve-pending-source-key";
|
|
@@ -16,11 +17,6 @@ import {
|
|
|
16
17
|
resolveMeasurementWritePlan,
|
|
17
18
|
} from "./helpers/measurement-rules";
|
|
18
19
|
|
|
19
|
-
type LayoutAnchor = {
|
|
20
|
-
correctMeasurement: (measured: MeasuredDimensions) => MeasuredDimensions;
|
|
21
|
-
isMeasurementInViewport?: (measured: MeasuredDimensions) => boolean;
|
|
22
|
-
} | null;
|
|
23
|
-
|
|
24
20
|
const SNAPSHOT_EPSILON = 0.5;
|
|
25
21
|
|
|
26
22
|
const areMeasurementsEqual = (
|
|
@@ -49,8 +45,7 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
49
45
|
ancestorNavigatorKeys?: string[];
|
|
50
46
|
isAnimating: SharedValue<number>;
|
|
51
47
|
preparedStyles: StyleProps;
|
|
52
|
-
|
|
53
|
-
layoutAnchor: LayoutAnchor;
|
|
48
|
+
measuredAnimatedRef: AnimatedRef<View>;
|
|
54
49
|
}) => {
|
|
55
50
|
const {
|
|
56
51
|
enabled,
|
|
@@ -62,10 +57,11 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
62
57
|
ancestorNavigatorKeys,
|
|
63
58
|
isAnimating,
|
|
64
59
|
preparedStyles,
|
|
65
|
-
|
|
66
|
-
layoutAnchor,
|
|
60
|
+
measuredAnimatedRef,
|
|
67
61
|
} = params;
|
|
68
62
|
|
|
63
|
+
const layoutAnchor = useLayoutAnchorContext();
|
|
64
|
+
|
|
69
65
|
return useStableCallbackValue(
|
|
70
66
|
({ intent }: MaybeMeasureAndStoreParams = {}) => {
|
|
71
67
|
"worklet";
|
|
@@ -127,7 +123,7 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
127
123
|
return;
|
|
128
124
|
}
|
|
129
125
|
|
|
130
|
-
const measured = measure(
|
|
126
|
+
const measured = measure(measuredAnimatedRef);
|
|
131
127
|
if (!measured) return;
|
|
132
128
|
|
|
133
129
|
const correctedMeasured = layoutAnchor
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
useAnimatedReaction,
|
|
4
4
|
useSharedValue,
|
|
5
5
|
} from "react-native-reanimated";
|
|
6
|
+
import { AnimationStore } from "../../../stores/animation.store";
|
|
6
7
|
import { BoundStore } from "../../../stores/bounds";
|
|
7
8
|
import { resolvePendingSourceKey } from "../helpers/resolve-pending-source-key";
|
|
8
9
|
import type { MaybeMeasureAndStoreParams } from "../types";
|
|
@@ -13,7 +14,6 @@ export const usePendingDestinationRetryMeasurement = (params: {
|
|
|
13
14
|
enabled: boolean;
|
|
14
15
|
currentScreenKey: string;
|
|
15
16
|
expectedSourceScreenKey?: string;
|
|
16
|
-
progress: SharedValue<number>;
|
|
17
17
|
animating: SharedValue<number>;
|
|
18
18
|
maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
|
|
19
19
|
}) => {
|
|
@@ -22,11 +22,12 @@ export const usePendingDestinationRetryMeasurement = (params: {
|
|
|
22
22
|
enabled,
|
|
23
23
|
currentScreenKey,
|
|
24
24
|
expectedSourceScreenKey,
|
|
25
|
-
progress,
|
|
26
25
|
animating,
|
|
27
26
|
maybeMeasureAndStore,
|
|
28
27
|
} = params;
|
|
29
28
|
|
|
29
|
+
const progress = AnimationStore.getValue(currentScreenKey, "progress");
|
|
30
|
+
|
|
30
31
|
const retryCount = useSharedValue(0);
|
|
31
32
|
const MAX_RETRIES = 4;
|
|
32
33
|
const RETRY_PROGRESS_BUCKETS = 8;
|