react-native-screen-transitions 3.4.0-alpha.6 → 3.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -46
- 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 +41 -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 +193 -0
- package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +53 -43
- 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-auto-source-measurement.js +7 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +8 -26
- 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-measurement.js +84 -2
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js +67 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/index.js +27 -216
- 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 +37 -39
- 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-content-layout.js +11 -9
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/index.js +8 -12
- package/lib/commonjs/shared/components/screen-container/index.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +11 -9
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/content.js +4 -4
- 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/components/screen-lifecycle/index.js +3 -1
- package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/commonjs/shared/constants.js +18 -2
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js +43 -0
- package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
- package/lib/commonjs/shared/index.js +6 -0
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +7 -0
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -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} +37 -39
- package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -0
- package/lib/commonjs/shared/stores/animation.store.js +9 -3
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/registry.js +18 -2
- package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -48
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +10 -0
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +6 -12
- 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 +158 -52
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js +3 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.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 +36 -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 +188 -0
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
- package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +51 -41
- 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-auto-source-measurement.js +7 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +8 -26
- 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-measurement.js +86 -4
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js +62 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/index.js +23 -215
- 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 +39 -41
- 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-content-layout.js +11 -9
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
- package/lib/module/shared/components/screen-container/index.js +8 -12
- package/lib/module/shared/components/screen-container/index.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +11 -9
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js +4 -4
- 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/components/screen-lifecycle/index.js +3 -1
- package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/module/shared/constants.js +17 -1
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/reanimated/use-animated-debounce.js +39 -0
- package/lib/module/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
- package/lib/module/shared/index.js +1 -1
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js +7 -0
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -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} +38 -40
- package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -0
- package/lib/module/shared/stores/animation.store.js +9 -3
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/registry.js +18 -2
- package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/resolver.js +7 -48
- package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +10 -0
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +7 -13
- 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 +159 -52
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/config.js +2 -0
- package/lib/module/shared/utils/bounds/zoom/config.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/helpers/resolve-pending-source-key.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +16 -11
- 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-auto-source-measurement.d.ts +3 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +2 -9
- 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-measurement.d.ts +6 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts +12 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts +224 -14
- 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-boundary-component/types.d.ts +1 -1
- package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.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.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +34 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts +13 -0
- package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts.map +1 -0
- package/lib/typescript/shared/index.d.ts +210 -3
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +3 -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/use-build-transition-state.d.ts +3 -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/stores/animation.store.d.ts +5 -2
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/types.d.ts +0 -2
- package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +14 -9
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +34 -1
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +1 -1
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +2 -4
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +2 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.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/lib/typescript/shared/utils/bounds/zoom/config.d.ts +2 -0
- package/lib/typescript/shared/utils/bounds/zoom/config.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 +47 -0
- package/src/shared/components/create-boundary-component/create-boundary-component.tsx +249 -0
- package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +5 -1
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +68 -59
- package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +19 -3
- package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +11 -44
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +165 -6
- package/src/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.ts +107 -0
- package/src/shared/components/create-boundary-component/index.tsx +23 -254
- package/src/shared/components/create-boundary-component/providers/boundary-owner.provider.tsx +109 -0
- package/src/shared/components/create-boundary-component/types.ts +1 -2
- package/src/shared/components/create-transition-aware-component.tsx +43 -52
- package/src/shared/components/overlay/variations/float-overlay.tsx +1 -1
- package/src/shared/components/screen-container/hooks/use-content-layout.ts +10 -17
- package/src/shared/components/screen-container/index.tsx +10 -13
- package/src/shared/components/screen-container/layers/backdrop.tsx +10 -13
- package/src/shared/components/screen-container/layers/content.tsx +4 -4
- 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/components/screen-lifecycle/index.tsx +1 -4
- package/src/shared/constants.ts +12 -0
- package/src/shared/hooks/reanimated/use-animated-debounce.ts +56 -0
- package/src/shared/index.ts +1 -1
- package/src/shared/providers/gestures/handlers/use-handlers.ts +9 -0
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +27 -1
- package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +6 -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.provider.tsx → styles/styles.provider.tsx} +54 -56
- package/src/shared/stores/animation.store.ts +11 -2
- package/src/shared/stores/bounds/internals/registry.ts +24 -3
- package/src/shared/stores/bounds/internals/resolver.ts +6 -75
- package/src/shared/stores/bounds/types.ts +0 -2
- package/src/shared/types/animation.types.ts +16 -10
- package/src/shared/types/bounds.types.ts +34 -1
- package/src/shared/types/index.ts +0 -1
- package/src/shared/types/screen.types.ts +2 -4
- package/src/shared/utils/animation/animate-to-progress.ts +11 -1
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +3 -12
- package/src/shared/utils/bounds/helpers/style-composers.ts +11 -0
- package/src/shared/utils/bounds/zoom/build.ts +228 -100
- package/src/shared/utils/bounds/zoom/config.ts +2 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -54
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -122
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -72
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -66
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -57
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -53
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js +0 -45
- 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/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -49
- package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -118
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -67
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -61
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -52
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -48
- package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js +0 -40
- 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/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +0 -11
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +0 -17
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +0 -11
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts +0 -10
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -12
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +0 -10
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts +0 -14
- 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/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +0 -58
- package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +0 -162
- package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +0 -82
- package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +0 -92
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +0 -86
- package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +0 -49
- package/src/shared/components/screen-container/deferred-visibility-host.tsx +0 -44
- package/src/shared/hooks/animation/use-associated-style.ts +0 -297
- package/src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts +0 -61
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { NO_STYLES } from "../../../../constants";
|
|
2
|
+
import type {
|
|
3
|
+
NormalizedTransitionInterpolatedStyle,
|
|
4
|
+
NormalizedTransitionSlotStyle,
|
|
5
|
+
} from "../../../../types/animation.types";
|
|
6
|
+
|
|
7
|
+
export type StyleKeySet = Record<string, true>;
|
|
8
|
+
|
|
9
|
+
type StyleKeyMeta = {
|
|
10
|
+
keys: StyleKeySet;
|
|
11
|
+
hasAny: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const IDENTITY_TRANSFORM = [
|
|
15
|
+
{ translateX: 0 },
|
|
16
|
+
{ translateY: 0 },
|
|
17
|
+
{ scaleX: 1 },
|
|
18
|
+
{ scaleY: 1 },
|
|
19
|
+
] as const;
|
|
20
|
+
|
|
21
|
+
const ALWAYS_RESET_STYLE_VALUES = {
|
|
22
|
+
zIndex: 0,
|
|
23
|
+
elevation: 0,
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
const hasAnyKeys = (record: Record<string, unknown>) => {
|
|
27
|
+
"worklet";
|
|
28
|
+
for (const _key in record) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const collectStyleKeyMeta = (
|
|
35
|
+
record?: Record<string, unknown>,
|
|
36
|
+
): StyleKeyMeta => {
|
|
37
|
+
"worklet";
|
|
38
|
+
const keys: StyleKeySet = {};
|
|
39
|
+
let hasAny = false;
|
|
40
|
+
|
|
41
|
+
if (!record) {
|
|
42
|
+
return { keys, hasAny };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (const key in record) {
|
|
46
|
+
keys[key] = true;
|
|
47
|
+
hasAny = true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return { keys, hasAny };
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const collectRelevantSlotIds = ({
|
|
54
|
+
currentStylesMap,
|
|
55
|
+
fallbackStylesMap,
|
|
56
|
+
previousStyleKeysBySlot,
|
|
57
|
+
}: {
|
|
58
|
+
currentStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
59
|
+
fallbackStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
60
|
+
previousStyleKeysBySlot: Record<string, StyleKeySet>;
|
|
61
|
+
}) => {
|
|
62
|
+
"worklet";
|
|
63
|
+
const slotIds: Record<string, true> = {};
|
|
64
|
+
|
|
65
|
+
for (const slotId in currentStylesMap) {
|
|
66
|
+
slotIds[slotId] = true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
for (const slotId in fallbackStylesMap) {
|
|
70
|
+
slotIds[slotId] = true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
for (const slotId in previousStyleKeysBySlot) {
|
|
74
|
+
slotIds[slotId] = true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return slotIds;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const buildUnsetPatch = ({
|
|
81
|
+
previousKeys,
|
|
82
|
+
currentKeys,
|
|
83
|
+
}: {
|
|
84
|
+
previousKeys: StyleKeySet;
|
|
85
|
+
currentKeys: StyleKeySet;
|
|
86
|
+
}) => {
|
|
87
|
+
"worklet";
|
|
88
|
+
const unsetPatch: Record<string, any> = {};
|
|
89
|
+
|
|
90
|
+
for (const key in previousKeys) {
|
|
91
|
+
if (currentKeys[key]) continue;
|
|
92
|
+
|
|
93
|
+
if (key === "transform") {
|
|
94
|
+
unsetPatch.transform = IDENTITY_TRANSFORM;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (key in ALWAYS_RESET_STYLE_VALUES) {
|
|
99
|
+
unsetPatch[key] =
|
|
100
|
+
ALWAYS_RESET_STYLE_VALUES[
|
|
101
|
+
key as keyof typeof ALWAYS_RESET_STYLE_VALUES
|
|
102
|
+
];
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
unsetPatch[key] = undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return unsetPatch;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const buildResolvedStyleMap = ({
|
|
113
|
+
currentStylesMap,
|
|
114
|
+
fallbackStylesMap,
|
|
115
|
+
previousStyleKeysBySlot,
|
|
116
|
+
}: {
|
|
117
|
+
currentStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
118
|
+
fallbackStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
119
|
+
previousStyleKeysBySlot: Record<string, StyleKeySet>;
|
|
120
|
+
}): {
|
|
121
|
+
resolvedStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
122
|
+
nextPreviousStyleKeysBySlot: Record<string, StyleKeySet>;
|
|
123
|
+
} => {
|
|
124
|
+
"worklet";
|
|
125
|
+
const resolvedStylesMap: NormalizedTransitionInterpolatedStyle = {};
|
|
126
|
+
const nextPreviousStyleKeysBySlot: Record<string, StyleKeySet> = {};
|
|
127
|
+
|
|
128
|
+
const slotIds = collectRelevantSlotIds({
|
|
129
|
+
currentStylesMap,
|
|
130
|
+
fallbackStylesMap,
|
|
131
|
+
previousStyleKeysBySlot,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
for (const slotId in slotIds) {
|
|
135
|
+
const slot = currentStylesMap[slotId] ?? fallbackStylesMap[slotId];
|
|
136
|
+
const baseStyle = slot?.style as Record<string, unknown> | undefined;
|
|
137
|
+
const { keys: currentKeys, hasAny: hasCurrentStyleKeys } =
|
|
138
|
+
collectStyleKeyMeta(baseStyle);
|
|
139
|
+
|
|
140
|
+
const unsetPatch = buildUnsetPatch({
|
|
141
|
+
previousKeys: previousStyleKeysBySlot[slotId] ?? {},
|
|
142
|
+
currentKeys,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const hasUnsetPatch = hasAnyKeys(unsetPatch);
|
|
146
|
+
const hasProps = slot?.props !== undefined;
|
|
147
|
+
|
|
148
|
+
if (!slot && !hasUnsetPatch) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const resolvedStyle =
|
|
153
|
+
hasCurrentStyleKeys || hasUnsetPatch
|
|
154
|
+
? {
|
|
155
|
+
...unsetPatch,
|
|
156
|
+
...(slot?.style ?? NO_STYLES),
|
|
157
|
+
}
|
|
158
|
+
: undefined;
|
|
159
|
+
|
|
160
|
+
if (resolvedStyle === undefined && !hasProps) {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const resolvedSlot = {} as NormalizedTransitionSlotStyle;
|
|
165
|
+
|
|
166
|
+
if (resolvedStyle !== undefined) {
|
|
167
|
+
resolvedSlot.style = resolvedStyle;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (hasProps) {
|
|
171
|
+
resolvedSlot.props = slot?.props;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
resolvedStylesMap[slotId] = resolvedSlot;
|
|
175
|
+
|
|
176
|
+
if (hasCurrentStyleKeys) {
|
|
177
|
+
nextPreviousStyleKeysBySlot[slotId] = currentKeys;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
resolvedStylesMap,
|
|
183
|
+
nextPreviousStyleKeysBySlot,
|
|
184
|
+
};
|
|
185
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NO_STYLES } from "../../../../constants";
|
|
2
|
+
import type {
|
|
3
|
+
NormalizedTransitionInterpolatedStyle,
|
|
4
|
+
TransitionInterpolatedStyle,
|
|
5
|
+
} from "../../../../types/animation.types";
|
|
6
|
+
import { normalizeInterpolatedStyle } from "../../../../utils/normalize-interpolated-style";
|
|
7
|
+
|
|
8
|
+
export type ResolvedInterpolatedStyleOutput = {
|
|
9
|
+
stylesMap: NormalizedTransitionInterpolatedStyle;
|
|
10
|
+
wasLegacy: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const resolveInterpolatedStyleOutput = (
|
|
14
|
+
raw: TransitionInterpolatedStyle | null | undefined,
|
|
15
|
+
): ResolvedInterpolatedStyleOutput => {
|
|
16
|
+
"worklet";
|
|
17
|
+
|
|
18
|
+
if (raw == null || typeof raw !== "object") {
|
|
19
|
+
return {
|
|
20
|
+
stylesMap: NO_STYLES,
|
|
21
|
+
wasLegacy: false,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { result, wasLegacy } = normalizeInterpolatedStyle(raw);
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
stylesMap: result,
|
|
29
|
+
wasLegacy,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NAVIGATION_MASK_CONTAINER_STYLE_ID,
|
|
3
|
+
NAVIGATION_MASK_ELEMENT_STYLE_ID,
|
|
4
|
+
} from "../../../../constants";
|
|
5
|
+
import type { NormalizedTransitionInterpolatedStyle } from "../../../../types/animation.types";
|
|
6
|
+
|
|
7
|
+
const LAYER_STYLE_SLOT_IDS = {
|
|
8
|
+
content: true,
|
|
9
|
+
backdrop: true,
|
|
10
|
+
surface: true,
|
|
11
|
+
[NAVIGATION_MASK_ELEMENT_STYLE_ID]: true,
|
|
12
|
+
[NAVIGATION_MASK_CONTAINER_STYLE_ID]: true,
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
const isLayerStyleSlotId = (slotId: string) => {
|
|
16
|
+
"worklet";
|
|
17
|
+
// biome-ignore lint/suspicious/noPrototypeBuiltins: <Typescript lib target is ES2020>
|
|
18
|
+
return Object.prototype.hasOwnProperty.call(LAYER_STYLE_SLOT_IDS, slotId);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const splitNormalizedStyleMaps = (
|
|
22
|
+
stylesMap: NormalizedTransitionInterpolatedStyle,
|
|
23
|
+
): {
|
|
24
|
+
layerStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
25
|
+
elementStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
26
|
+
} => {
|
|
27
|
+
"worklet";
|
|
28
|
+
const layerStylesMap: NormalizedTransitionInterpolatedStyle = {};
|
|
29
|
+
const elementStylesMap: NormalizedTransitionInterpolatedStyle = {};
|
|
30
|
+
|
|
31
|
+
for (const slotId in stylesMap) {
|
|
32
|
+
if (isLayerStyleSlotId(slotId)) {
|
|
33
|
+
layerStylesMap[slotId] = stylesMap[slotId];
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
elementStylesMap[slotId] = stylesMap[slotId];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
layerStylesMap,
|
|
42
|
+
elementStylesMap,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -4,26 +4,25 @@ import {
|
|
|
4
4
|
useDerivedValue,
|
|
5
5
|
useSharedValue,
|
|
6
6
|
} from "react-native-reanimated";
|
|
7
|
-
import { NO_STYLES } from "
|
|
8
|
-
import type { NormalizedTransitionInterpolatedStyle } from "
|
|
9
|
-
import createProvider from "
|
|
10
|
-
import { logger } from "
|
|
11
|
-
import { useScreenAnimationContext } from "
|
|
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
12
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "./helpers/
|
|
13
|
+
buildResolvedStyleMap,
|
|
14
|
+
type StyleKeySet,
|
|
15
|
+
} from "./helpers/build-resolved-style-map";
|
|
16
|
+
import { resolveInterpolatedStyleOutput } from "./helpers/resolve-interpolated-style-output";
|
|
17
|
+
import { splitNormalizedStyleMaps } from "./helpers/split-normalized-style-maps";
|
|
18
18
|
|
|
19
19
|
type Props = {
|
|
20
20
|
children: ReactNode;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
type ScreenStylesContextValue = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
resolutionMode: SharedValue<ScreenStyleResolutionMode>;
|
|
24
|
+
layerStylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
|
|
25
|
+
elementStylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
|
|
27
26
|
};
|
|
28
27
|
|
|
29
28
|
export const {
|
|
@@ -34,7 +33,7 @@ export const {
|
|
|
34
33
|
guarded: true,
|
|
35
34
|
})<Props, ScreenStylesContextValue>(
|
|
36
35
|
({ children }): { value: ScreenStylesContextValue; children: ReactNode } => {
|
|
37
|
-
const
|
|
36
|
+
const parentContext = useContext(ScreenStylesContext);
|
|
38
37
|
|
|
39
38
|
const {
|
|
40
39
|
screenInterpolatorProps,
|
|
@@ -43,16 +42,15 @@ export const {
|
|
|
43
42
|
boundsAccessor,
|
|
44
43
|
} = useScreenAnimationContext();
|
|
45
44
|
|
|
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
45
|
const isGesturingDuringCloseAnimation = useSharedValue(false);
|
|
51
46
|
const hasWarnedLegacy = useSharedValue(false);
|
|
47
|
+
const previousElementStyleKeysBySlot = useSharedValue<
|
|
48
|
+
Record<string, StyleKeySet>
|
|
49
|
+
>({});
|
|
52
50
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
const rawStyleResolution = useDerivedValue<{
|
|
52
|
+
layerStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
53
|
+
elementStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
56
54
|
}>(() => {
|
|
57
55
|
"worklet";
|
|
58
56
|
const props = screenInterpolatorProps.value;
|
|
@@ -71,21 +69,17 @@ export const {
|
|
|
71
69
|
const isInGestureMode =
|
|
72
70
|
isDragging || isGesturingDuringCloseAnimation.value;
|
|
73
71
|
|
|
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
72
|
const interpolator = isInGestureMode
|
|
78
73
|
? currentInterpolator
|
|
79
74
|
: (nextInterpolator ?? currentInterpolator);
|
|
80
75
|
|
|
81
76
|
if (!interpolator) {
|
|
82
|
-
return
|
|
77
|
+
return {
|
|
78
|
+
layerStylesMap: NO_STYLES,
|
|
79
|
+
elementStylesMap: NO_STYLES,
|
|
80
|
+
};
|
|
83
81
|
}
|
|
84
82
|
|
|
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
83
|
let effectiveProgress = progress;
|
|
90
84
|
let effectiveNext = next;
|
|
91
85
|
|
|
@@ -102,8 +96,10 @@ export const {
|
|
|
102
96
|
bounds: boundsAccessor,
|
|
103
97
|
});
|
|
104
98
|
|
|
105
|
-
const { stylesMap,
|
|
106
|
-
|
|
99
|
+
const { stylesMap, wasLegacy } = resolveInterpolatedStyleOutput(raw);
|
|
100
|
+
|
|
101
|
+
const { layerStylesMap, elementStylesMap } =
|
|
102
|
+
splitNormalizedStyleMaps(stylesMap);
|
|
107
103
|
|
|
108
104
|
if (__DEV__ && wasLegacy && !hasWarnedLegacy.value) {
|
|
109
105
|
hasWarnedLegacy.value = true;
|
|
@@ -114,11 +110,8 @@ export const {
|
|
|
114
110
|
}
|
|
115
111
|
|
|
116
112
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
resolutionMode,
|
|
120
|
-
isSettled: current.settled === 1,
|
|
121
|
-
}),
|
|
113
|
+
layerStylesMap,
|
|
114
|
+
elementStylesMap,
|
|
122
115
|
};
|
|
123
116
|
} catch (err) {
|
|
124
117
|
if (__DEV__) {
|
|
@@ -127,37 +120,42 @@ export const {
|
|
|
127
120
|
err,
|
|
128
121
|
);
|
|
129
122
|
}
|
|
123
|
+
|
|
130
124
|
return {
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
layerStylesMap: NO_STYLES,
|
|
126
|
+
elementStylesMap: NO_STYLES,
|
|
133
127
|
};
|
|
134
128
|
}
|
|
135
129
|
});
|
|
136
130
|
|
|
137
|
-
const
|
|
138
|
-
() => {
|
|
131
|
+
const layerStylesMap =
|
|
132
|
+
useDerivedValue<NormalizedTransitionInterpolatedStyle>(() => {
|
|
139
133
|
"worklet";
|
|
140
|
-
return
|
|
141
|
-
}
|
|
142
|
-
);
|
|
134
|
+
return rawStyleResolution.value.layerStylesMap;
|
|
135
|
+
});
|
|
143
136
|
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
137
|
+
const elementStylesMap =
|
|
138
|
+
useDerivedValue<NormalizedTransitionInterpolatedStyle>(() => {
|
|
139
|
+
"worklet";
|
|
140
|
+
const { resolvedStylesMap, nextPreviousStyleKeysBySlot } =
|
|
141
|
+
buildResolvedStyleMap({
|
|
142
|
+
currentStylesMap: rawStyleResolution.value.elementStylesMap,
|
|
143
|
+
fallbackStylesMap:
|
|
144
|
+
parentContext?.elementStylesMap.value ?? NO_STYLES,
|
|
145
|
+
previousStyleKeysBySlot: previousElementStyleKeysBySlot.value,
|
|
146
|
+
});
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
// Build ancestor chain: [parent, grandparent, great-grandparent, ...]
|
|
151
|
-
const ancestorStylesMaps = parentCtx
|
|
152
|
-
? [parentCtx.stylesMap, ...parentCtx.ancestorStylesMaps]
|
|
153
|
-
: [];
|
|
148
|
+
previousElementStyleKeysBySlot.value = nextPreviousStyleKeysBySlot;
|
|
154
149
|
|
|
150
|
+
return resolvedStylesMap;
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const value = useMemo<ScreenStylesContextValue>(() => {
|
|
155
154
|
return {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
resolutionMode,
|
|
155
|
+
layerStylesMap,
|
|
156
|
+
elementStylesMap,
|
|
159
157
|
};
|
|
160
|
-
}, [
|
|
158
|
+
}, [elementStylesMap, layerStylesMap]);
|
|
161
159
|
|
|
162
160
|
return { value, children };
|
|
163
161
|
},
|
|
@@ -7,31 +7,40 @@ import { createStore } from "../utils/create-store";
|
|
|
7
7
|
|
|
8
8
|
export type AnimationStoreMap = {
|
|
9
9
|
progress: SharedValue<number>;
|
|
10
|
+
willAnimate: SharedValue<number>;
|
|
10
11
|
animating: SharedValue<number>;
|
|
11
12
|
closing: SharedValue<number>;
|
|
12
13
|
entering: SharedValue<number>;
|
|
14
|
+
settled: SharedValue<number>;
|
|
15
|
+
logicallySettled: SharedValue<number>;
|
|
13
16
|
};
|
|
14
17
|
|
|
15
18
|
function createAnimationBag(): AnimationStoreMap {
|
|
16
19
|
return {
|
|
17
20
|
progress: makeMutable(0),
|
|
21
|
+
willAnimate: makeMutable(0),
|
|
18
22
|
closing: makeMutable(0),
|
|
19
23
|
animating: makeMutable(0),
|
|
20
24
|
entering: makeMutable(0),
|
|
25
|
+
settled: makeMutable(1),
|
|
26
|
+
logicallySettled: makeMutable(1),
|
|
21
27
|
};
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
/**
|
|
25
31
|
* Route-keyed screen transition state for the public animation lifecycle. These
|
|
26
|
-
* shared values track the current progress
|
|
27
|
-
* closing, or actively animating.
|
|
32
|
+
* shared values track the current progress, whether a transition is about to
|
|
33
|
+
* begin, and whether a screen is entering, closing, or actively animating.
|
|
28
34
|
*/
|
|
29
35
|
export const AnimationStore = createStore<AnimationStoreMap>({
|
|
30
36
|
createBag: createAnimationBag,
|
|
31
37
|
disposeBag: (bag) => {
|
|
32
38
|
cancelAnimation(bag.progress);
|
|
39
|
+
cancelAnimation(bag.willAnimate);
|
|
33
40
|
cancelAnimation(bag.animating);
|
|
34
41
|
cancelAnimation(bag.closing);
|
|
35
42
|
cancelAnimation(bag.entering);
|
|
43
|
+
cancelAnimation(bag.settled);
|
|
44
|
+
cancelAnimation(bag.logicallySettled);
|
|
36
45
|
},
|
|
37
46
|
});
|
|
@@ -204,6 +204,22 @@ const findLatestPendingIndex = (
|
|
|
204
204
|
return -1;
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
const findLatestSourceIndex = (
|
|
208
|
+
stack: TagLink[],
|
|
209
|
+
expectedSourceScreenKey?: ScreenKey,
|
|
210
|
+
): number => {
|
|
211
|
+
"worklet";
|
|
212
|
+
if (!expectedSourceScreenKey) return -1;
|
|
213
|
+
|
|
214
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
215
|
+
if (matchesScreenKey(stack[i].source, expectedSourceScreenKey)) {
|
|
216
|
+
return i;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return -1;
|
|
221
|
+
};
|
|
222
|
+
|
|
207
223
|
function setLinkDestination(
|
|
208
224
|
tag: TagID,
|
|
209
225
|
screenKey: ScreenKey,
|
|
@@ -221,12 +237,13 @@ function setLinkDestination(
|
|
|
221
237
|
const stack = tagState?.linkStack;
|
|
222
238
|
if (!stack || stack.length === 0) return state;
|
|
223
239
|
|
|
224
|
-
|
|
240
|
+
let targetIndex = findLatestPendingIndex(stack, expectedSourceScreenKey);
|
|
241
|
+
if (targetIndex === -1) {
|
|
242
|
+
targetIndex = findLatestSourceIndex(stack, expectedSourceScreenKey);
|
|
243
|
+
}
|
|
225
244
|
if (targetIndex === -1) return state;
|
|
226
245
|
|
|
227
246
|
const targetLink = stack[targetIndex];
|
|
228
|
-
if (targetLink.destination !== null) return state;
|
|
229
|
-
|
|
230
247
|
targetLink.destination = {
|
|
231
248
|
screenKey,
|
|
232
249
|
ancestorKeys,
|
|
@@ -272,6 +289,10 @@ function updateLinkDestination(
|
|
|
272
289
|
targetIndex = findLatestPendingIndex(stack, expectedSourceScreenKey);
|
|
273
290
|
}
|
|
274
291
|
|
|
292
|
+
if (targetIndex === -1) {
|
|
293
|
+
targetIndex = findLatestSourceIndex(stack, expectedSourceScreenKey);
|
|
294
|
+
}
|
|
295
|
+
|
|
275
296
|
if (targetIndex === -1) {
|
|
276
297
|
return state;
|
|
277
298
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
|
|
2
1
|
import { matchesScreenKey } from "../helpers/matching";
|
|
3
2
|
import type {
|
|
4
3
|
ResolvedTransitionPair,
|
|
@@ -8,7 +7,6 @@ import type {
|
|
|
8
7
|
TagLink,
|
|
9
8
|
TagState,
|
|
10
9
|
} from "../types";
|
|
11
|
-
import { getSnapshot } from "./registry";
|
|
12
10
|
import { debugResolverLog, registry } from "./state";
|
|
13
11
|
|
|
14
12
|
const findLatestLink = (
|
|
@@ -67,30 +65,6 @@ function findPendingLinkBySource(
|
|
|
67
65
|
);
|
|
68
66
|
}
|
|
69
67
|
|
|
70
|
-
function getSnapshotBoundsByPriority(
|
|
71
|
-
tag: TagID,
|
|
72
|
-
keys: (ScreenKey | undefined)[],
|
|
73
|
-
): {
|
|
74
|
-
bounds: MeasuredDimensions;
|
|
75
|
-
styles: StyleProps;
|
|
76
|
-
screenKey: ScreenKey;
|
|
77
|
-
} | null {
|
|
78
|
-
"worklet";
|
|
79
|
-
for (let i = 0; i < keys.length; i++) {
|
|
80
|
-
const key = keys[i];
|
|
81
|
-
if (!key) continue;
|
|
82
|
-
const snapshot = getSnapshot(tag, key);
|
|
83
|
-
if (!snapshot) continue;
|
|
84
|
-
return {
|
|
85
|
-
bounds: snapshot.bounds,
|
|
86
|
-
styles: snapshot.styles,
|
|
87
|
-
screenKey: key,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
68
|
function resolveTransitionPair(
|
|
95
69
|
tag: TagID,
|
|
96
70
|
context: ResolveTransitionContext,
|
|
@@ -153,53 +127,12 @@ function resolveTransitionPair(
|
|
|
153
127
|
}
|
|
154
128
|
}
|
|
155
129
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
let usedSnapshotSource = false;
|
|
163
|
-
let usedSnapshotDestination = false;
|
|
164
|
-
|
|
165
|
-
const sourceFallbackKeys = context.entering
|
|
166
|
-
? [
|
|
167
|
-
context.previousScreenKey,
|
|
168
|
-
context.currentScreenKey,
|
|
169
|
-
context.nextScreenKey,
|
|
170
|
-
]
|
|
171
|
-
: [
|
|
172
|
-
context.currentScreenKey,
|
|
173
|
-
context.previousScreenKey,
|
|
174
|
-
context.nextScreenKey,
|
|
175
|
-
];
|
|
176
|
-
|
|
177
|
-
const destinationFallbackKeys = context.entering
|
|
178
|
-
? [context.currentScreenKey, context.nextScreenKey]
|
|
179
|
-
: [context.nextScreenKey, context.currentScreenKey];
|
|
180
|
-
|
|
181
|
-
if (!sourceBounds) {
|
|
182
|
-
const sourceSnapshot = getSnapshotBoundsByPriority(tag, sourceFallbackKeys);
|
|
183
|
-
if (sourceSnapshot) {
|
|
184
|
-
sourceBounds = sourceSnapshot.bounds;
|
|
185
|
-
sourceStyles = sourceSnapshot.styles;
|
|
186
|
-
sourceScreenKey = sourceSnapshot.screenKey;
|
|
187
|
-
usedSnapshotSource = true;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (!destinationBounds) {
|
|
192
|
-
const destinationSnapshot = getSnapshotBoundsByPriority(
|
|
193
|
-
tag,
|
|
194
|
-
destinationFallbackKeys,
|
|
195
|
-
);
|
|
196
|
-
if (destinationSnapshot) {
|
|
197
|
-
destinationBounds = destinationSnapshot.bounds;
|
|
198
|
-
destinationStyles = destinationSnapshot.styles;
|
|
199
|
-
destinationScreenKey = destinationSnapshot.screenKey;
|
|
200
|
-
usedSnapshotDestination = true;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
130
|
+
const sourceBounds = matchedLink?.source?.bounds ?? null;
|
|
131
|
+
const destinationBounds = matchedLink?.destination?.bounds ?? null;
|
|
132
|
+
const sourceStyles = matchedLink?.source?.styles ?? null;
|
|
133
|
+
const destinationStyles = matchedLink?.destination?.styles ?? null;
|
|
134
|
+
const sourceScreenKey = matchedLink?.source?.screenKey ?? null;
|
|
135
|
+
const destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
|
|
203
136
|
|
|
204
137
|
if (!sourceBounds || !destinationBounds) {
|
|
205
138
|
debugResolverLog(
|
|
@@ -217,8 +150,6 @@ function resolveTransitionPair(
|
|
|
217
150
|
sourceScreenKey,
|
|
218
151
|
destinationScreenKey,
|
|
219
152
|
usedPending,
|
|
220
|
-
usedSnapshotSource,
|
|
221
|
-
usedSnapshotDestination,
|
|
222
153
|
};
|
|
223
154
|
}
|
|
224
155
|
|
|
@@ -48,8 +48,6 @@ export type ResolvedTransitionPair = {
|
|
|
48
48
|
sourceScreenKey: ScreenKey | null;
|
|
49
49
|
destinationScreenKey: ScreenKey | null;
|
|
50
50
|
usedPending: boolean;
|
|
51
|
-
usedSnapshotSource: boolean;
|
|
52
|
-
usedSnapshotDestination: boolean;
|
|
53
51
|
};
|
|
54
52
|
|
|
55
53
|
export type SnapshotEntry = Snapshot & {
|