react-native-screen-transitions 1.1.0 → 2.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/LICENSE +21 -0
- package/README.md +273 -269
- package/lib/commonjs/__tests__ /geometry.test.js +178 -0
- package/lib/commonjs/__tests__ /geometry.test.js.map +1 -0
- package/lib/commonjs/components/bounds-activator.js +33 -0
- package/lib/commonjs/components/bounds-activator.js.map +1 -0
- package/lib/commonjs/components/controllers/screen-lifecycle.js +66 -0
- package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -0
- package/lib/commonjs/components/create-transition-aware-component.js +96 -0
- package/lib/commonjs/components/create-transition-aware-component.js.map +1 -0
- package/lib/commonjs/components/root-transition-aware.js +56 -0
- package/lib/commonjs/components/root-transition-aware.js.map +1 -0
- package/lib/commonjs/configs/index.js +12 -0
- package/lib/commonjs/configs/index.js.map +1 -0
- package/lib/commonjs/configs/presets.js +206 -0
- package/lib/commonjs/configs/presets.js.map +1 -0
- package/lib/commonjs/configs/specs.js +14 -0
- package/lib/commonjs/configs/specs.js.map +1 -0
- package/lib/commonjs/hooks/animation/use-associated-style.js +36 -0
- package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -0
- package/lib/commonjs/hooks/animation/use-screen-animation.js +120 -0
- package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -0
- package/lib/commonjs/hooks/bounds/use-bound-measurer.js +52 -0
- package/lib/commonjs/hooks/bounds/use-bound-measurer.js.map +1 -0
- package/lib/commonjs/hooks/gestures/use-build-gestures.js +239 -0
- package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -0
- package/lib/commonjs/hooks/gestures/use-scroll-progress.js +57 -0
- package/lib/commonjs/hooks/gestures/use-scroll-progress.js.map +1 -0
- package/lib/commonjs/hooks/use-stable-callback.js +17 -0
- package/lib/commonjs/hooks/use-stable-callback.js.map +1 -0
- package/lib/commonjs/index.js +37 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js +68 -0
- package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/utils/debounce.js +16 -0
- package/lib/commonjs/integrations/native-stack/utils/debounce.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js +17 -0
- package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/utils/useAnimatedHeaderHeight.js +18 -0
- package/lib/commonjs/integrations/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/utils/useDismissedRouteError.js +22 -0
- package/lib/commonjs/integrations/native-stack/utils/useDismissedRouteError.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js +25 -0
- package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/views/FontProcessor.js +10 -0
- package/lib/commonjs/integrations/native-stack/views/FontProcessor.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/views/FontProcessor.native.js +18 -0
- package/lib/commonjs/integrations/native-stack/views/FontProcessor.native.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/views/FooterComponent.js +17 -0
- package/lib/commonjs/integrations/native-stack/views/FooterComponent.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.js +138 -0
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +497 -0
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js +203 -0
- package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/providers/gestures.js +64 -0
- package/lib/commonjs/providers/gestures.js.map +1 -0
- package/lib/commonjs/providers/keys.js +35 -0
- package/lib/commonjs/providers/keys.js.map +1 -0
- package/lib/commonjs/stores/animations.js +39 -0
- package/lib/commonjs/stores/animations.js.map +1 -0
- package/lib/commonjs/stores/bounds.js +64 -0
- package/lib/commonjs/stores/bounds.js.map +1 -0
- package/lib/commonjs/stores/gestures.js +38 -0
- package/lib/commonjs/stores/gestures.js.map +1 -0
- package/lib/commonjs/stores/navigator-dismiss-state.js +23 -0
- package/lib/commonjs/stores/navigator-dismiss-state.js.map +1 -0
- package/lib/commonjs/stores/utils/reset-stores-for-screen.js +20 -0
- package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -0
- package/lib/commonjs/types/animation.js +6 -0
- package/lib/commonjs/types/animation.js.map +1 -0
- package/lib/commonjs/types/bounds.js +6 -0
- package/lib/commonjs/types/bounds.js.map +1 -0
- package/lib/commonjs/types/core.js +6 -0
- package/lib/commonjs/types/core.js.map +1 -0
- package/lib/commonjs/types/gesture.js +2 -0
- package/lib/commonjs/types/gesture.js.map +1 -0
- package/lib/commonjs/types/navigator.js +6 -0
- package/lib/commonjs/types/navigator.js.map +1 -0
- package/lib/commonjs/types/utils.js +2 -0
- package/lib/commonjs/types/utils.js.map +1 -0
- package/lib/commonjs/utils/animation/animate.js +18 -0
- package/lib/commonjs/utils/animation/animate.js.map +1 -0
- package/lib/commonjs/utils/animation/run-transition.js +48 -0
- package/lib/commonjs/utils/animation/run-transition.js.map +1 -0
- package/lib/commonjs/utils/bounds/_types/builder.js +6 -0
- package/lib/commonjs/utils/bounds/_types/builder.js.map +1 -0
- package/lib/commonjs/utils/bounds/_types/geometry.js +2 -0
- package/lib/commonjs/utils/bounds/_types/geometry.js.map +1 -0
- package/lib/commonjs/utils/bounds/_types/get-bounds.js +6 -0
- package/lib/commonjs/utils/bounds/_types/get-bounds.js.map +1 -0
- package/lib/commonjs/utils/bounds/build-bound-styles.js +145 -0
- package/lib/commonjs/utils/bounds/build-bound-styles.js.map +1 -0
- package/lib/commonjs/utils/bounds/constants.js +31 -0
- package/lib/commonjs/utils/bounds/constants.js.map +1 -0
- package/lib/commonjs/utils/bounds/flatten-styles.js +27 -0
- package/lib/commonjs/utils/bounds/flatten-styles.js.map +1 -0
- package/lib/commonjs/utils/bounds/geometry.js +94 -0
- package/lib/commonjs/utils/bounds/geometry.js.map +1 -0
- package/lib/commonjs/utils/bounds/get-bounds.js +51 -0
- package/lib/commonjs/utils/bounds/get-bounds.js.map +1 -0
- package/lib/commonjs/utils/bounds/index.js +38 -0
- package/lib/commonjs/utils/bounds/index.js.map +1 -0
- package/lib/commonjs/utils/bounds/style-composers.js +199 -0
- package/lib/commonjs/utils/bounds/style-composers.js.map +1 -0
- package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js +81 -0
- package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js.map +1 -0
- package/lib/commonjs/utils/gesture/map-gesture-to-progress.js +17 -0
- package/lib/commonjs/utils/gesture/map-gesture-to-progress.js.map +1 -0
- package/lib/commonjs/utils/gesture/normalize-gesture-translation.js +21 -0
- package/lib/commonjs/utils/gesture/normalize-gesture-translation.js.map +1 -0
- package/lib/commonjs/utils/index.js +17 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/module/__tests__ /geometry.test.js +178 -0
- package/lib/module/__tests__ /geometry.test.js.map +1 -0
- package/lib/module/components/bounds-activator.js +28 -0
- package/lib/module/components/bounds-activator.js.map +1 -0
- package/lib/module/components/controllers/screen-lifecycle.js +60 -0
- package/lib/module/components/controllers/screen-lifecycle.js.map +1 -0
- package/lib/module/components/create-transition-aware-component.js +91 -0
- package/lib/module/components/create-transition-aware-component.js.map +1 -0
- package/lib/module/components/root-transition-aware.js +51 -0
- package/lib/module/components/root-transition-aware.js.map +1 -0
- package/lib/module/configs/index.js +5 -0
- package/lib/module/configs/index.js.map +1 -0
- package/lib/module/configs/presets.js +197 -0
- package/lib/module/configs/presets.js.map +1 -0
- package/lib/module/configs/specs.js +10 -0
- package/lib/module/configs/specs.js.map +1 -0
- package/lib/module/hooks/animation/use-associated-style.js +32 -0
- package/lib/module/hooks/animation/use-associated-style.js.map +1 -0
- package/lib/module/hooks/animation/use-screen-animation.js +115 -0
- package/lib/module/hooks/animation/use-screen-animation.js.map +1 -0
- package/lib/module/hooks/bounds/use-bound-measurer.js +47 -0
- package/lib/module/hooks/bounds/use-bound-measurer.js.map +1 -0
- package/lib/module/hooks/gestures/use-build-gestures.js +234 -0
- package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -0
- package/lib/module/hooks/gestures/use-scroll-progress.js +52 -0
- package/lib/module/hooks/gestures/use-scroll-progress.js.map +1 -0
- package/lib/module/hooks/use-stable-callback.js +13 -0
- package/lib/module/hooks/use-stable-callback.js.map +1 -0
- package/lib/module/index.js +21 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js +63 -0
- package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -0
- package/lib/module/integrations/native-stack/utils/debounce.js +12 -0
- package/lib/module/integrations/native-stack/utils/debounce.js.map +1 -0
- package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js +12 -0
- package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -0
- package/lib/module/integrations/native-stack/utils/useAnimatedHeaderHeight.js +12 -0
- package/lib/module/integrations/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -0
- package/lib/module/integrations/native-stack/utils/useDismissedRouteError.js +17 -0
- package/lib/module/integrations/native-stack/utils/useDismissedRouteError.js.map +1 -0
- package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js +20 -0
- package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -0
- package/lib/module/integrations/native-stack/views/FontProcessor.js +6 -0
- package/lib/module/integrations/native-stack/views/FontProcessor.js.map +1 -0
- package/lib/module/integrations/native-stack/views/FontProcessor.native.js +12 -0
- package/lib/module/integrations/native-stack/views/FontProcessor.native.js.map +1 -0
- package/lib/module/integrations/native-stack/views/FooterComponent.js +13 -0
- package/lib/module/integrations/native-stack/views/FooterComponent.js.map +1 -0
- package/lib/module/integrations/native-stack/views/NativeStackView.js +133 -0
- package/lib/module/integrations/native-stack/views/NativeStackView.js.map +1 -0
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js +492 -0
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -0
- package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js +199 -0
- package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -0
- package/lib/module/providers/gestures.js +58 -0
- package/lib/module/providers/gestures.js.map +1 -0
- package/lib/module/providers/keys.js +29 -0
- package/lib/module/providers/keys.js.map +1 -0
- package/lib/module/stores/animations.js +33 -0
- package/lib/module/stores/animations.js.map +1 -0
- package/lib/module/stores/bounds.js +60 -0
- package/lib/module/stores/bounds.js.map +1 -0
- package/lib/module/stores/gestures.js +34 -0
- package/lib/module/stores/gestures.js.map +1 -0
- package/lib/module/stores/navigator-dismiss-state.js +19 -0
- package/lib/module/stores/navigator-dismiss-state.js.map +1 -0
- package/lib/module/stores/utils/reset-stores-for-screen.js +16 -0
- package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -0
- package/lib/module/types/animation.js +4 -0
- package/lib/module/types/animation.js.map +1 -0
- package/lib/module/types/bounds.js +4 -0
- package/lib/module/types/bounds.js.map +1 -0
- package/lib/module/types/core.js +4 -0
- package/lib/module/types/core.js.map +1 -0
- package/lib/module/types/gesture.js +2 -0
- package/lib/module/types/gesture.js.map +1 -0
- package/lib/module/types/navigator.js +4 -0
- package/lib/module/types/navigator.js.map +1 -0
- package/lib/module/types/utils.js +2 -0
- package/lib/module/types/utils.js.map +1 -0
- package/lib/module/utils/animation/animate.js +13 -0
- package/lib/module/utils/animation/animate.js.map +1 -0
- package/lib/module/utils/animation/run-transition.js +43 -0
- package/lib/module/utils/animation/run-transition.js.map +1 -0
- package/lib/module/utils/bounds/_types/builder.js +4 -0
- package/lib/module/utils/bounds/_types/builder.js.map +1 -0
- package/lib/module/utils/bounds/_types/geometry.js +2 -0
- package/lib/module/utils/bounds/_types/geometry.js.map +1 -0
- package/lib/module/utils/bounds/_types/get-bounds.js +4 -0
- package/lib/module/utils/bounds/_types/get-bounds.js.map +1 -0
- package/lib/module/utils/bounds/build-bound-styles.js +141 -0
- package/lib/module/utils/bounds/build-bound-styles.js.map +1 -0
- package/lib/module/utils/bounds/constants.js +26 -0
- package/lib/module/utils/bounds/constants.js.map +1 -0
- package/lib/module/utils/bounds/flatten-styles.js +23 -0
- package/lib/module/utils/bounds/flatten-styles.js.map +1 -0
- package/lib/module/utils/bounds/geometry.js +89 -0
- package/lib/module/utils/bounds/geometry.js.map +1 -0
- package/lib/module/utils/bounds/get-bounds.js +46 -0
- package/lib/module/utils/bounds/get-bounds.js.map +1 -0
- package/lib/module/utils/bounds/index.js +33 -0
- package/lib/module/utils/bounds/index.js.map +1 -0
- package/lib/module/utils/bounds/style-composers.js +191 -0
- package/lib/module/utils/bounds/style-composers.js.map +1 -0
- package/lib/module/utils/gesture/apply-gesture-activation-criteria.js +76 -0
- package/lib/module/utils/gesture/apply-gesture-activation-criteria.js.map +1 -0
- package/lib/module/utils/gesture/map-gesture-to-progress.js +12 -0
- package/lib/module/utils/gesture/map-gesture-to-progress.js.map +1 -0
- package/lib/module/utils/gesture/normalize-gesture-translation.js +16 -0
- package/lib/module/utils/gesture/normalize-gesture-translation.js.map +1 -0
- package/lib/module/utils/index.js +4 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/components/bounds-activator.d.ts +8 -0
- package/lib/typescript/components/bounds-activator.d.ts.map +1 -0
- package/lib/typescript/components/controllers/screen-lifecycle.d.ts +6 -0
- package/lib/typescript/components/controllers/screen-lifecycle.d.ts.map +1 -0
- package/lib/typescript/components/create-transition-aware-component.d.ts +9 -0
- package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -0
- package/lib/typescript/components/root-transition-aware.d.ts +6 -0
- package/lib/typescript/components/root-transition-aware.d.ts.map +1 -0
- package/lib/typescript/configs/index.d.ts +3 -0
- package/lib/typescript/configs/index.d.ts.map +1 -0
- package/lib/typescript/configs/presets.d.ts +9 -0
- package/lib/typescript/configs/presets.d.ts.map +1 -0
- package/lib/typescript/configs/specs.d.ts +3 -0
- package/lib/typescript/configs/specs.d.ts.map +1 -0
- package/lib/typescript/hooks/animation/use-associated-style.d.ts +11 -0
- package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -0
- package/lib/typescript/hooks/animation/use-screen-animation.d.ts +7 -0
- package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -0
- package/lib/typescript/hooks/bounds/use-bound-measurer.d.ts +18 -0
- package/lib/typescript/hooks/bounds/use-bound-measurer.d.ts.map +1 -0
- package/lib/typescript/hooks/gestures/use-build-gestures.d.ts +11 -0
- package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -0
- package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts +14 -0
- package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts.map +1 -0
- package/lib/typescript/hooks/use-stable-callback.d.ts +2 -0
- package/lib/typescript/hooks/use-stable-callback.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1275 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts +16 -0
- package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/utils/debounce.d.ts +2 -0
- package/lib/typescript/integrations/native-stack/utils/debounce.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts +4 -0
- package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/utils/useAnimatedHeaderHeight.d.ts +5 -0
- package/lib/typescript/integrations/native-stack/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/utils/useDismissedRouteError.d.ts +6 -0
- package/lib/typescript/integrations/native-stack/utils/useDismissedRouteError.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts +3 -0
- package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/views/FontProcessor.d.ts +2 -0
- package/lib/typescript/integrations/native-stack/views/FontProcessor.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/views/FontProcessor.native.d.ts +2 -0
- package/lib/typescript/integrations/native-stack/views/FontProcessor.native.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/views/FooterComponent.d.ts +7 -0
- package/lib/typescript/integrations/native-stack/views/FooterComponent.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts +11 -0
- package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts +11 -0
- package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts +44 -0
- package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts.map +1 -0
- package/lib/typescript/providers/gestures.d.ts +22 -0
- package/lib/typescript/providers/gestures.d.ts.map +1 -0
- package/lib/typescript/providers/keys.d.ts +16 -0
- package/lib/typescript/providers/keys.d.ts.map +1 -0
- package/lib/typescript/stores/animations.d.ts +17 -0
- package/lib/typescript/stores/animations.d.ts.map +1 -0
- package/lib/typescript/stores/bounds.d.ts +21 -0
- package/lib/typescript/stores/bounds.d.ts.map +1 -0
- package/lib/typescript/stores/gestures.d.ts +21 -0
- package/lib/typescript/stores/gestures.d.ts.map +1 -0
- package/lib/typescript/stores/navigator-dismiss-state.d.ts +7 -0
- package/lib/typescript/stores/navigator-dismiss-state.d.ts.map +1 -0
- package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +6 -0
- package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -0
- package/lib/typescript/types/animation.d.ts +65 -0
- package/lib/typescript/types/animation.d.ts.map +1 -0
- package/lib/typescript/types/bounds.d.ts +73 -0
- package/lib/typescript/types/bounds.d.ts.map +1 -0
- package/lib/typescript/types/core.d.ts +47 -0
- package/lib/typescript/types/core.d.ts.map +1 -0
- package/lib/typescript/types/gesture.d.ts +28 -0
- package/lib/typescript/types/gesture.d.ts.map +1 -0
- package/lib/typescript/types/navigator.d.ts +683 -0
- package/lib/typescript/types/navigator.d.ts.map +1 -0
- package/lib/typescript/types/utils.d.ts +5 -0
- package/lib/typescript/types/utils.d.ts.map +1 -0
- package/lib/typescript/utils/animation/animate.d.ts +4 -0
- package/lib/typescript/utils/animation/animate.d.ts.map +1 -0
- package/lib/typescript/utils/animation/run-transition.d.ts +11 -0
- package/lib/typescript/utils/animation/run-transition.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/_types/builder.d.ts +36 -0
- package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/_types/geometry.d.ts +16 -0
- package/lib/typescript/utils/bounds/_types/geometry.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/_types/get-bounds.d.ts +10 -0
- package/lib/typescript/utils/bounds/_types/get-bounds.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/build-bound-styles.d.ts +4 -0
- package/lib/typescript/utils/bounds/build-bound-styles.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/constants.d.ts +7 -0
- package/lib/typescript/utils/bounds/constants.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/flatten-styles.d.ts +2 -0
- package/lib/typescript/utils/bounds/flatten-styles.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/geometry.d.ts +24 -0
- package/lib/typescript/utils/bounds/geometry.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/get-bounds.d.ts +4 -0
- package/lib/typescript/utils/bounds/get-bounds.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/index.d.ts +15 -0
- package/lib/typescript/utils/bounds/index.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/style-composers.d.ts +40 -0
- package/lib/typescript/utils/bounds/style-composers.d.ts.map +1 -0
- package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts +17 -0
- package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts.map +1 -0
- package/lib/typescript/utils/gesture/map-gesture-to-progress.d.ts +5 -0
- package/lib/typescript/utils/gesture/map-gesture-to-progress.d.ts.map +1 -0
- package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts +6 -0
- package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +2 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/package.json +33 -16
- package/dist/index.d.mts +0 -1473
- package/dist/index.d.ts +0 -1473
- package/dist/index.js +0 -1169
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1159
- package/dist/index.mjs.map +0 -1
package/dist/index.js
DELETED
|
@@ -1,1169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
default: () => index_default,
|
|
34
|
-
useScreenAnimation: () => useScreenAnimation
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(index_exports);
|
|
37
|
-
var import_react_native5 = require("react-native");
|
|
38
|
-
|
|
39
|
-
// src/components/create-transition-aware-component.tsx
|
|
40
|
-
var import_react7 = require("react");
|
|
41
|
-
var import_react_native3 = require("react-native");
|
|
42
|
-
var import_react_native_reanimated8 = __toESM(require("react-native-reanimated"));
|
|
43
|
-
|
|
44
|
-
// src/components/transition-gesture-handler-provider.tsx
|
|
45
|
-
var import_react4 = require("react");
|
|
46
|
-
var import_react_native_gesture_handler3 = require("react-native-gesture-handler");
|
|
47
|
-
var import_react_native_reanimated5 = require("react-native-reanimated");
|
|
48
|
-
|
|
49
|
-
// src/contexts/gesture.ts
|
|
50
|
-
var import_react = require("react");
|
|
51
|
-
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
52
|
-
var import_react_native_reanimated = require("react-native-reanimated");
|
|
53
|
-
var GestureContext = (0, import_react.createContext)(
|
|
54
|
-
void 0
|
|
55
|
-
);
|
|
56
|
-
var useGestureContext = () => {
|
|
57
|
-
const context = (0, import_react.useContext)(GestureContext);
|
|
58
|
-
const scrollProgressFallback = (0, import_react_native_reanimated.useSharedValue)({
|
|
59
|
-
x: 0,
|
|
60
|
-
y: 0,
|
|
61
|
-
contentHeight: 0,
|
|
62
|
-
contentWidth: 0,
|
|
63
|
-
layoutHeight: 0,
|
|
64
|
-
layoutWidth: 0
|
|
65
|
-
});
|
|
66
|
-
if (!context) {
|
|
67
|
-
return {
|
|
68
|
-
panGesture: import_react_native_gesture_handler.Gesture.Pan(),
|
|
69
|
-
nativeGesture: import_react_native_gesture_handler.Gesture.Native(),
|
|
70
|
-
scrollProgress: scrollProgressFallback,
|
|
71
|
-
isPlaceholder: true
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return context;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// src/hooks/use-build-gestures.tsx
|
|
78
|
-
var import_native3 = require("@react-navigation/native");
|
|
79
|
-
var import_react3 = require("react");
|
|
80
|
-
var import_react_native = require("react-native");
|
|
81
|
-
var import_react_native_gesture_handler2 = require("react-native-gesture-handler");
|
|
82
|
-
var import_react_native_reanimated4 = require("react-native-reanimated");
|
|
83
|
-
|
|
84
|
-
// src/configs/specs.ts
|
|
85
|
-
var specs_exports = {};
|
|
86
|
-
__export(specs_exports, {
|
|
87
|
-
DefaultSpec: () => DefaultSpec
|
|
88
|
-
});
|
|
89
|
-
var DefaultSpec = {
|
|
90
|
-
stiffness: 1e3,
|
|
91
|
-
damping: 500,
|
|
92
|
-
mass: 3,
|
|
93
|
-
overshootClamping: true,
|
|
94
|
-
restSpeedThreshold: 0.01
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// src/animation-engine.ts
|
|
98
|
-
var import_react_native_reanimated3 = require("react-native-reanimated");
|
|
99
|
-
|
|
100
|
-
// src/store/utils/create-vanilla-store.ts
|
|
101
|
-
var import_immer = require("immer");
|
|
102
|
-
var import_react2 = require("react");
|
|
103
|
-
function createVanillaStore(initialState) {
|
|
104
|
-
let state = initialState;
|
|
105
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
106
|
-
const getState = () => state;
|
|
107
|
-
const setState = (updater) => {
|
|
108
|
-
const nextState = (0, import_immer.produce)(state, updater);
|
|
109
|
-
if (nextState !== state) {
|
|
110
|
-
state = nextState;
|
|
111
|
-
listeners.forEach((listener) => listener());
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
const subscribe = (listener) => {
|
|
115
|
-
listeners.add(listener);
|
|
116
|
-
return () => listeners.delete(listener);
|
|
117
|
-
};
|
|
118
|
-
const subscribeWithSelector = (selector, listener) => {
|
|
119
|
-
let previousSelectedState = selector(state);
|
|
120
|
-
const internalListener = () => {
|
|
121
|
-
const currentSelectedState = selector(getState());
|
|
122
|
-
if (!Object.is(previousSelectedState, currentSelectedState)) {
|
|
123
|
-
listener(currentSelectedState, previousSelectedState);
|
|
124
|
-
previousSelectedState = currentSelectedState;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
const unsubscribe = subscribe(internalListener);
|
|
128
|
-
listener(previousSelectedState, previousSelectedState);
|
|
129
|
-
return unsubscribe;
|
|
130
|
-
};
|
|
131
|
-
function useStore(selector) {
|
|
132
|
-
return (0, import_react2.useSyncExternalStore)(subscribe, () => selector(getState()));
|
|
133
|
-
}
|
|
134
|
-
Object.assign(useStore, {
|
|
135
|
-
setState,
|
|
136
|
-
getState,
|
|
137
|
-
subscribe,
|
|
138
|
-
subscribeWithSelector
|
|
139
|
-
});
|
|
140
|
-
return useStore;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// src/store/utils/handle-screen-dismiss.tsx
|
|
144
|
-
var import_native = require("@react-navigation/native");
|
|
145
|
-
var handleScreenDismiss = (screenBeingDismissed, navigation) => {
|
|
146
|
-
const { screens } = ScreenStore.use.getState();
|
|
147
|
-
const dismissedScreen = screens[screenBeingDismissed];
|
|
148
|
-
if (!dismissedScreen) {
|
|
149
|
-
navigation.goBack();
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const childScreens = Object.values(screens).filter(
|
|
153
|
-
(screen) => screen.parentNavigatorKey === dismissedScreen.navigatorKey
|
|
154
|
-
);
|
|
155
|
-
if (childScreens.length > 0) {
|
|
156
|
-
ScreenStore.updateScreen(dismissedScreen.id, {
|
|
157
|
-
closing: true
|
|
158
|
-
});
|
|
159
|
-
navigation.dispatch(import_native.StackActions.pop(childScreens.length));
|
|
160
|
-
} else {
|
|
161
|
-
navigation.goBack();
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
// src/store/utils/remove-screen.tsx
|
|
166
|
-
var removeScreen = (key) => {
|
|
167
|
-
if (!key) return;
|
|
168
|
-
ScreenStore.use.setState(({ screens, screenKeys }) => {
|
|
169
|
-
delete screens[key];
|
|
170
|
-
const indexToRemove = screenKeys.indexOf(key);
|
|
171
|
-
if (indexToRemove > -1) {
|
|
172
|
-
screenKeys.splice(indexToRemove, 1);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
// src/store/utils/should-skip-prevent-default.tsx
|
|
178
|
-
var shouldSkipPreventDefault = (key, navigatorState) => {
|
|
179
|
-
if (!key) return false;
|
|
180
|
-
const { screens } = ScreenStore.use.getState();
|
|
181
|
-
const currentScreen = screens[key];
|
|
182
|
-
const isLastScreenInStack = navigatorState.routes.length === 1 && navigatorState.routes[0].key === key;
|
|
183
|
-
const isParentNavigatorExiting = Boolean(
|
|
184
|
-
currentScreen?.parentNavigatorKey && Object.values(screens).some(
|
|
185
|
-
(screen) => screen.navigatorKey === currentScreen.parentNavigatorKey && screen.closing
|
|
186
|
-
)
|
|
187
|
-
);
|
|
188
|
-
return isLastScreenInStack || isParentNavigatorExiting;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
// src/store/utils/update-screen.tsx
|
|
192
|
-
var updateScreen = (key, value) => {
|
|
193
|
-
if (!key) return;
|
|
194
|
-
ScreenStore.use.setState(({ screenKeys, screens }) => {
|
|
195
|
-
const currentScreen = screens[key];
|
|
196
|
-
if (currentScreen) {
|
|
197
|
-
screens[key] = {
|
|
198
|
-
...currentScreen,
|
|
199
|
-
...value
|
|
200
|
-
};
|
|
201
|
-
} else {
|
|
202
|
-
const { name = "", status = 0, closing = false, ...rest } = value;
|
|
203
|
-
const newIndex = screenKeys.length;
|
|
204
|
-
screens[key] = {
|
|
205
|
-
id: key,
|
|
206
|
-
index: newIndex,
|
|
207
|
-
name,
|
|
208
|
-
status,
|
|
209
|
-
closing,
|
|
210
|
-
...rest
|
|
211
|
-
};
|
|
212
|
-
screenKeys.push(key);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
// src/store/index.ts
|
|
218
|
-
var useScreenStore = createVanillaStore({
|
|
219
|
-
screens: {},
|
|
220
|
-
screenKeys: []
|
|
221
|
-
});
|
|
222
|
-
var ScreenStore = {
|
|
223
|
-
use: useScreenStore,
|
|
224
|
-
updateScreen,
|
|
225
|
-
removeScreen,
|
|
226
|
-
handleScreenDismiss,
|
|
227
|
-
shouldSkipPreventDefault
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// src/utils/animate.ts
|
|
231
|
-
var import_react_native_reanimated2 = require("react-native-reanimated");
|
|
232
|
-
var animate = (toValue, config, callback) => {
|
|
233
|
-
"worklet";
|
|
234
|
-
const isSpring = typeof config === "object" && !("duration" in config) && !("easing" in config);
|
|
235
|
-
if (!isSpring) {
|
|
236
|
-
return (0, import_react_native_reanimated2.withTiming)(toValue, config, callback);
|
|
237
|
-
}
|
|
238
|
-
return (0, import_react_native_reanimated2.withSpring)(toValue, config, callback);
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
// src/animation-engine.ts
|
|
242
|
-
var animationValues = {
|
|
243
|
-
screenProgress: {},
|
|
244
|
-
gestureX: {},
|
|
245
|
-
gestureY: {},
|
|
246
|
-
normalizedGestureX: {},
|
|
247
|
-
normalizedGestureY: {},
|
|
248
|
-
gestureDragging: {},
|
|
249
|
-
isDismissing: {}
|
|
250
|
-
};
|
|
251
|
-
var triggerAnimation = (screen) => {
|
|
252
|
-
"worklet";
|
|
253
|
-
const { id, closing, status, transitionSpec, onAnimationFinish } = screen;
|
|
254
|
-
const progressValue = animationValues.screenProgress[id];
|
|
255
|
-
if (!progressValue && __DEV__) {
|
|
256
|
-
console.warn(`Animation values not found for screen: ${id}`);
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const animationConfig = closing ? transitionSpec?.close : transitionSpec?.open;
|
|
260
|
-
const targetValue = status || 0;
|
|
261
|
-
progressValue.value = animate(targetValue, animationConfig, (finished) => {
|
|
262
|
-
"worklet";
|
|
263
|
-
if (finished && onAnimationFinish) {
|
|
264
|
-
(0, import_react_native_reanimated3.runOnJS)(onAnimationFinish)(true);
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
};
|
|
268
|
-
ScreenStore.use.subscribeWithSelector(
|
|
269
|
-
(state) => state.screens,
|
|
270
|
-
(currScreens, prevScreens) => {
|
|
271
|
-
const currKeys = Object.keys(currScreens);
|
|
272
|
-
const prevKeys = Object.keys(prevScreens);
|
|
273
|
-
const incomingKeys = currKeys.filter((k) => !prevKeys.includes(k));
|
|
274
|
-
const removedKeys = prevKeys.filter((k) => !currKeys.includes(k));
|
|
275
|
-
const changedKeys = currKeys.filter(
|
|
276
|
-
(k) => currScreens[k] !== prevScreens[k]
|
|
277
|
-
);
|
|
278
|
-
const animatableValues = Object.values(animationValues);
|
|
279
|
-
for (const incomingKey of incomingKeys) {
|
|
280
|
-
for (const value of animatableValues) {
|
|
281
|
-
value[incomingKey] = (0, import_react_native_reanimated3.makeMutable)(0);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
for (const removedKey of removedKeys) {
|
|
285
|
-
for (const value of animatableValues) {
|
|
286
|
-
(0, import_react_native_reanimated3.cancelAnimation)(value[removedKey]);
|
|
287
|
-
delete value[removedKey];
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
for (const changedKey of changedKeys) {
|
|
291
|
-
const currentScreen = currScreens[changedKey];
|
|
292
|
-
if (currentScreen) {
|
|
293
|
-
triggerAnimation(currentScreen);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
);
|
|
298
|
-
|
|
299
|
-
// src/utils/create-config.ts
|
|
300
|
-
var createConfig = ({
|
|
301
|
-
navigation: reactNavigation,
|
|
302
|
-
route,
|
|
303
|
-
...config
|
|
304
|
-
}) => {
|
|
305
|
-
return {
|
|
306
|
-
focus: (e) => {
|
|
307
|
-
const parentNavigatorKey = reactNavigation.getParent()?.getState?.()?.key;
|
|
308
|
-
const navigatorKey = reactNavigation.getState().key;
|
|
309
|
-
ScreenStore.updateScreen(e.target, {
|
|
310
|
-
id: e.target,
|
|
311
|
-
name: route.name,
|
|
312
|
-
status: 1,
|
|
313
|
-
closing: false,
|
|
314
|
-
navigatorKey,
|
|
315
|
-
parentNavigatorKey,
|
|
316
|
-
...config
|
|
317
|
-
});
|
|
318
|
-
},
|
|
319
|
-
beforeRemove: (e) => {
|
|
320
|
-
const shouldSkipPreventDefault2 = ScreenStore.shouldSkipPreventDefault(
|
|
321
|
-
e.target,
|
|
322
|
-
reactNavigation.getState()
|
|
323
|
-
);
|
|
324
|
-
if (shouldSkipPreventDefault2) {
|
|
325
|
-
ScreenStore.removeScreen(e.target);
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
e.preventDefault();
|
|
329
|
-
const handleFinish = (finished) => {
|
|
330
|
-
if (!finished) return;
|
|
331
|
-
if (reactNavigation.canGoBack()) {
|
|
332
|
-
reactNavigation.dispatch(e.data?.action);
|
|
333
|
-
ScreenStore.removeScreen(e.target);
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
ScreenStore.updateScreen(e.target, {
|
|
337
|
-
status: 0,
|
|
338
|
-
closing: true,
|
|
339
|
-
onAnimationFinish: handleFinish
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
var createScreenConfig = (config) => {
|
|
345
|
-
return {
|
|
346
|
-
listeners: (l) => createConfig({ ...l, ...config || {} })
|
|
347
|
-
};
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
// src/utils/default-screen-options.ts
|
|
351
|
-
var defaultScreenOptions = () => ({
|
|
352
|
-
presentation: "containedTransparentModal",
|
|
353
|
-
headerShown: false,
|
|
354
|
-
animation: "none"
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
// src/utils/noop-interpolator.ts
|
|
358
|
-
var noopinterpolator = () => {
|
|
359
|
-
"worklet";
|
|
360
|
-
return {
|
|
361
|
-
contentStyle: {},
|
|
362
|
-
overlayStyle: {}
|
|
363
|
-
};
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
// src/utils/gesture/apply-gesture-activation-criteria.ts
|
|
367
|
-
var applyGestureActivationCriteria = ({
|
|
368
|
-
gestureDirection,
|
|
369
|
-
gestureResponseDistance,
|
|
370
|
-
panGesture
|
|
371
|
-
}) => {
|
|
372
|
-
const directions = Array.isArray(gestureDirection) ? gestureDirection : [gestureDirection];
|
|
373
|
-
if (directions.includes("bidirectional")) {
|
|
374
|
-
return {
|
|
375
|
-
activeOffsetX: [
|
|
376
|
-
-gestureResponseDistance,
|
|
377
|
-
gestureResponseDistance
|
|
378
|
-
],
|
|
379
|
-
activeOffsetY: [
|
|
380
|
-
-gestureResponseDistance,
|
|
381
|
-
gestureResponseDistance
|
|
382
|
-
]
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
const allowedDown = directions.includes("vertical");
|
|
386
|
-
const allowedUp = directions.includes("vertical-inverted");
|
|
387
|
-
const allowedRight = directions.includes("horizontal");
|
|
388
|
-
const allowedLeft = directions.includes("horizontal-inverted");
|
|
389
|
-
const toleranceX = 15;
|
|
390
|
-
const toleranceY = 20;
|
|
391
|
-
const dist = gestureResponseDistance;
|
|
392
|
-
const result = {};
|
|
393
|
-
const hasHorizontal = allowedLeft || allowedRight;
|
|
394
|
-
if (hasHorizontal) {
|
|
395
|
-
if (allowedLeft && allowedRight) {
|
|
396
|
-
result.activeOffsetX = [-dist, dist];
|
|
397
|
-
} else if (allowedLeft) {
|
|
398
|
-
result.activeOffsetX = -dist;
|
|
399
|
-
} else if (allowedRight) {
|
|
400
|
-
result.activeOffsetX = dist;
|
|
401
|
-
}
|
|
402
|
-
if (allowedRight && !allowedLeft) {
|
|
403
|
-
result.failOffsetX = -dist;
|
|
404
|
-
} else if (allowedLeft && !allowedRight) {
|
|
405
|
-
result.failOffsetX = dist;
|
|
406
|
-
}
|
|
407
|
-
} else {
|
|
408
|
-
result.failOffsetX = [-toleranceX, toleranceX];
|
|
409
|
-
}
|
|
410
|
-
const hasVertical = allowedUp || allowedDown;
|
|
411
|
-
if (hasVertical) {
|
|
412
|
-
if (allowedUp && allowedDown) {
|
|
413
|
-
result.activeOffsetY = [-dist, dist];
|
|
414
|
-
} else if (allowedUp) {
|
|
415
|
-
result.activeOffsetY = -dist;
|
|
416
|
-
} else if (allowedDown) {
|
|
417
|
-
result.activeOffsetY = dist;
|
|
418
|
-
}
|
|
419
|
-
if (allowedDown && !allowedUp) {
|
|
420
|
-
result.failOffsetY = -dist;
|
|
421
|
-
} else if (allowedUp && !allowedDown) {
|
|
422
|
-
result.failOffsetY = dist;
|
|
423
|
-
}
|
|
424
|
-
} else {
|
|
425
|
-
result.failOffsetY = [-toleranceY, toleranceY];
|
|
426
|
-
}
|
|
427
|
-
if (result?.activeOffsetX) {
|
|
428
|
-
panGesture.activeOffsetX(result.activeOffsetX);
|
|
429
|
-
}
|
|
430
|
-
if (result?.activeOffsetY) {
|
|
431
|
-
panGesture.activeOffsetY(result.activeOffsetY);
|
|
432
|
-
}
|
|
433
|
-
if (result?.failOffsetX) {
|
|
434
|
-
panGesture.failOffsetX(result.failOffsetX);
|
|
435
|
-
}
|
|
436
|
-
if (result?.failOffsetY) {
|
|
437
|
-
panGesture.failOffsetY(result.failOffsetY);
|
|
438
|
-
}
|
|
439
|
-
panGesture.enableTrackpadTwoFingerGesture(true);
|
|
440
|
-
return panGesture;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
// src/utils/gesture/map-gesture-to-progress.ts
|
|
444
|
-
var mapGestureToProgress = (translation, dimension) => {
|
|
445
|
-
"worklet";
|
|
446
|
-
const rawProgress = translation / dimension;
|
|
447
|
-
return Math.max(0, Math.min(1, rawProgress));
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
// src/hooks/use-key.tsx
|
|
451
|
-
var import_native2 = require("@react-navigation/native");
|
|
452
|
-
var useKey = () => (0, import_native2.useRoute)().key;
|
|
453
|
-
|
|
454
|
-
// src/hooks/use-build-gestures.tsx
|
|
455
|
-
var GESTURE_VELOCITY_IMPACT = 0.3;
|
|
456
|
-
var DEFAULT_GESTURE_RESPONSE_DISTANCE = 50;
|
|
457
|
-
var DEFAULT_GESTURE_DIRECTION = "horizontal";
|
|
458
|
-
var DEFAULT_GESTURE_ENABLED = false;
|
|
459
|
-
var useBuildGestures = ({
|
|
460
|
-
scrollProgress
|
|
461
|
-
}) => {
|
|
462
|
-
const key = useKey();
|
|
463
|
-
const dimensions = (0, import_react_native.useWindowDimensions)();
|
|
464
|
-
const navigation = (0, import_native3.useNavigation)();
|
|
465
|
-
const currentScreen = ScreenStore.use(
|
|
466
|
-
(0, import_react3.useCallback)((state) => state.screens[key], [key])
|
|
467
|
-
);
|
|
468
|
-
const handleDismiss = (0, import_react3.useCallback)(
|
|
469
|
-
(screenBeingDismissed) => {
|
|
470
|
-
ScreenStore.handleScreenDismiss(screenBeingDismissed, navigation);
|
|
471
|
-
},
|
|
472
|
-
[navigation]
|
|
473
|
-
);
|
|
474
|
-
const initialTouch = (0, import_react_native_reanimated4.useSharedValue)({
|
|
475
|
-
x: 0,
|
|
476
|
-
y: 0
|
|
477
|
-
});
|
|
478
|
-
const translateX = animationValues.gestureX[key];
|
|
479
|
-
const translateY = animationValues.gestureY[key];
|
|
480
|
-
const normalizedGestureX = animationValues.normalizedGestureX[key];
|
|
481
|
-
const normalizedGestureY = animationValues.normalizedGestureY[key];
|
|
482
|
-
const isDragging = animationValues.gestureDragging[key];
|
|
483
|
-
const isDismissing = animationValues.isDismissing[key];
|
|
484
|
-
const progress = animationValues.screenProgress[key] || 0;
|
|
485
|
-
const {
|
|
486
|
-
gestureDirection = DEFAULT_GESTURE_DIRECTION,
|
|
487
|
-
gestureEnabled = DEFAULT_GESTURE_ENABLED,
|
|
488
|
-
transitionSpec = {
|
|
489
|
-
open: DefaultSpec,
|
|
490
|
-
close: DefaultSpec
|
|
491
|
-
},
|
|
492
|
-
gestureVelocityImpact = GESTURE_VELOCITY_IMPACT,
|
|
493
|
-
gestureResponseDistance = DEFAULT_GESTURE_RESPONSE_DISTANCE
|
|
494
|
-
} = currentScreen ?? {};
|
|
495
|
-
const directions = Array.isArray(gestureDirection) ? gestureDirection : [gestureDirection];
|
|
496
|
-
const nativeGesture = import_react_native_gesture_handler2.Gesture.Native();
|
|
497
|
-
const onTouchesDown = (0, import_react3.useCallback)(
|
|
498
|
-
(e) => {
|
|
499
|
-
"worklet";
|
|
500
|
-
const firstTouch = e.changedTouches[0];
|
|
501
|
-
initialTouch.value = { x: firstTouch.x, y: firstTouch.y };
|
|
502
|
-
},
|
|
503
|
-
[initialTouch]
|
|
504
|
-
);
|
|
505
|
-
const onTouchesMove = (0, import_react3.useCallback)(
|
|
506
|
-
(e, manager) => {
|
|
507
|
-
"worklet";
|
|
508
|
-
const touch = e.changedTouches[0];
|
|
509
|
-
const deltaX = touch.x - initialTouch.value.x;
|
|
510
|
-
const deltaY = touch.y - initialTouch.value.y;
|
|
511
|
-
const isVerticalSwipe = Math.abs(deltaY) > Math.abs(deltaX);
|
|
512
|
-
const isHorizontalSwipe = Math.abs(deltaX) > Math.abs(deltaY);
|
|
513
|
-
const isSwipingDown = isVerticalSwipe && deltaY > 0;
|
|
514
|
-
const isSwipingUp = isVerticalSwipe && deltaY < 0;
|
|
515
|
-
const isSwipingRight = isHorizontalSwipe && deltaX > 0;
|
|
516
|
-
const isSwipingLeft = isHorizontalSwipe && deltaX < 0;
|
|
517
|
-
const minMovement = 5;
|
|
518
|
-
const hasEnoughMovement = Math.abs(deltaX) > minMovement || Math.abs(deltaY) > minMovement;
|
|
519
|
-
if (!hasEnoughMovement) return;
|
|
520
|
-
if (isDragging.value) {
|
|
521
|
-
manager.activate();
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
let shouldActivate = false;
|
|
525
|
-
for (const direction of directions) {
|
|
526
|
-
switch (direction) {
|
|
527
|
-
case "vertical":
|
|
528
|
-
if (isSwipingDown) {
|
|
529
|
-
shouldActivate = scrollProgress.value.y <= 0;
|
|
530
|
-
}
|
|
531
|
-
break;
|
|
532
|
-
case "vertical-inverted":
|
|
533
|
-
if (isSwipingUp) {
|
|
534
|
-
const maxScrollableY = scrollProgress.value.contentHeight - scrollProgress.value.layoutHeight;
|
|
535
|
-
shouldActivate = scrollProgress.value.y >= maxScrollableY;
|
|
536
|
-
}
|
|
537
|
-
break;
|
|
538
|
-
case "horizontal":
|
|
539
|
-
if (isSwipingRight) {
|
|
540
|
-
shouldActivate = scrollProgress.value.x <= 0;
|
|
541
|
-
}
|
|
542
|
-
break;
|
|
543
|
-
case "horizontal-inverted":
|
|
544
|
-
if (isSwipingLeft) {
|
|
545
|
-
const maxProgress = scrollProgress.value.contentWidth - scrollProgress.value.layoutWidth;
|
|
546
|
-
shouldActivate = scrollProgress.value.x >= maxProgress;
|
|
547
|
-
}
|
|
548
|
-
break;
|
|
549
|
-
case "bidirectional":
|
|
550
|
-
if (isSwipingDown) {
|
|
551
|
-
shouldActivate = scrollProgress.value.y <= 0;
|
|
552
|
-
} else if (isSwipingUp) {
|
|
553
|
-
shouldActivate = scrollProgress.value.y <= 0;
|
|
554
|
-
} else if (isSwipingRight || isSwipingLeft) {
|
|
555
|
-
shouldActivate = true;
|
|
556
|
-
}
|
|
557
|
-
break;
|
|
558
|
-
}
|
|
559
|
-
if (shouldActivate) break;
|
|
560
|
-
}
|
|
561
|
-
if ((shouldActivate || isDragging.value) && !isDismissing.value) {
|
|
562
|
-
manager.activate();
|
|
563
|
-
} else {
|
|
564
|
-
manager.fail();
|
|
565
|
-
}
|
|
566
|
-
},
|
|
567
|
-
[initialTouch, directions, scrollProgress, isDragging, isDismissing]
|
|
568
|
-
);
|
|
569
|
-
const onStart = (0, import_react3.useCallback)(() => {
|
|
570
|
-
"worklet";
|
|
571
|
-
isDragging.value = 1;
|
|
572
|
-
isDismissing.value = 0;
|
|
573
|
-
}, [isDragging, isDismissing]);
|
|
574
|
-
const onUpdate = (0, import_react3.useCallback)(
|
|
575
|
-
(event) => {
|
|
576
|
-
"worklet";
|
|
577
|
-
let gestureProgress = 0;
|
|
578
|
-
translateX.value = event.translationX;
|
|
579
|
-
translateY.value = event.translationY;
|
|
580
|
-
normalizedGestureX.value = (0, import_react_native_reanimated4.interpolate)(
|
|
581
|
-
event.translationX,
|
|
582
|
-
[-dimensions.width, dimensions.width],
|
|
583
|
-
[-1, 1],
|
|
584
|
-
"clamp"
|
|
585
|
-
);
|
|
586
|
-
normalizedGestureY.value = (0, import_react_native_reanimated4.interpolate)(
|
|
587
|
-
event.translationY,
|
|
588
|
-
[-dimensions.height, dimensions.height],
|
|
589
|
-
[-1, 1],
|
|
590
|
-
"clamp"
|
|
591
|
-
);
|
|
592
|
-
if (directions.includes("bidirectional")) {
|
|
593
|
-
const distance = Math.sqrt(
|
|
594
|
-
event.translationX ** 2 + event.translationY ** 2
|
|
595
|
-
);
|
|
596
|
-
gestureProgress = mapGestureToProgress(distance, dimensions.width);
|
|
597
|
-
} else {
|
|
598
|
-
let maxProgress = 0;
|
|
599
|
-
const allowedDown = directions.includes("vertical");
|
|
600
|
-
const allowedUp = directions.includes("vertical-inverted");
|
|
601
|
-
const allowedRight = directions.includes("horizontal");
|
|
602
|
-
const allowedLeft = directions.includes("horizontal-inverted");
|
|
603
|
-
if (allowedRight && event.translationX > 0) {
|
|
604
|
-
const currentProgress = mapGestureToProgress(
|
|
605
|
-
event.translationX,
|
|
606
|
-
dimensions.width
|
|
607
|
-
);
|
|
608
|
-
maxProgress = Math.max(maxProgress, currentProgress);
|
|
609
|
-
}
|
|
610
|
-
if (allowedLeft && event.translationX < 0) {
|
|
611
|
-
const currentProgress = mapGestureToProgress(
|
|
612
|
-
-event.translationX,
|
|
613
|
-
dimensions.width
|
|
614
|
-
);
|
|
615
|
-
maxProgress = Math.max(maxProgress, currentProgress);
|
|
616
|
-
}
|
|
617
|
-
if (allowedDown && event.translationY > 0) {
|
|
618
|
-
const currentProgress = mapGestureToProgress(
|
|
619
|
-
event.translationY,
|
|
620
|
-
dimensions.height
|
|
621
|
-
);
|
|
622
|
-
maxProgress = Math.max(maxProgress, currentProgress);
|
|
623
|
-
}
|
|
624
|
-
if (allowedUp && event.translationY < 0) {
|
|
625
|
-
const currentProgress = mapGestureToProgress(
|
|
626
|
-
-event.translationY,
|
|
627
|
-
dimensions.height
|
|
628
|
-
);
|
|
629
|
-
maxProgress = Math.max(maxProgress, currentProgress);
|
|
630
|
-
}
|
|
631
|
-
gestureProgress = maxProgress;
|
|
632
|
-
}
|
|
633
|
-
progress.value = 1 - gestureProgress;
|
|
634
|
-
},
|
|
635
|
-
[
|
|
636
|
-
dimensions,
|
|
637
|
-
directions,
|
|
638
|
-
translateX,
|
|
639
|
-
translateY,
|
|
640
|
-
normalizedGestureX,
|
|
641
|
-
normalizedGestureY,
|
|
642
|
-
progress
|
|
643
|
-
]
|
|
644
|
-
);
|
|
645
|
-
const onEnd = (0, import_react3.useCallback)(
|
|
646
|
-
(event) => {
|
|
647
|
-
"worklet";
|
|
648
|
-
const { translationX, translationY, velocityX, velocityY } = event;
|
|
649
|
-
const dismissThreshold = 0.5;
|
|
650
|
-
if (directions.includes("bidirectional")) {
|
|
651
|
-
const finalX = Math.abs(
|
|
652
|
-
translationX + velocityX * gestureVelocityImpact
|
|
653
|
-
);
|
|
654
|
-
const finalY = Math.abs(
|
|
655
|
-
translationY + velocityY * gestureVelocityImpact
|
|
656
|
-
);
|
|
657
|
-
const finalDistance = Math.sqrt(finalX ** 2 + finalY ** 2);
|
|
658
|
-
isDismissing.value = Number(
|
|
659
|
-
finalDistance > dimensions.width * dismissThreshold
|
|
660
|
-
);
|
|
661
|
-
} else {
|
|
662
|
-
const allowedDown = directions.includes("vertical");
|
|
663
|
-
const allowedUp = directions.includes("vertical-inverted");
|
|
664
|
-
const allowedRight = directions.includes("horizontal");
|
|
665
|
-
const allowedLeft = directions.includes("horizontal-inverted");
|
|
666
|
-
if (allowedRight && translationX + velocityX * gestureVelocityImpact > dimensions.width * dismissThreshold) {
|
|
667
|
-
isDismissing.value = 1;
|
|
668
|
-
} else if (allowedLeft && -translationX - velocityX * gestureVelocityImpact > dimensions.width * dismissThreshold) {
|
|
669
|
-
isDismissing.value = 1;
|
|
670
|
-
} else if (allowedDown && translationY + velocityY * gestureVelocityImpact > dimensions.height * dismissThreshold) {
|
|
671
|
-
isDismissing.value = 1;
|
|
672
|
-
} else if (allowedUp && -translationY - velocityY * gestureVelocityImpact > dimensions.height * dismissThreshold) {
|
|
673
|
-
isDismissing.value = 1;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
const finalProgress = isDismissing.value ? 0 : 1;
|
|
677
|
-
const spec = isDismissing.value ? transitionSpec?.close : transitionSpec?.open;
|
|
678
|
-
const onFinish = isDismissing.value ? (isFinished) => {
|
|
679
|
-
"worklet";
|
|
680
|
-
if (isFinished) (0, import_react_native_reanimated4.runOnJS)(handleDismiss)(currentScreen?.id);
|
|
681
|
-
} : void 0;
|
|
682
|
-
progress.value = animate(finalProgress, spec, onFinish);
|
|
683
|
-
translateX.value = animate(0, spec);
|
|
684
|
-
translateY.value = animate(0, spec);
|
|
685
|
-
normalizedGestureX.value = animate(0, spec);
|
|
686
|
-
normalizedGestureY.value = animate(0, spec);
|
|
687
|
-
isDragging.value = 0;
|
|
688
|
-
},
|
|
689
|
-
[
|
|
690
|
-
dimensions,
|
|
691
|
-
directions,
|
|
692
|
-
translateX,
|
|
693
|
-
translateY,
|
|
694
|
-
normalizedGestureX,
|
|
695
|
-
normalizedGestureY,
|
|
696
|
-
progress,
|
|
697
|
-
handleDismiss,
|
|
698
|
-
currentScreen?.id,
|
|
699
|
-
transitionSpec?.close,
|
|
700
|
-
transitionSpec?.open,
|
|
701
|
-
gestureVelocityImpact,
|
|
702
|
-
isDragging,
|
|
703
|
-
isDismissing
|
|
704
|
-
]
|
|
705
|
-
);
|
|
706
|
-
const panGesture = (0, import_react3.useMemo)(
|
|
707
|
-
() => import_react_native_gesture_handler2.Gesture.Pan().enabled(gestureEnabled).manualActivation(true).onTouchesDown(onTouchesDown).onTouchesMove(onTouchesMove).onStart(onStart).onUpdate(onUpdate).onEnd(onEnd).blocksExternalGesture(nativeGesture),
|
|
708
|
-
[
|
|
709
|
-
gestureEnabled,
|
|
710
|
-
nativeGesture,
|
|
711
|
-
onTouchesDown,
|
|
712
|
-
onTouchesMove,
|
|
713
|
-
onStart,
|
|
714
|
-
onUpdate,
|
|
715
|
-
onEnd
|
|
716
|
-
]
|
|
717
|
-
);
|
|
718
|
-
applyGestureActivationCriteria({
|
|
719
|
-
gestureDirection,
|
|
720
|
-
gestureResponseDistance,
|
|
721
|
-
panGesture
|
|
722
|
-
});
|
|
723
|
-
return { panGesture, nativeGesture };
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
// src/components/transition-gesture-handler-provider.tsx
|
|
727
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
728
|
-
var TransitionGestureHandlerProvider = ({
|
|
729
|
-
children
|
|
730
|
-
}) => {
|
|
731
|
-
const scrollProgress = (0, import_react_native_reanimated5.useSharedValue)({
|
|
732
|
-
x: 0,
|
|
733
|
-
y: 0,
|
|
734
|
-
contentHeight: 0,
|
|
735
|
-
contentWidth: 0,
|
|
736
|
-
layoutHeight: 0,
|
|
737
|
-
layoutWidth: 0
|
|
738
|
-
});
|
|
739
|
-
const { panGesture, nativeGesture } = useBuildGestures({
|
|
740
|
-
scrollProgress
|
|
741
|
-
});
|
|
742
|
-
const value = (0, import_react4.useMemo)(() => {
|
|
743
|
-
return {
|
|
744
|
-
panGesture,
|
|
745
|
-
scrollProgress,
|
|
746
|
-
nativeGesture
|
|
747
|
-
};
|
|
748
|
-
}, [panGesture, scrollProgress, nativeGesture]);
|
|
749
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GestureContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_gesture_handler3.GestureDetector, { gesture: panGesture, children }) });
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
// src/hooks/use-screen-animation.tsx
|
|
753
|
-
var import_react5 = require("react");
|
|
754
|
-
var import_react_native2 = require("react-native");
|
|
755
|
-
var import_react_native_reanimated6 = require("react-native-reanimated");
|
|
756
|
-
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
757
|
-
var useAnimationBuilder = () => {
|
|
758
|
-
const key = useKey();
|
|
759
|
-
const dimensions = (0, import_react_native2.useWindowDimensions)();
|
|
760
|
-
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
761
|
-
const progressFallback = (0, import_react_native_reanimated6.useSharedValue)(0);
|
|
762
|
-
const gestureDraggingFallback = (0, import_react_native_reanimated6.useSharedValue)(0);
|
|
763
|
-
const gestureXFallback = (0, import_react_native_reanimated6.useSharedValue)(0);
|
|
764
|
-
const gestureYFallback = (0, import_react_native_reanimated6.useSharedValue)(0);
|
|
765
|
-
const normalizedGestureXFallback = (0, import_react_native_reanimated6.useSharedValue)(0);
|
|
766
|
-
const normalizedGestureYFallback = (0, import_react_native_reanimated6.useSharedValue)(0);
|
|
767
|
-
const isDismissingFallback = (0, import_react_native_reanimated6.useSharedValue)(0);
|
|
768
|
-
const currentScreen = ScreenStore.use(
|
|
769
|
-
(0, import_react5.useCallback)((state) => state.screens[key], [key])
|
|
770
|
-
);
|
|
771
|
-
const actualNextScreen = ScreenStore.use(
|
|
772
|
-
(0, import_react5.useCallback)(
|
|
773
|
-
(state) => {
|
|
774
|
-
const current = state.screens[key];
|
|
775
|
-
if (!current) return void 0;
|
|
776
|
-
const nextKey = state.screenKeys[current.index + 1];
|
|
777
|
-
const nextScreen = nextKey ? state.screens[nextKey] : void 0;
|
|
778
|
-
const shouldUseNext = nextScreen?.navigatorKey === current?.navigatorKey;
|
|
779
|
-
return shouldUseNext ? nextScreen : void 0;
|
|
780
|
-
},
|
|
781
|
-
[key]
|
|
782
|
-
)
|
|
783
|
-
);
|
|
784
|
-
const getAnimationValuesForScreen = (0, import_react5.useCallback)(
|
|
785
|
-
(screenId) => ({
|
|
786
|
-
progress: animationValues.screenProgress[screenId] || progressFallback,
|
|
787
|
-
gesture: {
|
|
788
|
-
isDragging: animationValues.gestureDragging[screenId] || gestureDraggingFallback,
|
|
789
|
-
x: animationValues.gestureX[screenId] || gestureXFallback,
|
|
790
|
-
y: animationValues.gestureY[screenId] || gestureYFallback,
|
|
791
|
-
normalizedX: animationValues.normalizedGestureX[screenId] || normalizedGestureXFallback,
|
|
792
|
-
normalizedY: animationValues.normalizedGestureY[screenId] || normalizedGestureYFallback,
|
|
793
|
-
isDismissing: animationValues.isDismissing[screenId] || isDismissingFallback
|
|
794
|
-
}
|
|
795
|
-
}),
|
|
796
|
-
[
|
|
797
|
-
progressFallback,
|
|
798
|
-
gestureDraggingFallback,
|
|
799
|
-
gestureXFallback,
|
|
800
|
-
gestureYFallback,
|
|
801
|
-
normalizedGestureXFallback,
|
|
802
|
-
normalizedGestureYFallback,
|
|
803
|
-
isDismissingFallback
|
|
804
|
-
]
|
|
805
|
-
);
|
|
806
|
-
return (0, import_react5.useMemo)(() => {
|
|
807
|
-
return {
|
|
808
|
-
current: getAnimationValuesForScreen(key),
|
|
809
|
-
next: actualNextScreen ? getAnimationValuesForScreen(actualNextScreen.id) : void 0,
|
|
810
|
-
layouts: { screen: dimensions },
|
|
811
|
-
insets,
|
|
812
|
-
closing: currentScreen?.closing || false,
|
|
813
|
-
screenStyleInterpolator: actualNextScreen?.screenStyleInterpolator || currentScreen?.screenStyleInterpolator || noopinterpolator
|
|
814
|
-
};
|
|
815
|
-
}, [
|
|
816
|
-
key,
|
|
817
|
-
currentScreen,
|
|
818
|
-
actualNextScreen,
|
|
819
|
-
dimensions,
|
|
820
|
-
insets,
|
|
821
|
-
getAnimationValuesForScreen
|
|
822
|
-
]);
|
|
823
|
-
};
|
|
824
|
-
var _useScreenAnimation = () => {
|
|
825
|
-
return useAnimationBuilder();
|
|
826
|
-
};
|
|
827
|
-
var useScreenAnimation = () => {
|
|
828
|
-
const { screenStyleInterpolator: _, ...animationProps } = useAnimationBuilder();
|
|
829
|
-
return animationProps;
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
// src/hooks/use-skip-first-frame.tsx
|
|
833
|
-
var import_react6 = require("react");
|
|
834
|
-
var import_react_native_reanimated7 = require("react-native-reanimated");
|
|
835
|
-
var useSkipFirstFrame = () => {
|
|
836
|
-
const opacity = (0, import_react_native_reanimated7.useSharedValue)(0);
|
|
837
|
-
const style = (0, import_react_native_reanimated7.useAnimatedStyle)(() => {
|
|
838
|
-
"worklet";
|
|
839
|
-
return {
|
|
840
|
-
opacity: opacity.value
|
|
841
|
-
};
|
|
842
|
-
});
|
|
843
|
-
(0, import_react6.useEffect)(() => {
|
|
844
|
-
requestAnimationFrame(() => {
|
|
845
|
-
opacity.value = 1;
|
|
846
|
-
});
|
|
847
|
-
}, [opacity]);
|
|
848
|
-
return { style };
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
// src/components/create-transition-aware-component.tsx
|
|
852
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
853
|
-
function createTransitionAwareComponent(Wrapped) {
|
|
854
|
-
const AnimatedComponent = import_react_native_reanimated8.default.createAnimatedComponent(Wrapped);
|
|
855
|
-
const Inner = (0, import_react7.forwardRef)(
|
|
856
|
-
(props, ref) => {
|
|
857
|
-
const { children, style, ...rest } = props;
|
|
858
|
-
const { screenStyleInterpolator, ...screenInterpolationProps } = _useScreenAnimation();
|
|
859
|
-
const screenContainerStyle = (0, import_react_native_reanimated8.useAnimatedStyle)(() => {
|
|
860
|
-
"worklet";
|
|
861
|
-
return screenStyleInterpolator(screenInterpolationProps).contentStyle || {};
|
|
862
|
-
});
|
|
863
|
-
const overlayStyle = (0, import_react_native_reanimated8.useAnimatedStyle)(() => {
|
|
864
|
-
"worklet";
|
|
865
|
-
return screenStyleInterpolator(screenInterpolationProps).overlayStyle || {};
|
|
866
|
-
});
|
|
867
|
-
const { style: flickerFixStyle } = useSkipFirstFrame();
|
|
868
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TransitionGestureHandlerProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native_reanimated8.default.View, { style: [{ flex: 1 }, flickerFixStyle], children: [
|
|
869
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
870
|
-
import_react_native_reanimated8.default.View,
|
|
871
|
-
{
|
|
872
|
-
style: [import_react_native3.StyleSheet.absoluteFillObject, overlayStyle],
|
|
873
|
-
pointerEvents: "none"
|
|
874
|
-
}
|
|
875
|
-
),
|
|
876
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
877
|
-
AnimatedComponent,
|
|
878
|
-
{
|
|
879
|
-
...rest,
|
|
880
|
-
ref,
|
|
881
|
-
style: [
|
|
882
|
-
{ flex: 1, position: "relative" },
|
|
883
|
-
screenContainerStyle,
|
|
884
|
-
style
|
|
885
|
-
],
|
|
886
|
-
children
|
|
887
|
-
}
|
|
888
|
-
)
|
|
889
|
-
] }) });
|
|
890
|
-
}
|
|
891
|
-
);
|
|
892
|
-
Inner.displayName = `Transition(${Wrapped.displayName || Wrapped.name || "Component"})`;
|
|
893
|
-
return (0, import_react7.memo)(Inner);
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
// src/components/create-transition-aware-scrollable.tsx
|
|
897
|
-
var import_react9 = require("react");
|
|
898
|
-
var import_react_native4 = require("react-native");
|
|
899
|
-
var import_react_native_gesture_handler4 = require("react-native-gesture-handler");
|
|
900
|
-
var import_react_native_reanimated10 = __toESM(require("react-native-reanimated"));
|
|
901
|
-
|
|
902
|
-
// src/hooks/use-scroll-progress.tsx
|
|
903
|
-
var import_react8 = require("react");
|
|
904
|
-
var import_react_native_reanimated9 = require("react-native-reanimated");
|
|
905
|
-
var useScrollProgress = (props) => {
|
|
906
|
-
const { scrollProgress } = useGestureContext();
|
|
907
|
-
const scrollHandler = (0, import_react_native_reanimated9.useAnimatedScrollHandler)({
|
|
908
|
-
onScroll: (event) => {
|
|
909
|
-
scrollProgress.modify((value) => {
|
|
910
|
-
"worklet";
|
|
911
|
-
return {
|
|
912
|
-
...value,
|
|
913
|
-
x: event.contentOffset.x,
|
|
914
|
-
y: event.contentOffset.y,
|
|
915
|
-
layoutHeight: event.layoutMeasurement.height,
|
|
916
|
-
layoutWidth: event.layoutMeasurement.width,
|
|
917
|
-
contentHeight: event.contentSize.height,
|
|
918
|
-
contentWidth: event.contentSize.width
|
|
919
|
-
};
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
});
|
|
923
|
-
const onContentSizeChange = (0, import_react8.useCallback)(
|
|
924
|
-
(width, height) => {
|
|
925
|
-
props.onContentSizeChange?.(width, height);
|
|
926
|
-
scrollProgress.modify((value) => {
|
|
927
|
-
"worklet";
|
|
928
|
-
return {
|
|
929
|
-
...value,
|
|
930
|
-
contentWidth: width,
|
|
931
|
-
contentHeight: height
|
|
932
|
-
};
|
|
933
|
-
});
|
|
934
|
-
},
|
|
935
|
-
[scrollProgress, props.onContentSizeChange]
|
|
936
|
-
);
|
|
937
|
-
return {
|
|
938
|
-
scrollHandler,
|
|
939
|
-
onContentSizeChange
|
|
940
|
-
};
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
// src/components/create-transition-aware-scrollable.tsx
|
|
944
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
945
|
-
function createTransitionAwareScrollable(ScrollableComponent) {
|
|
946
|
-
const WithTransitionAwareness = createTransitionAwareComponent(import_react_native4.View);
|
|
947
|
-
const AnimatedScrollableComponent = import_react_native_reanimated10.default.createAnimatedComponent(ScrollableComponent);
|
|
948
|
-
const WithScrollAwareness = (0, import_react9.forwardRef)((props, ref) => {
|
|
949
|
-
const { nativeGesture } = useGestureContext();
|
|
950
|
-
const { scrollHandler, onContentSizeChange } = useScrollProgress({
|
|
951
|
-
onScroll: props.onScroll,
|
|
952
|
-
onContentSizeChange: props.onContentSizeChange
|
|
953
|
-
});
|
|
954
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_gesture_handler4.GestureDetector, { gesture: nativeGesture, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
955
|
-
AnimatedScrollableComponent,
|
|
956
|
-
{
|
|
957
|
-
...props,
|
|
958
|
-
ref,
|
|
959
|
-
onScroll: scrollHandler,
|
|
960
|
-
onContentSizeChange,
|
|
961
|
-
scrollEventThrottle: props.scrollEventThrottle || 16
|
|
962
|
-
}
|
|
963
|
-
) });
|
|
964
|
-
});
|
|
965
|
-
const Wrapped = (0, import_react9.forwardRef)((props, ref) => {
|
|
966
|
-
const { isPlaceholder } = useGestureContext();
|
|
967
|
-
if (isPlaceholder) {
|
|
968
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WithTransitionAwareness, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WithScrollAwareness, { ...props, ref }) });
|
|
969
|
-
}
|
|
970
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WithScrollAwareness, { ...props, ref });
|
|
971
|
-
});
|
|
972
|
-
WithScrollAwareness.displayName = `Transition(${ScrollableComponent.displayName || ScrollableComponent.name || "Component"})`;
|
|
973
|
-
return (0, import_react9.memo)(Wrapped);
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
// src/configs/presets.ts
|
|
977
|
-
var presets_exports = {};
|
|
978
|
-
__export(presets_exports, {
|
|
979
|
-
DraggableCard: () => DraggableCard,
|
|
980
|
-
ElasticCard: () => ElasticCard,
|
|
981
|
-
SlideFromBottom: () => SlideFromBottom,
|
|
982
|
-
SlideFromTop: () => SlideFromTop,
|
|
983
|
-
ZoomIn: () => ZoomIn
|
|
984
|
-
});
|
|
985
|
-
var import_react_native_reanimated11 = require("react-native-reanimated");
|
|
986
|
-
var SlideFromTop = (config = {}) => {
|
|
987
|
-
return {
|
|
988
|
-
gestureEnabled: true,
|
|
989
|
-
gestureDirection: "vertical-inverted",
|
|
990
|
-
screenStyleInterpolator: ({
|
|
991
|
-
current,
|
|
992
|
-
next,
|
|
993
|
-
layouts: {
|
|
994
|
-
screen: { height }
|
|
995
|
-
}
|
|
996
|
-
}) => {
|
|
997
|
-
"worklet";
|
|
998
|
-
const progress = current.progress.value + (next?.progress.value ?? 0);
|
|
999
|
-
const y = (0, import_react_native_reanimated11.interpolate)(progress, [0, 1, 2], [-height, 0, height]);
|
|
1000
|
-
return {
|
|
1001
|
-
contentStyle: {
|
|
1002
|
-
transform: [{ translateY: y }]
|
|
1003
|
-
}
|
|
1004
|
-
};
|
|
1005
|
-
},
|
|
1006
|
-
transitionSpec: {
|
|
1007
|
-
open: DefaultSpec,
|
|
1008
|
-
close: DefaultSpec
|
|
1009
|
-
},
|
|
1010
|
-
...config
|
|
1011
|
-
};
|
|
1012
|
-
};
|
|
1013
|
-
var ZoomIn = (config = {}) => {
|
|
1014
|
-
return {
|
|
1015
|
-
gestureEnabled: false,
|
|
1016
|
-
screenStyleInterpolator: ({ current, next }) => {
|
|
1017
|
-
"worklet";
|
|
1018
|
-
const progress = current.progress.value + (next?.progress.value ?? 0);
|
|
1019
|
-
const scale = (0, import_react_native_reanimated11.interpolate)(
|
|
1020
|
-
progress,
|
|
1021
|
-
[0, 1, 2],
|
|
1022
|
-
[0.5, 1, 0.5],
|
|
1023
|
-
import_react_native_reanimated11.Extrapolation.CLAMP
|
|
1024
|
-
);
|
|
1025
|
-
const opacity = (0, import_react_native_reanimated11.interpolate)(
|
|
1026
|
-
progress,
|
|
1027
|
-
[0, 1, 2],
|
|
1028
|
-
[0, 1, 0],
|
|
1029
|
-
import_react_native_reanimated11.Extrapolation.CLAMP
|
|
1030
|
-
);
|
|
1031
|
-
return {
|
|
1032
|
-
contentStyle: {
|
|
1033
|
-
transform: [{ scale }],
|
|
1034
|
-
opacity
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
},
|
|
1038
|
-
transitionSpec: {
|
|
1039
|
-
open: DefaultSpec,
|
|
1040
|
-
close: DefaultSpec
|
|
1041
|
-
},
|
|
1042
|
-
...config
|
|
1043
|
-
};
|
|
1044
|
-
};
|
|
1045
|
-
var SlideFromBottom = (config = {}) => {
|
|
1046
|
-
return {
|
|
1047
|
-
gestureEnabled: true,
|
|
1048
|
-
gestureDirection: "vertical",
|
|
1049
|
-
screenStyleInterpolator: ({
|
|
1050
|
-
current,
|
|
1051
|
-
next,
|
|
1052
|
-
layouts: {
|
|
1053
|
-
screen: { height }
|
|
1054
|
-
}
|
|
1055
|
-
}) => {
|
|
1056
|
-
"worklet";
|
|
1057
|
-
const progress = current.progress.value + (next?.progress.value ?? 0);
|
|
1058
|
-
const y = (0, import_react_native_reanimated11.interpolate)(progress, [0, 1, 2], [height, 0, -height]);
|
|
1059
|
-
return {
|
|
1060
|
-
contentStyle: {
|
|
1061
|
-
transform: [{ translateY: y }]
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
},
|
|
1065
|
-
transitionSpec: {
|
|
1066
|
-
open: DefaultSpec,
|
|
1067
|
-
close: DefaultSpec
|
|
1068
|
-
},
|
|
1069
|
-
...config
|
|
1070
|
-
};
|
|
1071
|
-
};
|
|
1072
|
-
var DraggableCard = (config = {}) => {
|
|
1073
|
-
return {
|
|
1074
|
-
gestureEnabled: true,
|
|
1075
|
-
gestureDirection: ["horizontal", "vertical"],
|
|
1076
|
-
screenStyleInterpolator: ({ current, next, layouts: { screen } }) => {
|
|
1077
|
-
"worklet";
|
|
1078
|
-
const progress = current.progress.value + (next?.progress.value ?? 0);
|
|
1079
|
-
const scale = (0, import_react_native_reanimated11.interpolate)(progress, [0, 1, 2], [0, 1, 0.75]);
|
|
1080
|
-
const translateY = (0, import_react_native_reanimated11.interpolate)(
|
|
1081
|
-
current.gesture.normalizedY.value,
|
|
1082
|
-
[-1, 1],
|
|
1083
|
-
[-screen.height * 0.5, screen.height * 0.5],
|
|
1084
|
-
"clamp"
|
|
1085
|
-
);
|
|
1086
|
-
const translateX = (0, import_react_native_reanimated11.interpolate)(
|
|
1087
|
-
current.gesture.normalizedX.value,
|
|
1088
|
-
[-1, 1],
|
|
1089
|
-
[-screen.width * 0.5, screen.width * 0.5],
|
|
1090
|
-
"clamp"
|
|
1091
|
-
);
|
|
1092
|
-
return {
|
|
1093
|
-
contentStyle: {
|
|
1094
|
-
transform: [{ scale }, { translateY }, { translateX }]
|
|
1095
|
-
}
|
|
1096
|
-
};
|
|
1097
|
-
},
|
|
1098
|
-
transitionSpec: {
|
|
1099
|
-
open: DefaultSpec,
|
|
1100
|
-
close: DefaultSpec
|
|
1101
|
-
},
|
|
1102
|
-
...config
|
|
1103
|
-
};
|
|
1104
|
-
};
|
|
1105
|
-
var ElasticCard = (config = { elasticFactor: 0.5 }) => {
|
|
1106
|
-
return {
|
|
1107
|
-
gestureEnabled: true,
|
|
1108
|
-
gestureDirection: "bidirectional",
|
|
1109
|
-
screenStyleInterpolator: ({ current, next, layouts: { screen } }) => {
|
|
1110
|
-
"worklet";
|
|
1111
|
-
const progress = current.progress.value + (next?.progress.value ?? 0);
|
|
1112
|
-
const scale = (0, import_react_native_reanimated11.interpolate)(progress, [0, 1, 2], [0, 1, 0.8]);
|
|
1113
|
-
const maxElasticityX = screen.width * (config.elasticFactor ?? 0.5);
|
|
1114
|
-
const maxElasticityY = screen.height * (config.elasticFactor ?? 0.5);
|
|
1115
|
-
const translateX = (0, import_react_native_reanimated11.interpolate)(
|
|
1116
|
-
current.gesture.normalizedX.value,
|
|
1117
|
-
[-1, 0, 1],
|
|
1118
|
-
[-maxElasticityX, 0, maxElasticityX],
|
|
1119
|
-
"clamp"
|
|
1120
|
-
);
|
|
1121
|
-
const translateY = (0, import_react_native_reanimated11.interpolate)(
|
|
1122
|
-
current.gesture.normalizedY.value,
|
|
1123
|
-
[-1, 0, 1],
|
|
1124
|
-
[-maxElasticityY, 0, maxElasticityY],
|
|
1125
|
-
"clamp"
|
|
1126
|
-
);
|
|
1127
|
-
const overlayColor = (0, import_react_native_reanimated11.interpolateColor)(
|
|
1128
|
-
next?.progress.value || 0,
|
|
1129
|
-
[0, 1],
|
|
1130
|
-
["rgba(0,0,0,0)", "rgba(0,0,0,0.5)"]
|
|
1131
|
-
);
|
|
1132
|
-
return {
|
|
1133
|
-
contentStyle: {
|
|
1134
|
-
transform: [{ scale }, { translateX }, { translateY }]
|
|
1135
|
-
},
|
|
1136
|
-
overlayStyle: {
|
|
1137
|
-
backgroundColor: overlayColor
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
},
|
|
1141
|
-
...config
|
|
1142
|
-
};
|
|
1143
|
-
};
|
|
1144
|
-
|
|
1145
|
-
// src/index.ts
|
|
1146
|
-
var index_default = {
|
|
1147
|
-
View: createTransitionAwareComponent(import_react_native5.View),
|
|
1148
|
-
Pressable: createTransitionAwareComponent(import_react_native5.Pressable),
|
|
1149
|
-
ScrollView: createTransitionAwareScrollable(import_react_native5.ScrollView),
|
|
1150
|
-
FlatList: createTransitionAwareScrollable(import_react_native5.FlatList),
|
|
1151
|
-
createConfig,
|
|
1152
|
-
createScreenConfig,
|
|
1153
|
-
defaultScreenOptions,
|
|
1154
|
-
presets: presets_exports,
|
|
1155
|
-
specs: specs_exports,
|
|
1156
|
-
/**
|
|
1157
|
-
* Create a transition aware component
|
|
1158
|
-
*/
|
|
1159
|
-
createTransitionAwareComponent,
|
|
1160
|
-
/**
|
|
1161
|
-
* Create a transition aware scrollable component
|
|
1162
|
-
*/
|
|
1163
|
-
createTransitionAwareScrollable
|
|
1164
|
-
};
|
|
1165
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1166
|
-
0 && (module.exports = {
|
|
1167
|
-
useScreenAnimation
|
|
1168
|
-
});
|
|
1169
|
-
//# sourceMappingURL=index.js.map
|