react-native-screen-transitions 4.0.0-alpha.8 → 4.0.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 +6 -11
- package/lib/commonjs/components/boundary/create-boundary-component.js +5 -1
- package/lib/commonjs/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js +53 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +43 -8
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +2 -3
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/teleport.js +1 -13
- package/lib/commonjs/components/boundary/portal/teleport.js.map +1 -1
- package/lib/commonjs/components/boundary/utils/source-signals.js +6 -4
- package/lib/commonjs/components/boundary/utils/source-signals.js.map +1 -1
- package/lib/commonjs/components/overlay/helpers/get-active-overlay.js +3 -24
- package/lib/commonjs/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/commonjs/components/overlay/helpers/retain-ready-overlay-resources.js +4 -3
- package/lib/commonjs/components/overlay/helpers/retain-ready-overlay-resources.js.map +1 -1
- package/lib/commonjs/components/overlay/hooks/use-overlay-slot.js +1 -2
- package/lib/commonjs/components/overlay/hooks/use-overlay-slot.js.map +1 -1
- package/lib/commonjs/components/overlay/variations/float-overlay.js +0 -2
- package/lib/commonjs/components/overlay/variations/float-overlay.js.map +1 -1
- package/lib/commonjs/components/overlay/variations/overlay-host.js +18 -15
- package/lib/commonjs/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/commonjs/components/screen-container/layers/content.js +10 -5
- package/lib/commonjs/components/screen-container/layers/content.js.map +1 -1
- package/lib/commonjs/components/screen-container/layers/surface.js +50 -0
- package/lib/commonjs/components/screen-container/layers/surface.js.map +1 -0
- package/lib/commonjs/components/stack-view.js +7 -29
- package/lib/commonjs/components/stack-view.js.map +1 -1
- package/lib/commonjs/configs/index.js +1 -4
- package/lib/commonjs/configs/index.js.map +1 -1
- package/lib/commonjs/configs/presets.js +1 -384
- package/lib/commonjs/configs/presets.js.map +1 -1
- package/lib/commonjs/constants.js +2 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/navigators/create-blank-stack-navigator.js +7 -67
- package/lib/commonjs/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/commonjs/navigators/expo-router/index.js +1 -18
- package/lib/commonjs/navigators/expo-router/index.js.map +1 -1
- package/lib/commonjs/navigators/react-navigation/index.js +1 -3
- package/lib/commonjs/navigators/react-navigation/index.js.map +1 -1
- package/lib/commonjs/providers/screen/animation/animation.provider.js +6 -1
- package/lib/commonjs/providers/screen/animation/animation.provider.js.map +1 -1
- package/lib/commonjs/providers/screen/animation/helpers/build-screen-transition-options.js +1 -0
- package/lib/commonjs/providers/screen/animation/helpers/build-screen-transition-options.js.map +1 -1
- package/lib/commonjs/providers/screen/animation/helpers/hydrate-transition-state/gesture-progress.js +20 -5
- package/lib/commonjs/providers/screen/animation/helpers/hydrate-transition-state/gesture-progress.js.map +1 -1
- package/lib/commonjs/providers/screen/animation/helpers/hydrate-transition-state/index.js +16 -1
- package/lib/commonjs/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/commonjs/providers/screen/animation/helpers/selected-interpolator-options.js +1 -1
- package/lib/commonjs/providers/screen/animation/helpers/selected-interpolator-options.js.map +1 -1
- package/lib/commonjs/providers/screen/animation/use-screen-animation.js +1 -8
- package/lib/commonjs/providers/screen/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/pan/behavior/pan-release.js +28 -6
- package/lib/commonjs/providers/screen/gestures/pan/behavior/pan-release.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/pinch/behavior/pinch-release.js +26 -6
- package/lib/commonjs/providers/screen/gestures/pinch/behavior/pinch-release.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/shared/policy.js +1 -0
- package/lib/commonjs/providers/screen/gestures/shared/policy.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/shared/snap-points.js +71 -1
- package/lib/commonjs/providers/screen/gestures/shared/snap-points.js.map +1 -1
- package/lib/commonjs/providers/screen/options/helpers.js +8 -1
- package/lib/commonjs/providers/screen/options/helpers.js.map +1 -1
- package/lib/commonjs/providers/screen/styles/constants.js +4 -1
- package/lib/commonjs/providers/screen/styles/constants.js.map +1 -1
- package/lib/commonjs/providers/screen/styles/hooks/slot-resolvers.js +1 -9
- package/lib/commonjs/providers/screen/styles/hooks/slot-resolvers.js.map +1 -1
- package/lib/commonjs/providers/screen/styles/slot.provider.js +3 -1
- package/lib/commonjs/providers/screen/styles/slot.provider.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js +10 -4
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js +4 -3
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/state-equality.js +9 -2
- package/lib/commonjs/providers/stack/blank-stack-state/helpers/state-equality.js.map +1 -1
- package/lib/commonjs/utils/create-provider.js +14 -3
- package/lib/commonjs/utils/create-provider.js.map +1 -1
- package/lib/module/components/boundary/create-boundary-component.js +6 -2
- package/lib/module/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js +50 -0
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +44 -9
- package/lib/module/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +2 -3
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/module/components/boundary/portal/teleport.js +1 -14
- package/lib/module/components/boundary/portal/teleport.js.map +1 -1
- package/lib/module/components/boundary/utils/source-signals.js +6 -4
- package/lib/module/components/boundary/utils/source-signals.js.map +1 -1
- package/lib/module/components/overlay/helpers/get-active-overlay.js +3 -24
- package/lib/module/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/module/components/overlay/helpers/retain-ready-overlay-resources.js +4 -3
- package/lib/module/components/overlay/helpers/retain-ready-overlay-resources.js.map +1 -1
- package/lib/module/components/overlay/hooks/use-overlay-slot.js +1 -2
- package/lib/module/components/overlay/hooks/use-overlay-slot.js.map +1 -1
- package/lib/module/components/overlay/variations/float-overlay.js +0 -2
- package/lib/module/components/overlay/variations/float-overlay.js.map +1 -1
- package/lib/module/components/overlay/variations/overlay-host.js +19 -16
- package/lib/module/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/module/components/screen-container/layers/content.js +10 -5
- package/lib/module/components/screen-container/layers/content.js.map +1 -1
- package/lib/module/components/screen-container/layers/surface.js +45 -0
- package/lib/module/components/screen-container/layers/surface.js.map +1 -0
- package/lib/module/components/stack-view.js +7 -29
- package/lib/module/components/stack-view.js.map +1 -1
- package/lib/module/configs/index.js +2 -5
- package/lib/module/configs/index.js.map +1 -1
- package/lib/module/configs/presets.js +0 -380
- package/lib/module/configs/presets.js.map +1 -1
- package/lib/module/constants.js +1 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/navigators/create-blank-stack-navigator.js +7 -66
- package/lib/module/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/module/navigators/expo-router/index.js +1 -18
- package/lib/module/navigators/expo-router/index.js.map +1 -1
- package/lib/module/navigators/react-navigation/index.js +1 -3
- package/lib/module/navigators/react-navigation/index.js.map +1 -1
- package/lib/module/providers/screen/animation/animation.provider.js +4 -0
- package/lib/module/providers/screen/animation/animation.provider.js.map +1 -1
- package/lib/module/providers/screen/animation/helpers/build-screen-transition-options.js +1 -0
- package/lib/module/providers/screen/animation/helpers/build-screen-transition-options.js.map +1 -1
- package/lib/module/providers/screen/animation/helpers/hydrate-transition-state/gesture-progress.js +20 -5
- package/lib/module/providers/screen/animation/helpers/hydrate-transition-state/gesture-progress.js.map +1 -1
- package/lib/module/providers/screen/animation/helpers/hydrate-transition-state/index.js +16 -1
- package/lib/module/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/module/providers/screen/animation/helpers/selected-interpolator-options.js +1 -1
- package/lib/module/providers/screen/animation/helpers/selected-interpolator-options.js.map +1 -1
- package/lib/module/providers/screen/animation/use-screen-animation.js +2 -9
- package/lib/module/providers/screen/animation/use-screen-animation.js.map +1 -1
- package/lib/module/providers/screen/gestures/pan/behavior/pan-release.js +29 -7
- package/lib/module/providers/screen/gestures/pan/behavior/pan-release.js.map +1 -1
- package/lib/module/providers/screen/gestures/pinch/behavior/pinch-release.js +27 -7
- package/lib/module/providers/screen/gestures/pinch/behavior/pinch-release.js.map +1 -1
- package/lib/module/providers/screen/gestures/shared/policy.js +2 -1
- package/lib/module/providers/screen/gestures/shared/policy.js.map +1 -1
- package/lib/module/providers/screen/gestures/shared/snap-points.js +66 -0
- package/lib/module/providers/screen/gestures/shared/snap-points.js.map +1 -1
- package/lib/module/providers/screen/options/helpers.js +9 -2
- package/lib/module/providers/screen/options/helpers.js.map +1 -1
- package/lib/module/providers/screen/styles/constants.js +4 -1
- package/lib/module/providers/screen/styles/constants.js.map +1 -1
- package/lib/module/providers/screen/styles/hooks/slot-resolvers.js +2 -10
- package/lib/module/providers/screen/styles/hooks/slot-resolvers.js.map +1 -1
- package/lib/module/providers/screen/styles/slot.provider.js +1 -0
- package/lib/module/providers/screen/styles/slot.provider.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js +11 -5
- package/lib/module/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js +5 -4
- package/lib/module/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/state-equality.js +7 -1
- package/lib/module/providers/stack/blank-stack-state/helpers/state-equality.js.map +1 -1
- package/lib/module/types/animation.types.js +10 -0
- package/lib/module/types/animation.types.js.map +1 -1
- package/lib/module/utils/create-provider.js +14 -3
- package/lib/module/utils/create-provider.js.map +1 -1
- package/lib/typescript/components/boundary/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.d.ts +20 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/teleport.d.ts +1 -1
- package/lib/typescript/components/boundary/portal/teleport.d.ts.map +1 -1
- package/lib/typescript/components/boundary/utils/source-signals.d.ts.map +1 -1
- package/lib/typescript/components/overlay/helpers/get-active-overlay.d.ts +2 -8
- package/lib/typescript/components/overlay/helpers/get-active-overlay.d.ts.map +1 -1
- package/lib/typescript/components/overlay/helpers/retain-ready-overlay-resources.d.ts +2 -1
- package/lib/typescript/components/overlay/helpers/retain-ready-overlay-resources.d.ts.map +1 -1
- package/lib/typescript/components/overlay/hooks/use-overlay-slot.d.ts.map +1 -1
- package/lib/typescript/components/overlay/variations/float-overlay.d.ts.map +1 -1
- package/lib/typescript/components/overlay/variations/overlay-host.d.ts +2 -3
- package/lib/typescript/components/overlay/variations/overlay-host.d.ts.map +1 -1
- package/lib/typescript/components/screen-container/layers/content.d.ts.map +1 -1
- package/lib/typescript/components/screen-container/layers/surface.d.ts +7 -0
- package/lib/typescript/components/screen-container/layers/surface.d.ts.map +1 -0
- package/lib/typescript/components/stack-view.d.ts +1 -1
- package/lib/typescript/components/stack-view.d.ts.map +1 -1
- package/lib/typescript/configs/index.d.ts +0 -9
- package/lib/typescript/configs/index.d.ts.map +1 -1
- package/lib/typescript/configs/presets.d.ts +0 -9
- package/lib/typescript/configs/presets.d.ts.map +1 -1
- package/lib/typescript/constants.d.ts +2 -1
- package/lib/typescript/constants.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -10
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/navigators/create-blank-stack-navigator.d.ts +2 -4
- package/lib/typescript/navigators/create-blank-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/navigators/expo-router/index.d.ts +3 -3
- package/lib/typescript/navigators/expo-router/index.d.ts.map +1 -1
- package/lib/typescript/navigators/react-navigation/index.d.ts +1 -1
- package/lib/typescript/navigators/react-navigation/index.d.ts.map +1 -1
- package/lib/typescript/providers/screen/animation/animation.provider.d.ts +10 -1
- package/lib/typescript/providers/screen/animation/animation.provider.d.ts.map +1 -1
- package/lib/typescript/providers/screen/animation/helpers/build-screen-transition-options.d.ts.map +1 -1
- package/lib/typescript/providers/screen/animation/helpers/hydrate-transition-state/gesture-progress.d.ts +2 -1
- package/lib/typescript/providers/screen/animation/helpers/hydrate-transition-state/gesture-progress.d.ts.map +1 -1
- package/lib/typescript/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts.map +1 -1
- package/lib/typescript/providers/screen/animation/helpers/selected-interpolator-options.d.ts.map +1 -1
- package/lib/typescript/providers/screen/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/pan/behavior/pan-release.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/pinch/behavior/pinch-release.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/shared/policy.d.ts +2 -1
- package/lib/typescript/providers/screen/gestures/shared/policy.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/shared/snap-points.d.ts +11 -0
- package/lib/typescript/providers/screen/gestures/shared/snap-points.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/types.d.ts +2 -0
- package/lib/typescript/providers/screen/gestures/types.d.ts.map +1 -1
- package/lib/typescript/providers/screen/options/helpers.d.ts.map +1 -1
- package/lib/typescript/providers/screen/options/types.d.ts +1 -0
- package/lib/typescript/providers/screen/options/types.d.ts.map +1 -1
- package/lib/typescript/providers/screen/styles/constants.d.ts.map +1 -1
- package/lib/typescript/providers/screen/styles/hooks/slot-resolvers.d.ts.map +1 -1
- package/lib/typescript/providers/screen/styles/slot.provider.d.ts +11 -2
- package/lib/typescript/providers/screen/styles/slot.provider.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/build-blank-stack-state.d.ts +3 -3
- package/lib/typescript/providers/stack/blank-stack-state/helpers/build-blank-stack-state.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.d.ts +3 -2
- package/lib/typescript/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/state-equality.d.ts +4 -4
- package/lib/typescript/providers/stack/blank-stack-state/helpers/state-equality.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/helpers/types.d.ts +6 -5
- package/lib/typescript/providers/stack/blank-stack-state/helpers/types.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack.provider.d.ts +3 -1
- package/lib/typescript/providers/stack/blank-stack.provider.d.ts.map +1 -1
- package/lib/typescript/types/animation.types.d.ts +16 -12
- package/lib/typescript/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/types/blank-stack.types.d.ts +2 -23
- package/lib/typescript/types/blank-stack.types.d.ts.map +1 -1
- package/lib/typescript/types/index.d.ts +2 -2
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/types/providers/blank-stack-provider.types.d.ts +8 -6
- package/lib/typescript/types/providers/blank-stack-provider.types.d.ts.map +1 -1
- package/lib/typescript/types/screen.types.d.ts +50 -0
- package/lib/typescript/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/utils/create-provider.d.ts +4 -1
- package/lib/typescript/utils/create-provider.d.ts.map +1 -1
- package/package.json +3 -8
- package/src/components/boundary/create-boundary-component.tsx +10 -2
- package/src/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.ts +89 -0
- package/src/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +97 -14
- package/src/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +2 -6
- package/src/components/boundary/portal/teleport.ts +2 -23
- package/src/components/boundary/utils/source-signals.ts +6 -4
- package/src/components/overlay/helpers/get-active-overlay.ts +4 -36
- package/src/components/overlay/helpers/retain-ready-overlay-resources.ts +10 -1
- package/src/components/overlay/hooks/use-overlay-slot.ts +1 -5
- package/src/components/overlay/variations/float-overlay.tsx +9 -12
- package/src/components/overlay/variations/overlay-host.tsx +24 -22
- package/src/components/screen-container/layers/content.tsx +12 -7
- package/src/components/screen-container/layers/surface.tsx +65 -0
- package/src/components/stack-view.tsx +8 -39
- package/src/configs/index.ts +0 -6
- package/src/configs/presets.ts +0 -447
- package/src/constants.ts +2 -0
- package/src/index.ts +4 -1
- package/src/navigators/create-blank-stack-navigator.tsx +16 -124
- package/src/navigators/expo-router/index.tsx +0 -23
- package/src/navigators/react-navigation/index.tsx +0 -3
- package/src/providers/screen/animation/animation.provider.tsx +60 -54
- package/src/providers/screen/animation/helpers/build-screen-transition-options.ts +1 -0
- package/src/providers/screen/animation/helpers/hydrate-transition-state/gesture-progress.ts +26 -0
- package/src/providers/screen/animation/helpers/hydrate-transition-state/index.ts +20 -0
- package/src/providers/screen/animation/helpers/selected-interpolator-options.ts +1 -0
- package/src/providers/screen/animation/use-screen-animation.tsx +2 -14
- package/src/providers/screen/gestures/pan/behavior/pan-release.ts +46 -7
- package/src/providers/screen/gestures/pinch/behavior/pinch-release.ts +45 -4
- package/src/providers/screen/gestures/shared/policy.ts +4 -0
- package/src/providers/screen/gestures/shared/snap-points.ts +87 -0
- package/src/providers/screen/gestures/types.ts +2 -0
- package/src/providers/screen/options/helpers.ts +18 -0
- package/src/providers/screen/options/types.ts +1 -0
- package/src/providers/screen/styles/constants.ts +2 -1
- package/src/providers/screen/styles/hooks/slot-resolvers.tsx +2 -17
- package/src/providers/screen/styles/slot.provider.tsx +2 -1
- package/src/providers/stack/blank-stack-state/helpers/build-blank-stack-state.ts +30 -12
- package/src/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.ts +11 -3
- package/src/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.ts +2 -2
- package/src/providers/stack/blank-stack-state/helpers/state-equality.ts +27 -16
- package/src/providers/stack/blank-stack-state/helpers/types.ts +9 -4
- package/src/types/animation.types.ts +16 -13
- package/src/types/blank-stack.types.ts +1 -29
- package/src/types/index.ts +4 -1
- package/src/types/providers/blank-stack-provider.types.ts +14 -11
- package/src/types/screen.types.ts +57 -0
- package/src/utils/create-provider.tsx +22 -4
- package/lib/commonjs/components/boundary/portal/utils/teleport-control.js +0 -16
- package/lib/commonjs/components/boundary/portal/utils/teleport-control.js.map +0 -1
- package/lib/commonjs/providers/navigation/navigation-host.provider.js +0 -56
- package/lib/commonjs/providers/navigation/navigation-host.provider.js.map +0 -1
- package/lib/commonjs/providers/navigation/react-navigation-host.js +0 -23
- package/lib/commonjs/providers/navigation/react-navigation-host.js.map +0 -1
- package/lib/module/components/boundary/portal/utils/teleport-control.js +0 -11
- package/lib/module/components/boundary/portal/utils/teleport-control.js.map +0 -1
- package/lib/module/providers/navigation/navigation-host.provider.js +0 -50
- package/lib/module/providers/navigation/navigation-host.provider.js.map +0 -1
- package/lib/module/providers/navigation/react-navigation-host.js +0 -19
- package/lib/module/providers/navigation/react-navigation-host.js.map +0 -1
- package/lib/typescript/components/boundary/portal/utils/teleport-control.d.ts +0 -3
- package/lib/typescript/components/boundary/portal/utils/teleport-control.d.ts.map +0 -1
- package/lib/typescript/providers/navigation/navigation-host.provider.d.ts +0 -21
- package/lib/typescript/providers/navigation/navigation-host.provider.d.ts.map +0 -1
- package/lib/typescript/providers/navigation/react-navigation-host.d.ts +0 -3
- package/lib/typescript/providers/navigation/react-navigation-host.d.ts.map +0 -1
- package/src/components/boundary/portal/utils/teleport-control.ts +0 -13
- package/src/providers/navigation/navigation-host.provider.tsx +0 -75
- package/src/providers/navigation/react-navigation-host.tsx +0 -24
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type StackRouterOptions,
|
|
7
7
|
type StandardNavigationTypeBagBase,
|
|
8
8
|
} from "@react-navigation/native";
|
|
9
|
-
import { reactNavigationHost } from "../../providers/navigation/react-navigation-host";
|
|
10
9
|
import type {
|
|
11
10
|
BlankStackNavigationEventMap,
|
|
12
11
|
BlankStackNavigationOptions,
|
|
@@ -33,11 +32,9 @@ export const {
|
|
|
33
32
|
>(BlankStackNavigator, StackRouter, ({ state, navigation }) => ({
|
|
34
33
|
navigationState: state,
|
|
35
34
|
navigation,
|
|
36
|
-
navigationHost: reactNavigationHost,
|
|
37
35
|
}));
|
|
38
36
|
|
|
39
37
|
export type {
|
|
40
|
-
BlankStackFactoryOptions,
|
|
41
38
|
BlankStackNavigationEventMap,
|
|
42
39
|
BlankStackNavigationOptions,
|
|
43
40
|
BlankStackNavigationProp,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode, useMemo } from "react";
|
|
2
2
|
import { createBoundsAccessor } from "../../../utils/bounds";
|
|
3
3
|
import createProvider from "../../../utils/create-provider";
|
|
4
|
+
import { useBlankStackStore } from "../../stack/blank-stack.provider";
|
|
4
5
|
import { useDescriptorsStore } from "../descriptors";
|
|
5
6
|
import { useCurrentScreenRelationships } from "../use-current-screen-relationships";
|
|
6
7
|
import { useScreenAnimationPipeline } from "./helpers/pipeline";
|
|
@@ -26,63 +27,68 @@ const createScreenAnimationProvider = createProvider("ScreenAnimation", {
|
|
|
26
27
|
})<Props, ScreenAnimationContextValue>;
|
|
27
28
|
|
|
28
29
|
export const {
|
|
30
|
+
StoreProvider: ScreenAnimationStoreProvider,
|
|
29
31
|
ScreenAnimationProvider,
|
|
30
32
|
useOptionalScreenAnimationStore,
|
|
31
33
|
useScreenAnimationStore,
|
|
32
|
-
}: ReturnType<
|
|
33
|
-
createScreenAnimationProvider
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
}: ReturnType<
|
|
35
|
+
typeof createScreenAnimationProvider
|
|
36
|
+
> = createScreenAnimationProvider((_props) => {
|
|
37
|
+
const currentScreenKey = useDescriptorsStore(
|
|
38
|
+
(store) => store.derivations.currentScreenKey,
|
|
39
|
+
);
|
|
40
|
+
const isClosing = useBlankStackStore(
|
|
41
|
+
(store) => store.scenesByKey[currentScreenKey]?.activity === "closing",
|
|
42
|
+
);
|
|
43
|
+
const relationships = useCurrentScreenRelationships();
|
|
44
|
+
const pipeline = useScreenAnimationPipeline();
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return pipeline.screenInterpolatorProps.get();
|
|
48
|
-
}),
|
|
46
|
+
const screenAnimationSource = useMemo<ScreenAnimationTransitionSource>(
|
|
47
|
+
() => ({
|
|
48
|
+
screenInterpolatorProps: pipeline.screenInterpolatorProps,
|
|
49
|
+
screenInterpolatorPropsRevision: pipeline.screenInterpolatorPropsRevision,
|
|
50
|
+
boundsAccessor: createBoundsAccessor(() => {
|
|
51
|
+
"worklet";
|
|
52
|
+
return pipeline.screenInterpolatorProps.get();
|
|
49
53
|
}),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
}),
|
|
55
|
+
[
|
|
56
|
+
pipeline.screenInterpolatorProps,
|
|
57
|
+
pipeline.screenInterpolatorPropsRevision,
|
|
58
|
+
],
|
|
59
|
+
);
|
|
60
|
+
const ancestorSources =
|
|
61
|
+
useOptionalScreenAnimationStore(
|
|
62
|
+
relationships.parentScreenKey,
|
|
63
|
+
(store) => store.transitionSourcesThroughSelf,
|
|
64
|
+
) ?? EMPTY_TRANSITION_SOURCES;
|
|
65
|
+
const descendantSources =
|
|
66
|
+
useOptionalScreenAnimationStore(
|
|
67
|
+
relationships.activeChildScreenKey,
|
|
68
|
+
(store) => store.transitionSourcesFromSelf,
|
|
69
|
+
) ?? EMPTY_TRANSITION_SOURCES;
|
|
70
|
+
const transitionSourcesThroughSelf = useMemo(
|
|
71
|
+
() => [...ancestorSources, screenAnimationSource],
|
|
72
|
+
[ancestorSources, screenAnimationSource],
|
|
73
|
+
);
|
|
74
|
+
const transitionSourcesFromSelf = useMemo(
|
|
75
|
+
() => [screenAnimationSource, ...descendantSources],
|
|
76
|
+
[screenAnimationSource, descendantSources],
|
|
77
|
+
);
|
|
78
|
+
const transitionSources = useMemo(
|
|
79
|
+
() => [...transitionSourcesThroughSelf, ...descendantSources],
|
|
80
|
+
[transitionSourcesThroughSelf, descendantSources],
|
|
81
|
+
);
|
|
77
82
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
}
|
|
83
|
+
return {
|
|
84
|
+
key: currentScreenKey,
|
|
85
|
+
unregisterOnCleanup: isClosing,
|
|
86
|
+
value: {
|
|
87
|
+
...pipeline,
|
|
88
|
+
transitionSources,
|
|
89
|
+
transitionOriginIndex: ancestorSources.length,
|
|
90
|
+
transitionSourcesThroughSelf,
|
|
91
|
+
transitionSourcesFromSelf,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
});
|
|
@@ -17,6 +17,7 @@ export const buildScreenTransitionOptions = (
|
|
|
17
17
|
gestureSnapVelocityImpact: options.gestureSnapVelocityImpact,
|
|
18
18
|
gestureReleaseVelocityScale: options.gestureReleaseVelocityScale,
|
|
19
19
|
gestureSnapLocked: options.gestureSnapLocked,
|
|
20
|
+
sheetSnapBehavior: options.sheetSnapBehavior,
|
|
20
21
|
sheetScrollGestureBehavior:
|
|
21
22
|
options.sheetScrollGestureBehavior !== undefined
|
|
22
23
|
? resolveSheetScrollGestureBehavior(options)
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
GestureDirectionOption,
|
|
5
5
|
GestureValues,
|
|
6
6
|
} from "../../../../../types/gesture.types";
|
|
7
|
+
import type { SheetSnapBehavior } from "../../../../../types/screen.types";
|
|
7
8
|
import {
|
|
8
9
|
getPanActivationDirections,
|
|
9
10
|
getPanSnapAxisConfigForDirection,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
getSnapPinchDirectionConfig,
|
|
13
14
|
isResolvedPanGestureDirection,
|
|
14
15
|
} from "../../../gestures/shared/directions";
|
|
16
|
+
import { resolveStepSnapProgress } from "../../../gestures/shared/snap-points";
|
|
15
17
|
import type { SnapBounds } from "./types";
|
|
16
18
|
|
|
17
19
|
type PanProgressDelta = {
|
|
@@ -26,6 +28,8 @@ const resolvePanGestureAffectedProgress = (
|
|
|
26
28
|
gestureDirection: GestureDirectionOption,
|
|
27
29
|
hasSnapPoints: boolean,
|
|
28
30
|
snapBounds: SnapBounds | null,
|
|
31
|
+
snapPoints: number[],
|
|
32
|
+
sheetSnapBehavior: SheetSnapBehavior,
|
|
29
33
|
) => {
|
|
30
34
|
"worklet";
|
|
31
35
|
|
|
@@ -46,6 +50,13 @@ const resolvePanGestureAffectedProgress = (
|
|
|
46
50
|
const axisValue =
|
|
47
51
|
activeAxis.axis === "horizontal" ? progressDelta.x : progressDelta.y;
|
|
48
52
|
const signedProgressDelta = activeAxis.config.progressSign * axisValue;
|
|
53
|
+
if (sheetSnapBehavior === "step") {
|
|
54
|
+
return resolveStepSnapProgress({
|
|
55
|
+
baseline: transitionProgress,
|
|
56
|
+
normalizedDelta: signedProgressDelta,
|
|
57
|
+
snapPoints,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
49
60
|
|
|
50
61
|
return clamp(
|
|
51
62
|
transitionProgress + signedProgressDelta,
|
|
@@ -85,6 +96,8 @@ const resolvePinchGestureAffectedProgress = (
|
|
|
85
96
|
gestureDirection: GestureDirectionOption,
|
|
86
97
|
hasSnapPoints: boolean,
|
|
87
98
|
snapBounds: SnapBounds | null,
|
|
99
|
+
snapPoints: number[],
|
|
100
|
+
sheetSnapBehavior: SheetSnapBehavior,
|
|
88
101
|
) => {
|
|
89
102
|
"worklet";
|
|
90
103
|
const pinchDirection =
|
|
@@ -108,6 +121,13 @@ const resolvePinchGestureAffectedProgress = (
|
|
|
108
121
|
snapDirections.collapse === pinchDirection
|
|
109
122
|
? -Math.abs(gesture.normScale)
|
|
110
123
|
: Math.abs(gesture.normScale);
|
|
124
|
+
if (sheetSnapBehavior === "step") {
|
|
125
|
+
return resolveStepSnapProgress({
|
|
126
|
+
baseline: transitionProgress,
|
|
127
|
+
normalizedDelta: progressDelta,
|
|
128
|
+
snapPoints,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
111
131
|
|
|
112
132
|
return clamp(
|
|
113
133
|
transitionProgress + progressDelta,
|
|
@@ -134,6 +154,8 @@ export const resolveGestureAffectedProgress = (
|
|
|
134
154
|
panProgressDelta: PanProgressDelta,
|
|
135
155
|
gestureDirection: GestureDirectionOption | undefined,
|
|
136
156
|
snapBounds: SnapBounds | null,
|
|
157
|
+
snapPoints: number[] = [],
|
|
158
|
+
sheetSnapBehavior: SheetSnapBehavior = "continuous",
|
|
137
159
|
) => {
|
|
138
160
|
"worklet";
|
|
139
161
|
const resolvedGestureDirection =
|
|
@@ -152,6 +174,8 @@ export const resolveGestureAffectedProgress = (
|
|
|
152
174
|
resolvedGestureDirection,
|
|
153
175
|
hasSnapPoints,
|
|
154
176
|
snapBounds,
|
|
177
|
+
snapPoints,
|
|
178
|
+
sheetSnapBehavior,
|
|
155
179
|
);
|
|
156
180
|
}
|
|
157
181
|
|
|
@@ -162,5 +186,7 @@ export const resolveGestureAffectedProgress = (
|
|
|
162
186
|
resolvedGestureDirection,
|
|
163
187
|
hasSnapPoints,
|
|
164
188
|
snapBounds,
|
|
189
|
+
snapPoints,
|
|
190
|
+
sheetSnapBehavior,
|
|
165
191
|
);
|
|
166
192
|
};
|
|
@@ -35,6 +35,8 @@ const mergeTransitionOptions = (
|
|
|
35
35
|
effective.gestureReleaseVelocityScale ?? base.gestureReleaseVelocityScale;
|
|
36
36
|
slot.gestureSnapLocked =
|
|
37
37
|
effective.gestureSnapLocked ?? base.gestureSnapLocked;
|
|
38
|
+
slot.sheetSnapBehavior =
|
|
39
|
+
effective.sheetSnapBehavior ?? base.sheetSnapBehavior;
|
|
38
40
|
slot.sheetScrollGestureBehavior =
|
|
39
41
|
effective.sheetScrollGestureBehavior ?? base.sheetScrollGestureBehavior;
|
|
40
42
|
slot.backdropBehavior = effective.backdropBehavior ?? base.backdropBehavior;
|
|
@@ -56,6 +58,22 @@ export const hydrateTransitionState = (
|
|
|
56
58
|
s.optionsSlot,
|
|
57
59
|
);
|
|
58
60
|
const canDismiss = options.gestureEnabled !== false;
|
|
61
|
+
const resolvedSnapPoints = [...s.sortedNumericSnapPoints];
|
|
62
|
+
const resolvedAutoSnapPoint = s.hasAutoSnapPoint
|
|
63
|
+
? s.resolvedAutoSnapPoint.get()
|
|
64
|
+
: null;
|
|
65
|
+
if (resolvedAutoSnapPoint !== null) {
|
|
66
|
+
resolvedSnapPoints.push(resolvedAutoSnapPoint);
|
|
67
|
+
}
|
|
68
|
+
if (canDismiss) {
|
|
69
|
+
resolvedSnapPoints.push(0);
|
|
70
|
+
}
|
|
71
|
+
resolvedSnapPoints.sort((a, b) => a - b);
|
|
72
|
+
for (let index = resolvedSnapPoints.length - 1; index > 0; index--) {
|
|
73
|
+
if (resolvedSnapPoints[index] === resolvedSnapPoints[index - 1]) {
|
|
74
|
+
resolvedSnapPoints.splice(index, 1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
59
77
|
out.transitionProgress = transitionProgress;
|
|
60
78
|
out.willAnimate = s.willAnimate.get();
|
|
61
79
|
out.closing = s.closing.get();
|
|
@@ -159,6 +177,8 @@ export const hydrateTransitionState = (
|
|
|
159
177
|
s.hasAutoSnapPoint ? s.resolvedAutoSnapPoint.get() : null,
|
|
160
178
|
canDismiss,
|
|
161
179
|
),
|
|
180
|
+
resolvedSnapPoints,
|
|
181
|
+
options.sheetSnapBehavior,
|
|
162
182
|
);
|
|
163
183
|
|
|
164
184
|
if (s.visualProgress.get() !== out.progress) {
|
|
@@ -65,6 +65,7 @@ const areInterpolatorOptionsEqual = (
|
|
|
65
65
|
left.gestureSnapVelocityImpact === right.gestureSnapVelocityImpact &&
|
|
66
66
|
left.gestureReleaseVelocityScale === right.gestureReleaseVelocityScale &&
|
|
67
67
|
left.gestureSnapLocked === right.gestureSnapLocked &&
|
|
68
|
+
left.sheetSnapBehavior === right.sheetSnapBehavior &&
|
|
68
69
|
left.sheetScrollGestureBehavior === right.sheetScrollGestureBehavior &&
|
|
69
70
|
left.backdropBehavior === right.backdropBehavior
|
|
70
71
|
);
|
|
@@ -3,8 +3,7 @@ import type {
|
|
|
3
3
|
ScreenInterpolationProps,
|
|
4
4
|
ScreenTransitionTarget,
|
|
5
5
|
} from "../../../types/animation.types";
|
|
6
|
-
import {
|
|
7
|
-
import { useOptionalScreenAnimationStore } from "./animation.provider";
|
|
6
|
+
import { useScreenAnimationStore } from "./animation.provider";
|
|
8
7
|
import { useBuildTransitionAccessor } from "./helpers/accessors/use-build-transition-accessor";
|
|
9
8
|
import { readScreenAnimationRevisions } from "./helpers/read-screen-animation-revisions";
|
|
10
9
|
import type { ScreenAnimationTarget } from "./types";
|
|
@@ -23,18 +22,7 @@ export function useScreenAnimation(
|
|
|
23
22
|
):
|
|
24
23
|
| DerivedValue<ScreenInterpolationProps>
|
|
25
24
|
| DerivedValue<ScreenInterpolationProps | null> {
|
|
26
|
-
const
|
|
27
|
-
const localAnimationStore = useOptionalScreenAnimationStore();
|
|
28
|
-
const keyedAnimationStore = useOptionalScreenAnimationStore(
|
|
29
|
-
localAnimationStore ? null : routeKey,
|
|
30
|
-
);
|
|
31
|
-
const screenAnimationStore = localAnimationStore ?? keyedAnimationStore;
|
|
32
|
-
|
|
33
|
-
if (!screenAnimationStore) {
|
|
34
|
-
throw new Error(
|
|
35
|
-
`ScreenAnimationStore is unavailable for route "${routeKey}"`,
|
|
36
|
-
);
|
|
37
|
-
}
|
|
25
|
+
const screenAnimationStore = useScreenAnimationStore();
|
|
38
26
|
|
|
39
27
|
const { transitionSources } = screenAnimationStore;
|
|
40
28
|
const transition = useBuildTransitionAccessor(screenAnimationStore);
|
|
@@ -13,8 +13,12 @@ import {
|
|
|
13
13
|
resolveGestureSnapTransitionSpec,
|
|
14
14
|
} from "../../shared/release";
|
|
15
15
|
import {
|
|
16
|
+
getStepSnapProgressVelocityScale,
|
|
16
17
|
primeRuntimeSnapPoint,
|
|
17
18
|
resolveRuntimeGestureSnapPoints,
|
|
19
|
+
resolveRuntimeGestureSnapTargets,
|
|
20
|
+
resolveStepSnapProgress,
|
|
21
|
+
resolveStepSnapTargets,
|
|
18
22
|
} from "../../shared/snap-points";
|
|
19
23
|
import { determineDismissal, determineSnapTarget } from "../../shared/targets";
|
|
20
24
|
import type {
|
|
@@ -80,6 +84,8 @@ const getPanSnapReleaseProgress = ({
|
|
|
80
84
|
activeAxis,
|
|
81
85
|
minSnapPoint,
|
|
82
86
|
maxSnapPoint,
|
|
87
|
+
snapPoints,
|
|
88
|
+
sheetSnapBehavior,
|
|
83
89
|
}: {
|
|
84
90
|
runtime: PanGestureRuntime;
|
|
85
91
|
event: PanGestureEvent;
|
|
@@ -87,6 +93,8 @@ const getPanSnapReleaseProgress = ({
|
|
|
87
93
|
activeAxis: NonNullable<ReturnType<typeof resolveActivePanSnapAxis>>;
|
|
88
94
|
minSnapPoint: number;
|
|
89
95
|
maxSnapPoint: number;
|
|
96
|
+
snapPoints: number[];
|
|
97
|
+
sheetSnapBehavior: PanGestureRuntime["policy"]["sheetSnapBehavior"];
|
|
90
98
|
}) => {
|
|
91
99
|
"worklet";
|
|
92
100
|
const isHorizontal = activeAxis.axis === "horizontal";
|
|
@@ -95,9 +103,17 @@ const getPanSnapReleaseProgress = ({
|
|
|
95
103
|
: event.translationY;
|
|
96
104
|
const axisDimension = isHorizontal ? dimensions.width : dimensions.height;
|
|
97
105
|
const axisProgress = axisTranslation / Math.max(1, axisDimension);
|
|
106
|
+
const signedProgressDelta = activeAxis.config.progressSign * axisProgress;
|
|
107
|
+
if (sheetSnapBehavior === "step") {
|
|
108
|
+
return resolveStepSnapProgress({
|
|
109
|
+
baseline: runtime.stores.gestures.internal.progressBaseline.get(),
|
|
110
|
+
normalizedDelta: signedProgressDelta,
|
|
111
|
+
snapPoints,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
98
114
|
const progress =
|
|
99
115
|
runtime.stores.gestures.internal.progressBaseline.get() +
|
|
100
|
-
|
|
116
|
+
signedProgressDelta;
|
|
101
117
|
|
|
102
118
|
return clamp(progress, minSnapPoint, maxSnapPoint);
|
|
103
119
|
};
|
|
@@ -180,6 +196,24 @@ export const resolveSnapPanRelease = (
|
|
|
180
196
|
);
|
|
181
197
|
const { resolvedSnapPoints, resolvedMinSnapPoint, resolvedMaxSnapPoint } =
|
|
182
198
|
resolveRuntimeGestureSnapPoints(runtime);
|
|
199
|
+
const allSnapTargets = resolveRuntimeGestureSnapTargets(runtime);
|
|
200
|
+
const axisTranslation =
|
|
201
|
+
activeAxis.axis === "horizontal" ? event.translationX : event.translationY;
|
|
202
|
+
const progressDirection =
|
|
203
|
+
activeAxis.config.progressSign * axisTranslation || -snapVelocity;
|
|
204
|
+
const releaseSnapPoints =
|
|
205
|
+
policy.sheetSnapBehavior === "step"
|
|
206
|
+
? resolveStepSnapTargets({
|
|
207
|
+
baseline: runtime.stores.gestures.internal.progressBaseline.get(),
|
|
208
|
+
direction: progressDirection,
|
|
209
|
+
snapPoints: allSnapTargets,
|
|
210
|
+
})
|
|
211
|
+
: resolvedSnapPoints;
|
|
212
|
+
const canDismissToReleaseTarget =
|
|
213
|
+
participation.canDismiss &&
|
|
214
|
+
(policy.gestureSnapLocked ||
|
|
215
|
+
policy.sheetSnapBehavior === "continuous" ||
|
|
216
|
+
releaseSnapPoints.includes(0));
|
|
183
217
|
const currentProgress = getPanSnapReleaseProgress({
|
|
184
218
|
runtime,
|
|
185
219
|
event,
|
|
@@ -187,6 +221,8 @@ export const resolveSnapPanRelease = (
|
|
|
187
221
|
activeAxis,
|
|
188
222
|
minSnapPoint: resolvedMinSnapPoint,
|
|
189
223
|
maxSnapPoint: resolvedMaxSnapPoint,
|
|
224
|
+
snapPoints: allSnapTargets,
|
|
225
|
+
sheetSnapBehavior: policy.sheetSnapBehavior,
|
|
190
226
|
});
|
|
191
227
|
const result = determineSnapTarget({
|
|
192
228
|
currentProgress,
|
|
@@ -195,24 +231,27 @@ export const resolveSnapPanRelease = (
|
|
|
195
231
|
runtime.stores.gestures.internal.lockedSnapPoint.get() ??
|
|
196
232
|
resolvedMaxSnapPoint,
|
|
197
233
|
]
|
|
198
|
-
:
|
|
234
|
+
: releaseSnapPoints,
|
|
199
235
|
velocity: snapVelocity,
|
|
200
236
|
dimension: axisDimension,
|
|
201
237
|
velocityFactor: policy.gestureSnapVelocityImpact,
|
|
202
|
-
canDismiss:
|
|
238
|
+
canDismiss: canDismissToReleaseTarget,
|
|
203
239
|
});
|
|
204
240
|
|
|
205
241
|
const shouldDismiss = participation.canDismiss && result.shouldDismiss;
|
|
206
242
|
const target = shouldDismiss ? 0 : result.targetProgress;
|
|
243
|
+
const progressVelocityScale =
|
|
244
|
+
policy.sheetSnapBehavior === "step" && !policy.gestureSnapLocked
|
|
245
|
+
? getStepSnapProgressVelocityScale(releaseSnapPoints)
|
|
246
|
+
: 1;
|
|
207
247
|
|
|
208
248
|
return {
|
|
209
249
|
target,
|
|
210
250
|
shouldDismiss,
|
|
211
251
|
initialVelocity: getProgressVelocityTowardTarget({
|
|
212
|
-
handoffVelocity:
|
|
213
|
-
axisVelocity,
|
|
214
|
-
|
|
215
|
-
),
|
|
252
|
+
handoffVelocity:
|
|
253
|
+
getPanReleaseHandoffVelocity(axisVelocity, axisDimension) *
|
|
254
|
+
progressVelocityScale,
|
|
216
255
|
target,
|
|
217
256
|
currentProgress,
|
|
218
257
|
}),
|
|
@@ -10,8 +10,12 @@ import {
|
|
|
10
10
|
resolveGestureSnapTransitionSpec,
|
|
11
11
|
} from "../../shared/release";
|
|
12
12
|
import {
|
|
13
|
+
getStepSnapProgressVelocityScale,
|
|
13
14
|
primeRuntimeSnapPoint,
|
|
14
15
|
resolveRuntimeGestureSnapPoints,
|
|
16
|
+
resolveRuntimeGestureSnapTargets,
|
|
17
|
+
resolveStepSnapProgress,
|
|
18
|
+
resolveStepSnapTargets,
|
|
15
19
|
} from "../../shared/snap-points";
|
|
16
20
|
import { determineSnapTarget } from "../../shared/targets";
|
|
17
21
|
import type {
|
|
@@ -56,11 +60,13 @@ const getPinchSnapReleaseProgress = ({
|
|
|
56
60
|
normalizedScale,
|
|
57
61
|
minSnapPoint,
|
|
58
62
|
maxSnapPoint,
|
|
63
|
+
snapPoints,
|
|
59
64
|
}: {
|
|
60
65
|
runtime: PinchGestureRuntime;
|
|
61
66
|
normalizedScale: number;
|
|
62
67
|
minSnapPoint: number;
|
|
63
68
|
maxSnapPoint: number;
|
|
69
|
+
snapPoints: number[];
|
|
64
70
|
}) => {
|
|
65
71
|
"worklet";
|
|
66
72
|
const pinchDirection = getPinchSnapDirection(normalizedScale);
|
|
@@ -74,6 +80,13 @@ const getPinchSnapReleaseProgress = ({
|
|
|
74
80
|
snapDirections.collapse === pinchDirection
|
|
75
81
|
? -Math.abs(normalizedScale)
|
|
76
82
|
: Math.abs(normalizedScale);
|
|
83
|
+
if (runtime.policy.sheetSnapBehavior === "step") {
|
|
84
|
+
return resolveStepSnapProgress({
|
|
85
|
+
baseline: runtime.stores.gestures.internal.progressBaseline.get(),
|
|
86
|
+
normalizedDelta: progressDelta,
|
|
87
|
+
snapPoints,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
77
90
|
|
|
78
91
|
return clamp(
|
|
79
92
|
runtime.stores.gestures.internal.progressBaseline.get() + progressDelta,
|
|
@@ -141,11 +154,34 @@ export const resolveSnapPinchRelease = (
|
|
|
141
154
|
|
|
142
155
|
const { resolvedSnapPoints, resolvedMinSnapPoint, resolvedMaxSnapPoint } =
|
|
143
156
|
resolveRuntimeGestureSnapPoints(runtime);
|
|
157
|
+
const allSnapTargets = resolveRuntimeGestureSnapTargets(runtime);
|
|
158
|
+
const snapVelocity = getPinchSnapVelocity(event, runtime, normalizedScale);
|
|
159
|
+
const pinchDirection = getPinchSnapDirection(normalizedScale);
|
|
160
|
+
const progressDirection =
|
|
161
|
+
pinchDirection && policy.snapDirections
|
|
162
|
+
? policy.snapDirections.collapse === pinchDirection
|
|
163
|
+
? -1
|
|
164
|
+
: 1
|
|
165
|
+
: -snapVelocity;
|
|
166
|
+
const releaseSnapPoints =
|
|
167
|
+
policy.sheetSnapBehavior === "step"
|
|
168
|
+
? resolveStepSnapTargets({
|
|
169
|
+
baseline: runtime.stores.gestures.internal.progressBaseline.get(),
|
|
170
|
+
direction: progressDirection,
|
|
171
|
+
snapPoints: allSnapTargets,
|
|
172
|
+
})
|
|
173
|
+
: resolvedSnapPoints;
|
|
174
|
+
const canDismissToReleaseTarget =
|
|
175
|
+
participation.canDismiss &&
|
|
176
|
+
(policy.gestureSnapLocked ||
|
|
177
|
+
policy.sheetSnapBehavior === "continuous" ||
|
|
178
|
+
releaseSnapPoints.includes(0));
|
|
144
179
|
const currentProgress = getPinchSnapReleaseProgress({
|
|
145
180
|
runtime,
|
|
146
181
|
normalizedScale,
|
|
147
182
|
minSnapPoint: resolvedMinSnapPoint,
|
|
148
183
|
maxSnapPoint: resolvedMaxSnapPoint,
|
|
184
|
+
snapPoints: allSnapTargets,
|
|
149
185
|
});
|
|
150
186
|
|
|
151
187
|
const result = determineSnapTarget({
|
|
@@ -155,16 +191,21 @@ export const resolveSnapPinchRelease = (
|
|
|
155
191
|
runtime.stores.gestures.internal.lockedSnapPoint.get() ??
|
|
156
192
|
resolvedMaxSnapPoint,
|
|
157
193
|
]
|
|
158
|
-
:
|
|
159
|
-
velocity:
|
|
194
|
+
: releaseSnapPoints,
|
|
195
|
+
velocity: snapVelocity,
|
|
160
196
|
dimension: 1,
|
|
161
197
|
velocityFactor: policy.gestureSnapVelocityImpact,
|
|
162
|
-
canDismiss:
|
|
198
|
+
canDismiss: canDismissToReleaseTarget,
|
|
163
199
|
});
|
|
164
200
|
|
|
165
201
|
const shouldDismiss = participation.canDismiss && result.shouldDismiss;
|
|
166
202
|
const target = shouldDismiss ? 0 : result.targetProgress;
|
|
167
|
-
const
|
|
203
|
+
const progressVelocityScale =
|
|
204
|
+
policy.sheetSnapBehavior === "step" && !policy.gestureSnapLocked
|
|
205
|
+
? getStepSnapProgressVelocityScale(releaseSnapPoints)
|
|
206
|
+
: 1;
|
|
207
|
+
const progressVelocity =
|
|
208
|
+
getPinchReleaseHandoffVelocity(event.velocity) * progressVelocityScale;
|
|
168
209
|
const handoffVelocity = getPinchReleaseHandoffVelocity(
|
|
169
210
|
event.velocity,
|
|
170
211
|
policy.gestureReleaseVelocityScale,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
DEFAULT_GESTURE_TRACKING,
|
|
9
9
|
DEFAULT_GESTURE_VELOCITY_IMPACT,
|
|
10
10
|
DEFAULT_SHEET_SCROLL_GESTURE_BEHAVIOR,
|
|
11
|
+
DEFAULT_SHEET_SNAP_BEHAVIOR,
|
|
11
12
|
} from "../../../../constants";
|
|
12
13
|
import type {
|
|
13
14
|
GestureDirectionActivationArea,
|
|
@@ -19,6 +20,7 @@ import type {
|
|
|
19
20
|
GestureTracking,
|
|
20
21
|
ScreenTransitionConfig,
|
|
21
22
|
SheetScrollGestureBehavior,
|
|
23
|
+
SheetSnapBehavior,
|
|
22
24
|
SnapPoint,
|
|
23
25
|
} from "../../../../types/screen.types";
|
|
24
26
|
import { computeClaimedDirections } from "../ownership/compute-claimed-directions";
|
|
@@ -50,6 +52,7 @@ export type GesturePolicyOptions = {
|
|
|
50
52
|
gestureSnapLocked?: boolean;
|
|
51
53
|
gestureSnapVelocityImpact?: number;
|
|
52
54
|
gestureVelocityImpact?: number;
|
|
55
|
+
sheetSnapBehavior?: SheetSnapBehavior;
|
|
53
56
|
sheetScrollGestureBehavior?: SheetScrollGestureBehavior;
|
|
54
57
|
snapPoints?: SnapPoint[];
|
|
55
58
|
transitionSpec?: ScreenTransitionConfig["transitionSpec"];
|
|
@@ -152,6 +155,7 @@ const resolveCommonGesturePolicy = (options: GesturePolicyOptions) => {
|
|
|
152
155
|
gestureSnapVelocityImpact:
|
|
153
156
|
options.gestureSnapVelocityImpact ?? DEFAULT_GESTURE_SNAP_VELOCITY_IMPACT,
|
|
154
157
|
gestureSnapLocked: options.gestureSnapLocked ?? DEFAULT_GESTURE_SNAP_LOCKED,
|
|
158
|
+
sheetSnapBehavior: options.sheetSnapBehavior ?? DEFAULT_SHEET_SNAP_BEHAVIOR,
|
|
155
159
|
gestureReleaseVelocityScale:
|
|
156
160
|
options.gestureReleaseVelocityScale ??
|
|
157
161
|
DEFAULT_GESTURE_RELEASE_VELOCITY_SCALE,
|
|
@@ -204,6 +204,18 @@ export const resolveRuntimeGestureSnapPoints = (
|
|
|
204
204
|
});
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
export const resolveRuntimeGestureSnapTargets = (
|
|
208
|
+
runtime: GestureRuntime<GesturePolicy>,
|
|
209
|
+
): number[] => {
|
|
210
|
+
"worklet";
|
|
211
|
+
const { resolvedSnapPoints } = resolveRuntimeGestureSnapPoints(runtime);
|
|
212
|
+
const targets = runtime.participation.canDismiss
|
|
213
|
+
? [0, ...resolvedSnapPoints]
|
|
214
|
+
: resolvedSnapPoints;
|
|
215
|
+
|
|
216
|
+
return Array.from(new Set(targets)).sort((a, b) => a - b);
|
|
217
|
+
};
|
|
218
|
+
|
|
207
219
|
const findNearestSnapPoint = (
|
|
208
220
|
progress: number,
|
|
209
221
|
snapPoints: number[],
|
|
@@ -226,6 +238,81 @@ const findNearestSnapPoint = (
|
|
|
226
238
|
return nearest;
|
|
227
239
|
};
|
|
228
240
|
|
|
241
|
+
const findNearestSnapPointIndex = (
|
|
242
|
+
progress: number,
|
|
243
|
+
snapPoints: number[],
|
|
244
|
+
): number => {
|
|
245
|
+
"worklet";
|
|
246
|
+
let nearestIndex = 0;
|
|
247
|
+
let smallestDistance = Math.abs(progress - (snapPoints[0] ?? progress));
|
|
248
|
+
|
|
249
|
+
for (let i = 1; i < snapPoints.length; i++) {
|
|
250
|
+
const distance = Math.abs(progress - snapPoints[i]);
|
|
251
|
+
if (distance < smallestDistance) {
|
|
252
|
+
smallestDistance = distance;
|
|
253
|
+
nearestIndex = i;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return nearestIndex;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
interface ResolveStepSnapProps {
|
|
261
|
+
baseline: number;
|
|
262
|
+
direction: number;
|
|
263
|
+
snapPoints: number[];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export const resolveStepSnapTargets = ({
|
|
267
|
+
baseline,
|
|
268
|
+
direction,
|
|
269
|
+
snapPoints,
|
|
270
|
+
}: ResolveStepSnapProps): number[] => {
|
|
271
|
+
"worklet";
|
|
272
|
+
if (snapPoints.length === 0) {
|
|
273
|
+
return [baseline];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const baselineIndex = findNearestSnapPointIndex(baseline, snapPoints);
|
|
277
|
+
const start = snapPoints[baselineIndex] ?? baseline;
|
|
278
|
+
const adjacentIndex = baselineIndex + Math.sign(direction);
|
|
279
|
+
const adjacent = snapPoints[adjacentIndex];
|
|
280
|
+
|
|
281
|
+
if (direction === 0 || adjacent === undefined) {
|
|
282
|
+
return [start];
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return direction < 0 ? [adjacent, start] : [start, adjacent];
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export const resolveStepSnapProgress = ({
|
|
289
|
+
baseline,
|
|
290
|
+
normalizedDelta,
|
|
291
|
+
snapPoints,
|
|
292
|
+
}: Omit<ResolveStepSnapProps, "direction"> & {
|
|
293
|
+
normalizedDelta: number;
|
|
294
|
+
}): number => {
|
|
295
|
+
"worklet";
|
|
296
|
+
const targets = resolveStepSnapTargets({
|
|
297
|
+
baseline,
|
|
298
|
+
direction: normalizedDelta,
|
|
299
|
+
snapPoints,
|
|
300
|
+
});
|
|
301
|
+
const target = normalizedDelta < 0 ? targets[0] : targets[targets.length - 1];
|
|
302
|
+
const localProgress = Math.min(1, Math.abs(normalizedDelta));
|
|
303
|
+
|
|
304
|
+
return baseline + (target - baseline) * localProgress;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
export const getStepSnapProgressVelocityScale = (targets: number[]): number => {
|
|
308
|
+
"worklet";
|
|
309
|
+
if (targets.length < 2) {
|
|
310
|
+
return 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return Math.abs(targets[targets.length - 1] - targets[0]);
|
|
314
|
+
};
|
|
315
|
+
|
|
229
316
|
export const primeRuntimeSnapPoint = (
|
|
230
317
|
runtime: GestureRuntime<GesturePolicy>,
|
|
231
318
|
) => {
|