react-native-screen-transitions 3.0.0-beta.1 → 3.0.0-beta.11
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 +60 -5
- package/lib/commonjs/blank-stack/components/Overlay.js +20 -6
- package/lib/commonjs/blank-stack/components/Overlay.js.map +1 -1
- package/lib/commonjs/blank-stack/components/Screens.js +5 -5
- package/lib/commonjs/blank-stack/components/Screens.js.map +1 -1
- package/lib/commonjs/blank-stack/components/StackView.js +14 -8
- package/lib/commonjs/blank-stack/components/StackView.js.map +1 -1
- package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js +5 -9
- package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js.map +1 -1
- package/lib/commonjs/blank-stack/index.js +7 -0
- package/lib/commonjs/blank-stack/index.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.native.js +4 -3
- package/lib/commonjs/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/commonjs/shared/components/controllers/screen-lifecycle.js +25 -11
- package/lib/commonjs/shared/components/controllers/screen-lifecycle.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js +11 -14
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/root-transition-aware.js +1 -1
- package/lib/commonjs/shared/components/root-transition-aware.js.map +1 -1
- package/lib/commonjs/shared/configs/presets.js +20 -9
- package/lib/commonjs/shared/configs/presets.js.map +1 -1
- package/lib/commonjs/shared/constants.js +0 -1
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js +9 -10
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js +10 -25
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +48 -36
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-parent-gesture-registry.js +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js +1 -1
- package/lib/commonjs/shared/hooks/reanimated/use-shared-value-state.js.map +1 -0
- package/lib/commonjs/shared/hooks/use-stable-callback-value.js +7 -1
- package/lib/commonjs/shared/hooks/use-stable-callback-value.js.map +1 -1
- package/lib/commonjs/shared/hooks/use-stable-callback.js.map +1 -1
- package/lib/commonjs/shared/providers/{gestures.js → gestures.provider.js} +7 -4
- package/lib/commonjs/shared/providers/gestures.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/{keys.js → keys.provider.js} +1 -1
- package/lib/commonjs/shared/providers/keys.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/register-bounds.provider.js +207 -0
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/{screen-transition-provider.js → screen-transition.provider.js} +4 -4
- package/lib/commonjs/shared/providers/{screen-transition-provider.js.map → screen-transition.provider.js.map} +1 -1
- package/lib/commonjs/shared/providers/{transition-styles.js → transition-styles.provider.js} +7 -9
- package/lib/commonjs/shared/providers/transition-styles.provider.js.map +1 -0
- package/lib/commonjs/shared/stores/{animation-store.js → animation.store.js} +13 -4
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -0
- package/lib/commonjs/shared/stores/bounds.store.js +141 -0
- package/lib/commonjs/shared/stores/bounds.store.js.map +1 -0
- package/lib/commonjs/shared/stores/{gesture-store.js → gesture.store.js} +11 -1
- package/lib/commonjs/shared/stores/gesture.store.js.map +1 -0
- package/lib/commonjs/shared/types/{core.js → animation.types.js} +1 -1
- package/lib/commonjs/shared/types/animation.types.js.map +1 -0
- package/lib/commonjs/shared/types/{bounds.js → bounds.types.js} +1 -1
- package/lib/commonjs/shared/types/bounds.types.js.map +1 -0
- package/lib/commonjs/shared/types/{animation.js → core.types.js} +1 -1
- package/lib/commonjs/shared/types/{animation.js.map → core.types.js.map} +1 -1
- package/lib/commonjs/shared/types/{gesture.js → gesture.types.js} +1 -1
- package/lib/commonjs/shared/types/gesture.types.js.map +1 -0
- package/lib/commonjs/shared/types/utils.types.js +2 -0
- package/lib/commonjs/shared/types/{core.js.map → utils.types.js.map} +1 -1
- package/lib/commonjs/shared/utils/animation/derivations.js +1 -7
- package/lib/commonjs/shared/utils/animation/derivations.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/geometry.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/is-bounds-equal.js +19 -0
- package/lib/commonjs/shared/utils/bounds/helpers/is-bounds-equal.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/index.js +45 -35
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/types/builder.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/{_types/builder.js.map → types/geometry.js.map} +1 -1
- package/lib/commonjs/shared/utils/create-provider.js +51 -0
- package/lib/commonjs/shared/utils/create-provider.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/apply-offset-rules.js +1 -1
- package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js +1 -1
- package/lib/commonjs/shared/utils/reset-stores-for-screen.js +17 -0
- package/lib/commonjs/shared/utils/reset-stores-for-screen.js.map +1 -0
- package/lib/module/blank-stack/components/Overlay.js +20 -6
- package/lib/module/blank-stack/components/Overlay.js.map +1 -1
- package/lib/module/blank-stack/components/Screens.js +4 -4
- package/lib/module/blank-stack/components/Screens.js.map +1 -1
- package/lib/module/blank-stack/components/StackView.js +12 -7
- package/lib/module/blank-stack/components/StackView.js.map +1 -1
- package/lib/module/blank-stack/hooks/use-overlay-animation.js +5 -9
- package/lib/module/blank-stack/hooks/use-overlay-animation.js.map +1 -1
- package/lib/module/blank-stack/index.js +1 -0
- package/lib/module/blank-stack/index.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.native.js +3 -2
- package/lib/module/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/module/shared/components/controllers/screen-lifecycle.js +24 -10
- package/lib/module/shared/components/controllers/screen-lifecycle.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js +11 -14
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/root-transition-aware.js +1 -1
- package/lib/module/shared/components/root-transition-aware.js.map +1 -1
- package/lib/module/shared/configs/presets.js +20 -9
- package/lib/module/shared/configs/presets.js.map +1 -1
- package/lib/module/shared/constants.js +0 -1
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-associated-style.js +9 -10
- package/lib/module/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-screen-animation.js +7 -22
- package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js +46 -34
- package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-parent-gesture-registry.js +1 -1
- package/lib/module/shared/hooks/gestures/use-parent-gesture-registry.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js +1 -1
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/module/shared/hooks/reanimated/use-shared-value-state.js.map +1 -0
- package/lib/module/shared/hooks/use-stable-callback-value.js +8 -2
- package/lib/module/shared/hooks/use-stable-callback-value.js.map +1 -1
- package/lib/module/shared/hooks/use-stable-callback.js.map +1 -1
- package/lib/module/shared/providers/{gestures.js → gestures.provider.js} +7 -4
- package/lib/module/shared/providers/gestures.provider.js.map +1 -0
- package/lib/module/shared/providers/{keys.js → keys.provider.js} +1 -1
- package/lib/module/shared/providers/keys.provider.js.map +1 -0
- package/lib/module/shared/providers/register-bounds.provider.js +202 -0
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -0
- package/lib/module/shared/providers/{screen-transition-provider.js → screen-transition.provider.js} +4 -4
- package/lib/module/shared/providers/{screen-transition-provider.js.map → screen-transition.provider.js.map} +1 -1
- package/lib/module/shared/providers/{transition-styles.js → transition-styles.provider.js} +6 -9
- package/lib/module/shared/providers/transition-styles.provider.js.map +1 -0
- package/lib/module/shared/stores/animation.store.js +44 -0
- package/lib/module/shared/stores/animation.store.js.map +1 -0
- package/lib/module/shared/stores/bounds.store.js +137 -0
- package/lib/module/shared/stores/bounds.store.js.map +1 -0
- package/lib/module/shared/stores/{gesture-store.js → gesture.store.js} +12 -2
- package/lib/module/shared/stores/gesture.store.js.map +1 -0
- package/lib/module/shared/types/animation.types.js +4 -0
- package/lib/module/shared/types/animation.types.js.map +1 -0
- package/lib/module/shared/types/bounds.types.js +4 -0
- package/lib/module/shared/types/bounds.types.js.map +1 -0
- package/lib/module/shared/types/core.types.js +4 -0
- package/lib/{commonjs/shared/types/bounds.js.map → module/shared/types/core.types.js.map} +1 -1
- package/lib/module/shared/types/{gesture.js → gesture.types.js} +1 -1
- package/lib/module/shared/types/gesture.types.js.map +1 -0
- package/lib/module/shared/types/utils.types.js +2 -0
- package/lib/{commonjs/shared/types/utils.js.map → module/shared/types/utils.types.js.map} +1 -1
- package/lib/module/shared/utils/animation/derivations.js +1 -7
- package/lib/module/shared/utils/animation/derivations.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/geometry.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/is-bounds-equal.js +14 -0
- package/lib/module/shared/utils/bounds/helpers/is-bounds-equal.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/styles.js.map +1 -0
- package/lib/module/shared/utils/bounds/index.js +45 -35
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/types/builder.js.map +1 -0
- package/lib/module/shared/utils/bounds/{_types/builder.js.map → types/geometry.js.map} +1 -1
- package/lib/module/shared/utils/create-provider.js +46 -0
- package/lib/module/shared/utils/create-provider.js.map +1 -0
- package/lib/module/shared/utils/gesture/apply-offset-rules.js +1 -1
- package/lib/module/shared/utils/gesture/apply-offset-rules.js.map +1 -1
- package/lib/module/shared/utils/gesture/check-gesture-activation.js +1 -1
- package/lib/module/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/module/shared/utils/reset-stores-for-screen.js +13 -0
- package/lib/module/shared/utils/reset-stores-for-screen.js.map +1 -0
- package/lib/typescript/blank-stack/components/Overlay.d.ts.map +1 -1
- package/lib/typescript/blank-stack/components/Screens.d.ts +2 -3
- package/lib/typescript/blank-stack/components/Screens.d.ts.map +1 -1
- package/lib/typescript/blank-stack/components/StackView.d.ts.map +1 -1
- package/lib/typescript/blank-stack/hooks/use-overlay-animation.d.ts +1 -1
- package/lib/typescript/blank-stack/hooks/use-overlay-animation.d.ts.map +1 -1
- package/lib/typescript/blank-stack/index.d.ts +1 -0
- package/lib/typescript/blank-stack/index.d.ts.map +1 -1
- package/lib/typescript/blank-stack/types.d.ts +6 -2
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +1 -1
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/shared/components/controllers/screen-lifecycle.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/configs/index.d.ts +15 -9
- package/lib/typescript/shared/configs/index.d.ts.map +1 -1
- package/lib/typescript/shared/configs/presets.d.ts +10 -4
- package/lib/typescript/shared/configs/presets.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +6 -6
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts +2 -2
- package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts +5 -2
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/reanimated/use-shared-value-state.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/use-stable-callback-value.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/use-stable-callback.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +25 -18
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/{gestures.d.ts → gestures.provider.d.ts} +5 -3
- package/lib/typescript/shared/providers/gestures.provider.d.ts.map +1 -0
- package/lib/typescript/shared/providers/{keys.d.ts → keys.provider.d.ts} +2 -2
- package/lib/typescript/shared/providers/keys.provider.d.ts.map +1 -0
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts +17 -0
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -0
- package/lib/typescript/shared/providers/{screen-transition-provider.d.ts → screen-transition.provider.d.ts} +2 -2
- package/lib/typescript/shared/providers/{screen-transition-provider.d.ts.map → screen-transition.provider.d.ts.map} +1 -1
- package/lib/typescript/shared/providers/transition-styles.provider.d.ts +14 -0
- package/lib/typescript/shared/providers/transition-styles.provider.d.ts.map +1 -0
- package/lib/typescript/shared/stores/{animation-store.d.ts → animation.store.d.ts} +6 -4
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -0
- package/lib/typescript/shared/stores/bounds.store.d.ts +29 -0
- package/lib/typescript/shared/stores/bounds.store.d.ts.map +1 -0
- package/lib/typescript/shared/stores/{gesture-store.d.ts → gesture.store.d.ts} +3 -3
- package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -0
- package/lib/typescript/shared/types/{animation.d.ts → animation.types.d.ts} +48 -20
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -0
- package/lib/typescript/shared/types/{bounds.d.ts → bounds.types.d.ts} +4 -4
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -0
- package/lib/typescript/shared/types/{core.d.ts → core.types.d.ts} +3 -3
- package/lib/typescript/shared/types/core.types.d.ts.map +1 -0
- package/lib/typescript/shared/types/{gesture.d.ts → gesture.types.d.ts} +1 -1
- package/lib/typescript/shared/types/gesture.types.d.ts.map +1 -0
- package/lib/typescript/shared/types/{utils.d.ts → utils.types.d.ts} +1 -1
- package/lib/typescript/shared/types/utils.types.d.ts.map +1 -0
- package/lib/typescript/shared/utils/animation/derivations.d.ts +2 -4
- package/lib/typescript/shared/utils/animation/derivations.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/start-screen-transition.d.ts +2 -2
- package/lib/typescript/shared/utils/animation/start-screen-transition.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/constants.d.ts +3 -3
- package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/{_utils → helpers}/geometry.d.ts +3 -3
- package/lib/typescript/shared/utils/bounds/helpers/geometry.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/is-bounds-equal.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/{_utils → helpers}/style-composers.d.ts +2 -2
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/{_utils → helpers}/styles.d.ts +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/index.d.ts +3 -4
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/{_types → types}/builder.d.ts +13 -34
- package/lib/typescript/shared/utils/bounds/types/builder.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/types/geometry.d.ts.map +1 -0
- package/lib/typescript/shared/utils/create-provider.d.ts +14 -0
- package/lib/typescript/shared/utils/create-provider.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/apply-offset-rules.d.ts +2 -2
- package/lib/typescript/shared/utils/gesture/apply-offset-rules.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts +2 -2
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/reset-gesture-values.d.ts +2 -2
- package/lib/typescript/shared/utils/gesture/reset-gesture-values.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/velocity.d.ts +1 -1
- package/lib/typescript/shared/utils/reset-stores-for-screen.d.ts +6 -0
- package/lib/typescript/shared/utils/reset-stores-for-screen.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/blank-stack/components/Overlay.tsx +25 -5
- package/src/blank-stack/components/Screens.tsx +6 -6
- package/src/blank-stack/components/StackView.tsx +11 -5
- package/src/blank-stack/hooks/use-overlay-animation.tsx +6 -21
- package/src/blank-stack/index.ts +1 -0
- package/src/blank-stack/types.ts +6 -2
- package/src/native-stack/types.ts +1 -1
- package/src/native-stack/views/NativeStackView.native.tsx +4 -2
- package/src/shared/components/controllers/screen-lifecycle.tsx +26 -11
- package/src/shared/components/create-transition-aware-component.tsx +23 -27
- package/src/shared/components/root-transition-aware.tsx +1 -1
- package/src/shared/configs/presets.ts +31 -17
- package/src/shared/constants.ts +6 -7
- package/src/shared/hooks/animation/use-associated-style.tsx +8 -9
- package/src/shared/hooks/animation/use-screen-animation.tsx +8 -26
- package/src/shared/hooks/gestures/use-build-gestures.tsx +66 -38
- package/src/shared/hooks/gestures/use-parent-gesture-registry.tsx +1 -1
- package/src/shared/hooks/gestures/use-scroll-registry.tsx +2 -2
- package/src/shared/hooks/{use-stable-callback-value.tsx → use-stable-callback-value.ts} +10 -1
- package/src/shared/index.ts +4 -1
- package/src/shared/providers/{gestures.tsx → gestures.provider.tsx} +17 -8
- package/src/shared/providers/{keys.tsx → keys.provider.tsx} +1 -1
- package/src/shared/providers/register-bounds.provider.tsx +284 -0
- package/src/shared/providers/{screen-transition-provider.tsx → screen-transition.provider.tsx} +3 -3
- package/src/shared/providers/{transition-styles.tsx → transition-styles.provider.tsx} +13 -14
- package/src/shared/stores/{animation-store.ts → animation.store.ts} +20 -4
- package/src/shared/stores/bounds.store.ts +166 -0
- package/src/shared/stores/{gesture-store.ts → gesture.store.ts} +17 -3
- package/src/shared/types/{animation.ts → animation.types.ts} +60 -19
- package/src/shared/types/{bounds.ts → bounds.types.ts} +3 -3
- package/src/shared/types/{core.ts → core.types.ts} +10 -2
- package/src/shared/utils/animation/derivations.ts +2 -8
- package/src/shared/utils/animation/start-screen-transition.ts +2 -2
- package/src/shared/utils/bounds/constants.ts +3 -3
- package/src/shared/utils/bounds/{_utils → helpers}/geometry.ts +3 -3
- package/src/shared/utils/bounds/{_utils → helpers}/is-bounds-equal.ts +3 -3
- package/src/shared/utils/bounds/{_utils → helpers}/style-composers.ts +2 -2
- package/src/shared/utils/bounds/{_utils → helpers}/styles.ts +1 -1
- package/src/shared/utils/bounds/index.ts +53 -55
- package/src/shared/utils/bounds/{_types → types}/builder.ts +19 -37
- package/src/shared/utils/create-provider.tsx +71 -0
- package/src/shared/utils/gesture/apply-offset-rules.ts +2 -2
- package/src/shared/utils/gesture/check-gesture-activation.ts +2 -2
- package/src/shared/utils/gesture/reset-gesture-values.ts +2 -2
- package/src/shared/utils/gesture/velocity.ts +1 -1
- package/src/shared/utils/reset-stores-for-screen.ts +11 -0
- package/lib/commonjs/shared/hooks/bounds/use-bound-registry.js +0 -131
- package/lib/commonjs/shared/hooks/bounds/use-bound-registry.js.map +0 -1
- package/lib/commonjs/shared/hooks/use-shared-value-state.js.map +0 -1
- package/lib/commonjs/shared/providers/gestures.js.map +0 -1
- package/lib/commonjs/shared/providers/keys.js.map +0 -1
- package/lib/commonjs/shared/providers/transition-styles.js.map +0 -1
- package/lib/commonjs/shared/providers/utils/create-provider.js +0 -39
- package/lib/commonjs/shared/providers/utils/create-provider.js.map +0 -1
- package/lib/commonjs/shared/stores/animation-store.js.map +0 -1
- package/lib/commonjs/shared/stores/bound-store/_utils.js +0 -118
- package/lib/commonjs/shared/stores/bound-store/_utils.js.map +0 -1
- package/lib/commonjs/shared/stores/bound-store/index.js +0 -116
- package/lib/commonjs/shared/stores/bound-store/index.js.map +0 -1
- package/lib/commonjs/shared/stores/gesture-store.js.map +0 -1
- package/lib/commonjs/shared/stores/navigator-dismiss-state.js +0 -23
- package/lib/commonjs/shared/stores/navigator-dismiss-state.js.map +0 -1
- package/lib/commonjs/shared/stores/utils/reset-stores-for-screen.js +0 -19
- package/lib/commonjs/shared/stores/utils/reset-stores-for-screen.js.map +0 -1
- package/lib/commonjs/shared/types/gesture.js.map +0 -1
- package/lib/commonjs/shared/types/utils.js +0 -2
- package/lib/commonjs/shared/utils/bounds/_types/geometry.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/_types/get-bounds.js +0 -6
- package/lib/commonjs/shared/utils/bounds/_types/get-bounds.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/_utils/flatten-styles.js +0 -27
- package/lib/commonjs/shared/utils/bounds/_utils/flatten-styles.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/_utils/geometry.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/_utils/get-bounds.js +0 -49
- package/lib/commonjs/shared/utils/bounds/_utils/get-bounds.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/_utils/is-bounds-equal.js +0 -19
- package/lib/commonjs/shared/utils/bounds/_utils/is-bounds-equal.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/_utils/style-composers.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/_utils/styles.js.map +0 -1
- package/lib/module/shared/hooks/bounds/use-bound-registry.js +0 -125
- package/lib/module/shared/hooks/bounds/use-bound-registry.js.map +0 -1
- package/lib/module/shared/hooks/use-shared-value-state.js.map +0 -1
- package/lib/module/shared/providers/gestures.js.map +0 -1
- package/lib/module/shared/providers/keys.js.map +0 -1
- package/lib/module/shared/providers/transition-styles.js.map +0 -1
- package/lib/module/shared/providers/utils/create-provider.js +0 -33
- package/lib/module/shared/providers/utils/create-provider.js.map +0 -1
- package/lib/module/shared/stores/animation-store.js +0 -33
- package/lib/module/shared/stores/animation-store.js.map +0 -1
- package/lib/module/shared/stores/bound-store/_utils.js +0 -113
- package/lib/module/shared/stores/bound-store/_utils.js.map +0 -1
- package/lib/module/shared/stores/bound-store/index.js +0 -112
- package/lib/module/shared/stores/bound-store/index.js.map +0 -1
- package/lib/module/shared/stores/gesture-store.js.map +0 -1
- package/lib/module/shared/stores/navigator-dismiss-state.js +0 -19
- package/lib/module/shared/stores/navigator-dismiss-state.js.map +0 -1
- package/lib/module/shared/stores/utils/reset-stores-for-screen.js +0 -15
- package/lib/module/shared/stores/utils/reset-stores-for-screen.js.map +0 -1
- package/lib/module/shared/types/animation.js +0 -4
- package/lib/module/shared/types/animation.js.map +0 -1
- package/lib/module/shared/types/bounds.js +0 -4
- package/lib/module/shared/types/bounds.js.map +0 -1
- package/lib/module/shared/types/core.js +0 -4
- package/lib/module/shared/types/core.js.map +0 -1
- package/lib/module/shared/types/gesture.js.map +0 -1
- package/lib/module/shared/types/utils.js +0 -2
- package/lib/module/shared/types/utils.js.map +0 -1
- package/lib/module/shared/utils/bounds/_types/geometry.js.map +0 -1
- package/lib/module/shared/utils/bounds/_types/get-bounds.js +0 -4
- package/lib/module/shared/utils/bounds/_types/get-bounds.js.map +0 -1
- package/lib/module/shared/utils/bounds/_utils/flatten-styles.js +0 -23
- package/lib/module/shared/utils/bounds/_utils/flatten-styles.js.map +0 -1
- package/lib/module/shared/utils/bounds/_utils/geometry.js.map +0 -1
- package/lib/module/shared/utils/bounds/_utils/get-bounds.js +0 -44
- package/lib/module/shared/utils/bounds/_utils/get-bounds.js.map +0 -1
- package/lib/module/shared/utils/bounds/_utils/is-bounds-equal.js +0 -14
- package/lib/module/shared/utils/bounds/_utils/is-bounds-equal.js.map +0 -1
- package/lib/module/shared/utils/bounds/_utils/style-composers.js.map +0 -1
- package/lib/module/shared/utils/bounds/_utils/styles.js.map +0 -1
- package/lib/typescript/shared/hooks/bounds/use-bound-registry.d.ts +0 -17
- package/lib/typescript/shared/hooks/bounds/use-bound-registry.d.ts.map +0 -1
- package/lib/typescript/shared/hooks/use-shared-value-state.d.ts.map +0 -1
- package/lib/typescript/shared/providers/gestures.d.ts.map +0 -1
- package/lib/typescript/shared/providers/keys.d.ts.map +0 -1
- package/lib/typescript/shared/providers/transition-styles.d.ts +0 -11
- package/lib/typescript/shared/providers/transition-styles.d.ts.map +0 -1
- package/lib/typescript/shared/providers/utils/create-provider.d.ts +0 -32
- package/lib/typescript/shared/providers/utils/create-provider.d.ts.map +0 -1
- package/lib/typescript/shared/stores/animation-store.d.ts.map +0 -1
- package/lib/typescript/shared/stores/bound-store/_utils.d.ts +0 -24
- package/lib/typescript/shared/stores/bound-store/_utils.d.ts.map +0 -1
- package/lib/typescript/shared/stores/bound-store/index.d.ts +0 -22
- package/lib/typescript/shared/stores/bound-store/index.d.ts.map +0 -1
- package/lib/typescript/shared/stores/gesture-store.d.ts.map +0 -1
- package/lib/typescript/shared/stores/navigator-dismiss-state.d.ts +0 -7
- package/lib/typescript/shared/stores/navigator-dismiss-state.d.ts.map +0 -1
- package/lib/typescript/shared/stores/utils/reset-stores-for-screen.d.ts +0 -6
- package/lib/typescript/shared/stores/utils/reset-stores-for-screen.d.ts.map +0 -1
- package/lib/typescript/shared/types/animation.d.ts.map +0 -1
- package/lib/typescript/shared/types/bounds.d.ts.map +0 -1
- package/lib/typescript/shared/types/core.d.ts.map +0 -1
- package/lib/typescript/shared/types/gesture.d.ts.map +0 -1
- package/lib/typescript/shared/types/utils.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_types/builder.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_types/geometry.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_types/get-bounds.d.ts +0 -10
- package/lib/typescript/shared/utils/bounds/_types/get-bounds.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_utils/flatten-styles.d.ts +0 -2
- package/lib/typescript/shared/utils/bounds/_utils/flatten-styles.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_utils/geometry.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_utils/get-bounds.d.ts +0 -4
- package/lib/typescript/shared/utils/bounds/_utils/get-bounds.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_utils/is-bounds-equal.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_utils/style-composers.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/_utils/styles.d.ts.map +0 -1
- package/src/shared/hooks/bounds/use-bound-registry.tsx +0 -153
- package/src/shared/providers/utils/create-provider.ts +0 -64
- package/src/shared/stores/bound-store/_utils.ts +0 -161
- package/src/shared/stores/bound-store/index.ts +0 -125
- package/src/shared/stores/navigator-dismiss-state.ts +0 -17
- package/src/shared/stores/utils/reset-stores-for-screen.ts +0 -13
- package/src/shared/utils/bounds/_types/get-bounds.ts +0 -10
- package/src/shared/utils/bounds/_utils/flatten-styles.ts +0 -21
- package/src/shared/utils/bounds/_utils/get-bounds.ts +0 -54
- /package/lib/commonjs/shared/hooks/{use-shared-value-state.js → reanimated/use-shared-value-state.js} +0 -0
- /package/lib/commonjs/shared/utils/bounds/{_utils → helpers}/geometry.js +0 -0
- /package/lib/commonjs/shared/utils/bounds/{_utils → helpers}/style-composers.js +0 -0
- /package/lib/commonjs/shared/utils/bounds/{_utils → helpers}/styles.js +0 -0
- /package/lib/commonjs/shared/utils/bounds/{_types → types}/builder.js +0 -0
- /package/lib/commonjs/shared/utils/bounds/{_types → types}/geometry.js +0 -0
- /package/lib/module/shared/hooks/{use-shared-value-state.js → reanimated/use-shared-value-state.js} +0 -0
- /package/lib/module/shared/utils/bounds/{_utils → helpers}/geometry.js +0 -0
- /package/lib/module/shared/utils/bounds/{_utils → helpers}/style-composers.js +0 -0
- /package/lib/module/shared/utils/bounds/{_utils → helpers}/styles.js +0 -0
- /package/lib/module/shared/utils/bounds/{_types → types}/builder.js +0 -0
- /package/lib/module/shared/utils/bounds/{_types → types}/geometry.js +0 -0
- /package/lib/typescript/shared/hooks/{use-shared-value-state.d.ts → reanimated/use-shared-value-state.d.ts} +0 -0
- /package/lib/typescript/shared/utils/bounds/{_utils → helpers}/is-bounds-equal.d.ts +0 -0
- /package/lib/typescript/shared/utils/bounds/{_types → types}/geometry.d.ts +0 -0
- /package/src/shared/hooks/{use-shared-value-state.ts → reanimated/use-shared-value-state.ts} +0 -0
- /package/src/shared/hooks/{use-stable-callback.tsx → use-stable-callback.ts} +0 -0
- /package/src/shared/types/{gesture.ts → gesture.types.ts} +0 -0
- /package/src/shared/types/{utils.ts → utils.types.ts} +0 -0
- /package/src/shared/utils/bounds/{_types → types}/geometry.ts +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useSharedValue,
|
|
6
6
|
} from "react-native-reanimated";
|
|
7
7
|
import { NO_STYLES } from "../../constants";
|
|
8
|
-
import { useTransitionStyles } from "../../providers/transition-styles";
|
|
8
|
+
import { useTransitionStyles } from "../../providers/transition-styles.provider";
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
11
11
|
id?: string;
|
|
@@ -16,14 +16,12 @@ type Props = {
|
|
|
16
16
|
* This hook is used to get the associated styles for a given styleId / boundTag.
|
|
17
17
|
*/
|
|
18
18
|
export const useAssociatedStyles = ({ id }: Props = {}) => {
|
|
19
|
-
const { stylesMap } = useTransitionStyles();
|
|
19
|
+
const { stylesMap, parentStylesMap } = useTransitionStyles();
|
|
20
20
|
const showAfterFirstFrame = useSharedValue(false);
|
|
21
21
|
|
|
22
22
|
useDerivedValue(() => {
|
|
23
23
|
"worklet";
|
|
24
24
|
|
|
25
|
-
// If the associated styles have already been shown, return.
|
|
26
|
-
|
|
27
25
|
if (!id) {
|
|
28
26
|
showAfterFirstFrame.value = true;
|
|
29
27
|
return;
|
|
@@ -39,10 +37,14 @@ export const useAssociatedStyles = ({ id }: Props = {}) => {
|
|
|
39
37
|
const associatedStyles = useAnimatedStyle(() => {
|
|
40
38
|
"worklet";
|
|
41
39
|
|
|
42
|
-
if (!id
|
|
40
|
+
if (!id) {
|
|
43
41
|
return NO_STYLES;
|
|
44
42
|
}
|
|
45
|
-
|
|
43
|
+
|
|
44
|
+
// Check local styles first, then fall back to parent
|
|
45
|
+
const localStyles = stylesMap?.value[id];
|
|
46
|
+
const parentStyles = parentStylesMap?.value[id];
|
|
47
|
+
const base = localStyles || parentStyles || NO_STYLES;
|
|
46
48
|
|
|
47
49
|
let opacity = 1;
|
|
48
50
|
|
|
@@ -50,13 +52,10 @@ export const useAssociatedStyles = ({ id }: Props = {}) => {
|
|
|
50
52
|
opacity = base.opacity as number;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
// Only force opacity to 0 during the initial frame; once ready,
|
|
54
|
-
// return base unchanged so we never override user-provided opacity.
|
|
55
55
|
if (!showAfterFirstFrame.value) {
|
|
56
56
|
return { ...base, opacity: 0 };
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// Since opacity exists on the base style, we don't need to override it.
|
|
60
59
|
if ("opacity" in base) {
|
|
61
60
|
return base;
|
|
62
61
|
}
|
|
@@ -4,18 +4,15 @@ import { useWindowDimensions } from "react-native";
|
|
|
4
4
|
import { type SharedValue, useDerivedValue } from "react-native-reanimated";
|
|
5
5
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "../../
|
|
11
|
-
import { type
|
|
12
|
-
import { AnimationStore } from "../../stores/animation-store";
|
|
13
|
-
import { BoundStore } from "../../stores/bound-store";
|
|
14
|
-
import { GestureStore, type GestureStoreMap } from "../../stores/gesture-store";
|
|
7
|
+
import { DEFAULT_SCREEN_TRANSITION_STATE } from "../../constants";
|
|
8
|
+
import { type TransitionDescriptor, useKeys } from "../../providers/keys.provider";
|
|
9
|
+
|
|
10
|
+
import { AnimationStore } from "../../stores/animation.store";
|
|
11
|
+
import { GestureStore, type GestureStoreMap } from "../../stores/gesture.store";
|
|
15
12
|
import type {
|
|
16
13
|
ScreenInterpolationProps,
|
|
17
14
|
ScreenTransitionState,
|
|
18
|
-
} from "../../types/animation";
|
|
15
|
+
} from "../../types/animation.types";
|
|
19
16
|
import { derivations } from "../../utils/animation/derivations";
|
|
20
17
|
import { createBounds } from "../../utils/bounds";
|
|
21
18
|
|
|
@@ -47,7 +44,6 @@ const unwrap = (
|
|
|
47
44
|
isDragging: s.gesture.isDragging.value,
|
|
48
45
|
direction: s.gesture.direction.value,
|
|
49
46
|
},
|
|
50
|
-
bounds: BoundStore.getBounds(key) || NO_BOUNDS_MAP,
|
|
51
47
|
route: s.route,
|
|
52
48
|
};
|
|
53
49
|
};
|
|
@@ -99,17 +95,9 @@ export function _useScreenAnimation() {
|
|
|
99
95
|
unwrap(currentAnimation, currentDescriptor?.route.key) ??
|
|
100
96
|
DEFAULT_SCREEN_TRANSITION_STATE;
|
|
101
97
|
|
|
102
|
-
const {
|
|
103
|
-
progress,
|
|
104
|
-
focused,
|
|
105
|
-
activeBoundId,
|
|
106
|
-
active,
|
|
107
|
-
isActiveTransitioning,
|
|
108
|
-
isDismissing,
|
|
109
|
-
} = derivations({
|
|
98
|
+
const helpers = derivations({
|
|
110
99
|
current,
|
|
111
100
|
next,
|
|
112
|
-
previous,
|
|
113
101
|
});
|
|
114
102
|
|
|
115
103
|
return {
|
|
@@ -118,13 +106,7 @@ export function _useScreenAnimation() {
|
|
|
118
106
|
previous,
|
|
119
107
|
current,
|
|
120
108
|
next,
|
|
121
|
-
|
|
122
|
-
activeBoundId,
|
|
123
|
-
progress,
|
|
124
|
-
|
|
125
|
-
active,
|
|
126
|
-
isActiveTransitioning,
|
|
127
|
-
isDismissing,
|
|
109
|
+
...helpers,
|
|
128
110
|
};
|
|
129
111
|
});
|
|
130
112
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StackActions } from "@react-navigation/native";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
2
3
|
import { useWindowDimensions } from "react-native";
|
|
3
4
|
import {
|
|
4
5
|
Gesture,
|
|
@@ -9,11 +10,7 @@ import {
|
|
|
9
10
|
type PanGestureHandlerEventPayload,
|
|
10
11
|
} from "react-native-gesture-handler";
|
|
11
12
|
import type { GestureStateManagerType } from "react-native-gesture-handler/lib/typescript/handlers/gestures/gestureStateManager";
|
|
12
|
-
import {
|
|
13
|
-
runOnJS,
|
|
14
|
-
type SharedValue,
|
|
15
|
-
useSharedValue,
|
|
16
|
-
} from "react-native-reanimated";
|
|
13
|
+
import { type SharedValue, useSharedValue } from "react-native-reanimated";
|
|
17
14
|
import {
|
|
18
15
|
DEFAULT_GESTURE_ACTIVATION_AREA,
|
|
19
16
|
DEFAULT_GESTURE_DIRECTION,
|
|
@@ -21,30 +18,35 @@ import {
|
|
|
21
18
|
DEFAULT_GESTURE_ENABLED,
|
|
22
19
|
GESTURE_VELOCITY_IMPACT,
|
|
23
20
|
} from "../../constants";
|
|
24
|
-
import type {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
21
|
+
import type {
|
|
22
|
+
GestureContextType,
|
|
23
|
+
ScrollConfig,
|
|
24
|
+
} from "../../providers/gestures.provider";
|
|
25
|
+
import { useKeys } from "../../providers/keys.provider";
|
|
26
|
+
import { AnimationStore } from "../../stores/animation.store";
|
|
27
|
+
import { GestureStore, type GestureStoreMap } from "../../stores/gesture.store";
|
|
28
|
+
|
|
29
|
+
import { type GestureDirection, GestureOffsetState } from "../../types/gesture.types";
|
|
30
30
|
import { startScreenTransition } from "../../utils/animation/start-screen-transition";
|
|
31
31
|
import { applyOffsetRules } from "../../utils/gesture/check-gesture-activation";
|
|
32
32
|
import { determineDismissal } from "../../utils/gesture/determine-dismissal";
|
|
33
33
|
import { mapGestureToProgress } from "../../utils/gesture/map-gesture-to-progress";
|
|
34
34
|
import { resetGestureValues } from "../../utils/gesture/reset-gesture-values";
|
|
35
35
|
import { velocity } from "../../utils/gesture/velocity";
|
|
36
|
-
import useStableCallback from "../use-stable-callback";
|
|
37
36
|
import useStableCallbackValue from "../use-stable-callback-value";
|
|
38
37
|
|
|
39
38
|
interface BuildGesturesHookProps {
|
|
40
39
|
scrollConfig: SharedValue<ScrollConfig | null>;
|
|
40
|
+
parentContext?: GestureContextType | null;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export const useBuildGestures = ({
|
|
44
44
|
scrollConfig,
|
|
45
|
+
parentContext,
|
|
45
46
|
}: BuildGesturesHookProps): {
|
|
46
47
|
panGesture: GestureType;
|
|
47
48
|
nativeGesture: GestureType;
|
|
49
|
+
gestureAnimationValues: GestureStoreMap;
|
|
48
50
|
} => {
|
|
49
51
|
const dimensions = useWindowDimensions();
|
|
50
52
|
const { current } = useKeys();
|
|
@@ -58,7 +60,9 @@ export const useBuildGestures = ({
|
|
|
58
60
|
GestureOffsetState.PENDING,
|
|
59
61
|
);
|
|
60
62
|
|
|
61
|
-
const
|
|
63
|
+
const gestureAnimationValues = GestureStore.getRouteGestures(
|
|
64
|
+
current.route.key,
|
|
65
|
+
);
|
|
62
66
|
const animations = AnimationStore.getAll(current.route.key);
|
|
63
67
|
|
|
64
68
|
const {
|
|
@@ -87,17 +91,29 @@ export const useBuildGestures = ({
|
|
|
87
91
|
};
|
|
88
92
|
}, [gestureDirection]);
|
|
89
93
|
|
|
90
|
-
const
|
|
91
|
-
|
|
94
|
+
const handleDismiss = useCallback(() => {
|
|
95
|
+
// If an ancestor navigator is already dismissing, skip this dismiss to
|
|
96
|
+
// avoid racing with the parent
|
|
97
|
+
if (parentContext?.gestureAnimationValues.isDismissing?.value) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
92
100
|
|
|
93
|
-
|
|
94
|
-
});
|
|
101
|
+
const state = current.navigation.getState();
|
|
95
102
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
const routeStillPresent = state.routes.some(
|
|
104
|
+
(route) => route.key === current.route.key,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
if (!routeStillPresent) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
current.navigation.dispatch({
|
|
112
|
+
...StackActions.pop(),
|
|
113
|
+
source: current.route.key,
|
|
114
|
+
target: state.key,
|
|
115
|
+
});
|
|
116
|
+
}, [current, parentContext]);
|
|
101
117
|
|
|
102
118
|
const onTouchesDown = useStableCallbackValue((e: GestureTouchEvent) => {
|
|
103
119
|
"worklet";
|
|
@@ -110,6 +126,13 @@ export const useBuildGestures = ({
|
|
|
110
126
|
(e: GestureTouchEvent, manager: GestureStateManagerType) => {
|
|
111
127
|
"worklet";
|
|
112
128
|
|
|
129
|
+
// If an ancestor navigator is already dismissing via gesture, block new gestures here.
|
|
130
|
+
if (parentContext?.gestureAnimationValues.isDismissing?.value) {
|
|
131
|
+
gestureOffsetState.value = GestureOffsetState.FAILED;
|
|
132
|
+
manager.fail();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
113
136
|
const touch = e.changedTouches[0];
|
|
114
137
|
|
|
115
138
|
const { isSwipingDown, isSwipingUp, isSwipingRight, isSwipingLeft } =
|
|
@@ -130,7 +153,7 @@ export const useBuildGestures = ({
|
|
|
130
153
|
}
|
|
131
154
|
|
|
132
155
|
// Keep pending until thresholds are met; no eager activation.
|
|
133
|
-
if (
|
|
156
|
+
if (gestureAnimationValues.isDragging?.value) {
|
|
134
157
|
manager.activate();
|
|
135
158
|
return;
|
|
136
159
|
}
|
|
@@ -178,9 +201,9 @@ export const useBuildGestures = ({
|
|
|
178
201
|
if (
|
|
179
202
|
shouldActivate &&
|
|
180
203
|
gestureOffsetState.value === GestureOffsetState.PASSED &&
|
|
181
|
-
!
|
|
204
|
+
!gestureAnimationValues.isDismissing?.value
|
|
182
205
|
) {
|
|
183
|
-
|
|
206
|
+
gestureAnimationValues.direction.value = activatedDirection;
|
|
184
207
|
manager.activate();
|
|
185
208
|
return;
|
|
186
209
|
}
|
|
@@ -189,8 +212,8 @@ export const useBuildGestures = ({
|
|
|
189
212
|
|
|
190
213
|
const onStart = useStableCallbackValue(() => {
|
|
191
214
|
"worklet";
|
|
192
|
-
|
|
193
|
-
|
|
215
|
+
gestureAnimationValues.isDragging.value = 1;
|
|
216
|
+
gestureAnimationValues.isDismissing.value = 0;
|
|
194
217
|
});
|
|
195
218
|
|
|
196
219
|
const onUpdate = useStableCallbackValue(
|
|
@@ -202,13 +225,13 @@ export const useBuildGestures = ({
|
|
|
202
225
|
const { translationX, translationY } = event;
|
|
203
226
|
const { width, height } = dimensions;
|
|
204
227
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
228
|
+
gestureAnimationValues.x.value = translationX;
|
|
229
|
+
gestureAnimationValues.y.value = translationY;
|
|
230
|
+
gestureAnimationValues.normalizedX.value = Math.max(
|
|
208
231
|
-1,
|
|
209
232
|
Math.min(1, translationX / width),
|
|
210
233
|
);
|
|
211
|
-
|
|
234
|
+
gestureAnimationValues.normalizedY.value = Math.max(
|
|
212
235
|
-1,
|
|
213
236
|
Math.min(1, translationY / height),
|
|
214
237
|
);
|
|
@@ -275,16 +298,12 @@ export const useBuildGestures = ({
|
|
|
275
298
|
|
|
276
299
|
resetGestureValues({
|
|
277
300
|
spec,
|
|
278
|
-
gestures,
|
|
301
|
+
gestures: gestureAnimationValues,
|
|
279
302
|
shouldDismiss,
|
|
280
303
|
event,
|
|
281
304
|
dimensions,
|
|
282
305
|
});
|
|
283
306
|
|
|
284
|
-
if (shouldDismiss) {
|
|
285
|
-
runOnJS(setNavigatorDismissal)();
|
|
286
|
-
}
|
|
287
|
-
|
|
288
307
|
const initialVelocity = velocity.calculateProgressVelocity({
|
|
289
308
|
animations,
|
|
290
309
|
shouldDismiss,
|
|
@@ -319,6 +338,15 @@ export const useBuildGestures = ({
|
|
|
319
338
|
return {
|
|
320
339
|
panGesture,
|
|
321
340
|
nativeGesture,
|
|
341
|
+
gestureAnimationValues,
|
|
322
342
|
};
|
|
323
|
-
}, [
|
|
343
|
+
}, [
|
|
344
|
+
gestureEnabled,
|
|
345
|
+
onTouchesDown,
|
|
346
|
+
onTouchesMove,
|
|
347
|
+
onStart,
|
|
348
|
+
onUpdate,
|
|
349
|
+
onEnd,
|
|
350
|
+
gestureAnimationValues,
|
|
351
|
+
]);
|
|
324
352
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { LayoutChangeEvent } from "react-native";
|
|
2
2
|
import { useAnimatedScrollHandler } from "react-native-reanimated";
|
|
3
3
|
import type { ReanimatedScrollEvent } from "react-native-reanimated/lib/typescript/hook/commonTypes";
|
|
4
|
-
import { useGestureContext } from "../../providers/gestures";
|
|
5
|
-
import type { Any } from "../../types/utils";
|
|
4
|
+
import { useGestureContext } from "../../providers/gestures.provider";
|
|
5
|
+
import type { Any } from "../../types/utils.types";
|
|
6
6
|
import useStableCallback from "../use-stable-callback";
|
|
7
7
|
|
|
8
8
|
interface ScrollProgressHookProps {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { useCallback, useEffect, useState } from "react";
|
|
6
6
|
import {
|
|
7
|
+
cancelAnimation,
|
|
7
8
|
isWorkletFunction,
|
|
8
9
|
makeMutable,
|
|
9
10
|
runOnJS,
|
|
@@ -13,7 +14,15 @@ import {
|
|
|
13
14
|
type AnyFunction = (...args: Array<any>) => any;
|
|
14
15
|
|
|
15
16
|
function useMutableValue<T>(initialValue: T) {
|
|
16
|
-
|
|
17
|
+
const [mutable] = useState(() => makeMutable(initialValue));
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
return () => {
|
|
21
|
+
cancelAnimation(mutable);
|
|
22
|
+
};
|
|
23
|
+
}, [mutable]);
|
|
24
|
+
|
|
25
|
+
return mutable;
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
// We cannot store a function as a SharedValue because reanimated will treat
|
package/src/shared/index.ts
CHANGED
|
@@ -21,6 +21,9 @@ export default {
|
|
|
21
21
|
export { useScreenAnimation } from "./hooks/animation/use-screen-animation";
|
|
22
22
|
|
|
23
23
|
export type {
|
|
24
|
+
AnimationConfig,
|
|
24
25
|
OverlayInterpolationProps,
|
|
25
26
|
ScreenInterpolationProps,
|
|
26
|
-
|
|
27
|
+
ScreenStyleInterpolator,
|
|
28
|
+
} from "./types/animation.types";
|
|
29
|
+
export type { ScreenTransitionConfig } from "./types/core.types";
|
|
@@ -5,6 +5,7 @@ import { GestureDetector } from "react-native-gesture-handler";
|
|
|
5
5
|
import type { SharedValue } from "react-native-reanimated";
|
|
6
6
|
import { useSharedValue } from "react-native-reanimated";
|
|
7
7
|
import { useBuildGestures } from "../hooks/gestures/use-build-gestures";
|
|
8
|
+
import type { GestureStoreMap } from "../stores/gesture.store";
|
|
8
9
|
|
|
9
10
|
export type ScrollConfig = {
|
|
10
11
|
x: number;
|
|
@@ -19,34 +20,42 @@ export interface GestureContextType {
|
|
|
19
20
|
panGesture: GestureType;
|
|
20
21
|
nativeGesture: GestureType;
|
|
21
22
|
scrollConfig: SharedValue<ScrollConfig | null>;
|
|
23
|
+
gestureAnimationValues: GestureStoreMap;
|
|
22
24
|
parentContext: GestureContextType | null;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
type
|
|
27
|
+
type GestureProviderProps = {
|
|
26
28
|
children: React.ReactNode;
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
const GestureContext = createContext<GestureContextType | undefined>(undefined);
|
|
30
32
|
|
|
31
|
-
export const ScreenGestureProvider = ({
|
|
32
|
-
children,
|
|
33
|
-
}: ScreenGestureProviderProps) => {
|
|
33
|
+
export const ScreenGestureProvider = ({ children }: GestureProviderProps) => {
|
|
34
34
|
const parentContext = useContext(GestureContext);
|
|
35
35
|
|
|
36
36
|
const scrollConfig = useSharedValue<ScrollConfig | null>(null);
|
|
37
37
|
|
|
38
|
-
const { panGesture, nativeGesture } =
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const { panGesture, nativeGesture, gestureAnimationValues } =
|
|
39
|
+
useBuildGestures({
|
|
40
|
+
scrollConfig,
|
|
41
|
+
parentContext,
|
|
42
|
+
});
|
|
41
43
|
|
|
42
44
|
const value: GestureContextType = useMemo(
|
|
43
45
|
() => ({
|
|
44
46
|
panGesture,
|
|
45
47
|
scrollConfig,
|
|
46
48
|
nativeGesture,
|
|
49
|
+
gestureAnimationValues,
|
|
47
50
|
parentContext: parentContext || null,
|
|
48
51
|
}),
|
|
49
|
-
[
|
|
52
|
+
[
|
|
53
|
+
panGesture,
|
|
54
|
+
scrollConfig,
|
|
55
|
+
nativeGesture,
|
|
56
|
+
gestureAnimationValues,
|
|
57
|
+
parentContext,
|
|
58
|
+
],
|
|
50
59
|
);
|
|
51
60
|
|
|
52
61
|
return (
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
RouteProp,
|
|
6
6
|
} from "@react-navigation/native";
|
|
7
7
|
import { createContext, useContext, useMemo } from "react";
|
|
8
|
-
import type { ScreenTransitionConfig } from "../types/core";
|
|
8
|
+
import type { ScreenTransitionConfig } from "../types/core.types";
|
|
9
9
|
|
|
10
10
|
export type TransitionDescriptor = Descriptor<
|
|
11
11
|
ScreenTransitionConfig,
|