react-native-screen-transitions 1.2.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 +211 -156
- 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 +67 -54
- package/dist/index.d.mts +0 -1513
- package/dist/index.d.ts +0 -1513
- package/dist/index.js +0 -1283
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1279
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, memo } from "react";
|
|
4
|
+
import { GestureDetector } from "react-native-gesture-handler";
|
|
5
|
+
import Animated, { runOnUI, useAnimatedRef } from "react-native-reanimated";
|
|
6
|
+
import { useAssociatedStyles } from "../hooks/animation/use-associated-style";
|
|
7
|
+
import { useBoundMeasurer } from "../hooks/bounds/use-bound-measurer";
|
|
8
|
+
import { useScrollProgress } from "../hooks/gestures/use-scroll-progress";
|
|
9
|
+
import { useGestureContext } from "../providers/gestures";
|
|
10
|
+
import { useKeys } from "../providers/keys";
|
|
11
|
+
import { BoundActivator } from "./bounds-activator";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
export function createTransitionAwareComponent(Wrapped, options = {}) {
|
|
14
|
+
const {
|
|
15
|
+
isScrollable = false
|
|
16
|
+
} = options;
|
|
17
|
+
const AnimatedComponent = Animated.createAnimatedComponent(Wrapped);
|
|
18
|
+
const ScrollableInner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
19
|
+
const {
|
|
20
|
+
nativeGesture
|
|
21
|
+
} = useGestureContext();
|
|
22
|
+
const {
|
|
23
|
+
scrollHandler,
|
|
24
|
+
onContentSizeChange,
|
|
25
|
+
onLayout
|
|
26
|
+
} = useScrollProgress({
|
|
27
|
+
onScroll: props.onScroll,
|
|
28
|
+
onContentSizeChange: props.onContentSizeChange,
|
|
29
|
+
onLayout: props.onLayout // Add this line to pass through onLayout
|
|
30
|
+
});
|
|
31
|
+
return /*#__PURE__*/_jsx(GestureDetector, {
|
|
32
|
+
gesture: nativeGesture,
|
|
33
|
+
children: /*#__PURE__*/_jsx(AnimatedComponent, {
|
|
34
|
+
...props,
|
|
35
|
+
ref: ref,
|
|
36
|
+
onScroll: scrollHandler,
|
|
37
|
+
onContentSizeChange: onContentSizeChange,
|
|
38
|
+
onLayout: onLayout,
|
|
39
|
+
scrollEventThrottle: props.scrollEventThrottle || 16
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
const Inner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
44
|
+
const {
|
|
45
|
+
children,
|
|
46
|
+
style,
|
|
47
|
+
sharedBoundTag,
|
|
48
|
+
styleId,
|
|
49
|
+
onPress,
|
|
50
|
+
...rest
|
|
51
|
+
} = props;
|
|
52
|
+
const animatedRef = useAnimatedRef();
|
|
53
|
+
const {
|
|
54
|
+
current
|
|
55
|
+
} = useKeys();
|
|
56
|
+
const {
|
|
57
|
+
associatedStyles
|
|
58
|
+
} = useAssociatedStyles({
|
|
59
|
+
id: sharedBoundTag || styleId
|
|
60
|
+
});
|
|
61
|
+
const {
|
|
62
|
+
measureAndSet,
|
|
63
|
+
measureOnLayout
|
|
64
|
+
} = useBoundMeasurer({
|
|
65
|
+
sharedBoundTag,
|
|
66
|
+
animatedRef,
|
|
67
|
+
current,
|
|
68
|
+
style
|
|
69
|
+
});
|
|
70
|
+
if (isScrollable) {
|
|
71
|
+
return /*#__PURE__*/_jsx(ScrollableInner, {
|
|
72
|
+
...props,
|
|
73
|
+
ref: ref
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/_jsx(BoundActivator, {
|
|
77
|
+
sharedBoundTag: sharedBoundTag,
|
|
78
|
+
measure: measureAndSet,
|
|
79
|
+
children: /*#__PURE__*/_jsx(AnimatedComponent, {
|
|
80
|
+
...rest,
|
|
81
|
+
ref: animatedRef,
|
|
82
|
+
style: [style, associatedStyles],
|
|
83
|
+
onPress: onPress,
|
|
84
|
+
onLayout: runOnUI(measureOnLayout),
|
|
85
|
+
children: children
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
return /*#__PURE__*/memo(Inner);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=create-transition-aware-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","memo","GestureDetector","Animated","runOnUI","useAnimatedRef","useAssociatedStyles","useBoundMeasurer","useScrollProgress","useGestureContext","useKeys","BoundActivator","jsx","_jsx","createTransitionAwareComponent","Wrapped","options","isScrollable","AnimatedComponent","createAnimatedComponent","ScrollableInner","props","ref","nativeGesture","scrollHandler","onContentSizeChange","onLayout","onScroll","gesture","children","scrollEventThrottle","Inner","style","sharedBoundTag","styleId","onPress","rest","animatedRef","current","associatedStyles","id","measureAndSet","measureOnLayout","measure"],"sourceRoot":"../../../src","sources":["components/create-transition-aware-component.tsx"],"mappings":";;AACA,SAA6BA,UAAU,EAAEC,IAAI,QAAQ,OAAO;AAE5D,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,OAAOC,QAAQ,IAAIC,OAAO,EAAEC,cAAc,QAAQ,yBAAyB;AAC3E,SAASC,mBAAmB,QAAQ,yCAAyC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;MAAEC,cAAc;MAAEC,OAAO;MAAEC,OAAO;MAAE,GAAGC;IAAK,CAAC,GACnEf,KAAY;IAEb,MAAMgB,WAAW,GAAGhC,cAAc,CAAO,CAAC;IAC1C,MAAM;MAAEiC;IAAQ,CAAC,GAAG5B,OAAO,CAAC,CAAC;IAE7B,MAAM;MAAE6B;IAAiB,CAAC,GAAGjC,mBAAmB,CAAC;MAChDkC,EAAE,EAAEP,cAAc,IAAIC;IACvB,CAAC,CAAC;IAEF,MAAM;MAAEO,aAAa;MAAEC;IAAgB,CAAC,GAAGnC,gBAAgB,CAAC;MAC3D0B,cAAc;MACdI,WAAW;MACXC,OAAO;MACPN;IACD,CAAC,CAAC;IAEF,IAAIf,YAAY,EAAE;MACjB,oBAAOJ,IAAA,CAACO,eAAe;QAAA,GAAMC,KAAK;QAAUC,GAAG,EAAEA;MAAI,CAAE,CAAC;IACzD;IAEA,oBACCT,IAAA,CAACF,cAAc;MAACsB,cAAc,EAAEA,cAAe;MAACU,OAAO,EAAEF,aAAc;MAAAZ,QAAA,eACtEhB,IAAA,CAACK,iBAAiB;QAAA,GACZkB,IAAI;QACTd,GAAG,EAAEe,WAAY;QACjBL,KAAK,EAAE,CAACA,KAAK,EAAEO,gBAAgB,CAAE;QACjCJ,OAAO,EAAEA,OAAQ;QACjBT,QAAQ,EAAEtB,OAAO,CAACsC,eAAe,CAAE;QAAAb,QAAA,EAElCA;MAAQ,CACS;IAAC,CACL,CAAC;EAEnB,CAAC,CAAC;EAEF,oBAAO5B,IAAI,CAAC8B,KAAK,CAAC;AAMnB","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import { StyleSheet } from "react-native";
|
|
5
|
+
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
6
|
+
import { _useScreenAnimation } from "../hooks/animation/use-screen-animation";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export const RootTransitionAware = /*#__PURE__*/memo(({
|
|
9
|
+
children
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
screenInterpolatorProps,
|
|
13
|
+
screenStyleInterpolator
|
|
14
|
+
} = _useScreenAnimation();
|
|
15
|
+
const animatedContentStyle = useAnimatedStyle(() => {
|
|
16
|
+
"worklet";
|
|
17
|
+
|
|
18
|
+
if (!screenStyleInterpolator) {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
const props = screenInterpolatorProps.value;
|
|
22
|
+
return screenStyleInterpolator(props).contentStyle || {};
|
|
23
|
+
});
|
|
24
|
+
const animatedOverlayStyle = useAnimatedStyle(() => {
|
|
25
|
+
"worklet";
|
|
26
|
+
|
|
27
|
+
if (!screenStyleInterpolator) {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
return screenStyleInterpolator(screenInterpolatorProps.value).overlayStyle || {};
|
|
31
|
+
});
|
|
32
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
33
|
+
style: styles.container,
|
|
34
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
35
|
+
style: [StyleSheet.absoluteFillObject, animatedOverlayStyle],
|
|
36
|
+
pointerEvents: "none"
|
|
37
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
38
|
+
style: [styles.content, animatedContentStyle],
|
|
39
|
+
children: children
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
const styles = StyleSheet.create({
|
|
44
|
+
container: {
|
|
45
|
+
flex: 1
|
|
46
|
+
},
|
|
47
|
+
content: {
|
|
48
|
+
flex: 1
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=root-transition-aware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","StyleSheet","Animated","useAnimatedStyle","_useScreenAnimation","jsx","_jsx","jsxs","_jsxs","RootTransitionAware","children","screenInterpolatorProps","screenStyleInterpolator","animatedContentStyle","props","value","contentStyle","animatedOverlayStyle","overlayStyle","View","style","styles","container","absoluteFillObject","pointerEvents","content","create","flex"],"sourceRoot":"../../../src","sources":["components/root-transition-aware.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,QAAQ,IAAIC,gBAAgB,QAAQ,yBAAyB;AACpE,SAASC,mBAAmB,QAAQ,yCAAyC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAM9E,OAAO,MAAMC,mBAAmB,gBAAGT,IAAI,CACtC,CAAC;EAAEU;AAAmC,CAAC,KAAK;EAC3C,MAAM;IAAEC,uBAAuB;IAAEC;EAAwB,CAAC,GACzDR,mBAAmB,CAAC,CAAC;EAEtB,MAAMS,oBAAoB,GAAGV,gBAAgB,CAAC,MAAM;IACnD,SAAS;;IACT,IAAI,CAACS,uBAAuB,EAAE;MAC7B,OAAO,CAAC,CAAC;IACV;IACA,MAAME,KAAK,GAAGH,uBAAuB,CAACI,KAAK;IAC3C,OAAOH,uBAAuB,CAACE,KAAK,CAAC,CAACE,YAAY,IAAI,CAAC,CAAC;EACzD,CAAC,CAAC;EAEF,MAAMC,oBAAoB,GAAGd,gBAAgB,CAAC,MAAM;IACnD,SAAS;;IACT,IAAI,CAACS,uBAAuB,EAAE;MAC7B,OAAO,CAAC,CAAC;IACV;IACA,OACCA,uBAAuB,CAACD,uBAAuB,CAACI,KAAK,CAAC,CAACG,YAAY,IACnE,CAAC,CAAC;EAEJ,CAAC,CAAC;EAEF,oBACCV,KAAA,CAACN,QAAQ,CAACiB,IAAI;IAACC,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAZ,QAAA,gBACtCJ,IAAA,CAACJ,QAAQ,CAACiB,IAAI;MACbC,KAAK,EAAE,CAACnB,UAAU,CAACsB,kBAAkB,EAAEN,oBAAoB,CAAE;MAC7DO,aAAa,EAAC;IAAM,CACpB,CAAC,eACFlB,IAAA,CAACJ,QAAQ,CAACiB,IAAI;MAACC,KAAK,EAAE,CAACC,MAAM,CAACI,OAAO,EAAEZ,oBAAoB,CAAE;MAAAH,QAAA,EAC3DA;IAAQ,CACK,CAAC;EAAA,CACF,CAAC;AAElB,CACD,CAAC;AAED,MAAMW,MAAM,GAAGpB,UAAU,CAACyB,MAAM,CAAC;EAChCJ,SAAS,EAAE;IACVK,IAAI,EAAE;EACP,CAAC;EACDF,OAAO,EAAE;IACRE,IAAI,EAAE;EACP;AACD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["presets","specs"],"sourceRoot":"../../../src","sources":["configs/index.ts"],"mappings":";;AAAA,OAAO,KAAKA,OAAO,MAAM,WAAW;AACpC,OAAO,KAAKC,KAAK,MAAM,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Extrapolation, interpolate, interpolateColor } from "react-native-reanimated";
|
|
4
|
+
import { DefaultSpec } from "./specs";
|
|
5
|
+
export const SlideFromTop = (config = {}) => {
|
|
6
|
+
return {
|
|
7
|
+
enableTransitions: true,
|
|
8
|
+
gestureEnabled: true,
|
|
9
|
+
gestureDirection: "vertical-inverted",
|
|
10
|
+
screenStyleInterpolator: ({
|
|
11
|
+
current,
|
|
12
|
+
next,
|
|
13
|
+
layouts: {
|
|
14
|
+
screen: {
|
|
15
|
+
height
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}) => {
|
|
19
|
+
"worklet";
|
|
20
|
+
|
|
21
|
+
const progress = current.progress + (next?.progress ?? 0);
|
|
22
|
+
const y = interpolate(progress, [0, 1, 2], [-height, 0, height]);
|
|
23
|
+
return {
|
|
24
|
+
contentStyle: {
|
|
25
|
+
transform: [{
|
|
26
|
+
translateY: y
|
|
27
|
+
}]
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
transitionSpec: {
|
|
32
|
+
open: DefaultSpec,
|
|
33
|
+
close: DefaultSpec
|
|
34
|
+
},
|
|
35
|
+
...config
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export const ZoomIn = (config = {}) => {
|
|
39
|
+
return {
|
|
40
|
+
enableTransitions: true,
|
|
41
|
+
gestureEnabled: false,
|
|
42
|
+
screenStyleInterpolator: ({
|
|
43
|
+
current,
|
|
44
|
+
next
|
|
45
|
+
}) => {
|
|
46
|
+
"worklet";
|
|
47
|
+
|
|
48
|
+
const progress = current.progress + (next?.progress ?? 0);
|
|
49
|
+
const scale = interpolate(progress, [0, 1, 2], [0.5, 1, 0.5], Extrapolation.CLAMP);
|
|
50
|
+
const opacity = interpolate(progress, [0, 1, 2], [0, 1, 0], Extrapolation.CLAMP);
|
|
51
|
+
return {
|
|
52
|
+
contentStyle: {
|
|
53
|
+
transform: [{
|
|
54
|
+
scale
|
|
55
|
+
}],
|
|
56
|
+
opacity
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
transitionSpec: {
|
|
61
|
+
open: DefaultSpec,
|
|
62
|
+
close: DefaultSpec
|
|
63
|
+
},
|
|
64
|
+
...config
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export const SlideFromBottom = (config = {}) => {
|
|
68
|
+
return {
|
|
69
|
+
enableTransitions: true,
|
|
70
|
+
gestureEnabled: true,
|
|
71
|
+
gestureDirection: "vertical",
|
|
72
|
+
screenStyleInterpolator: ({
|
|
73
|
+
current,
|
|
74
|
+
next,
|
|
75
|
+
layouts: {
|
|
76
|
+
screen: {
|
|
77
|
+
height
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}) => {
|
|
81
|
+
"worklet";
|
|
82
|
+
|
|
83
|
+
const progress = current.progress + (next?.progress ?? 0);
|
|
84
|
+
const y = interpolate(progress, [0, 1, 2], [height, 0, -height]);
|
|
85
|
+
return {
|
|
86
|
+
contentStyle: {
|
|
87
|
+
transform: [{
|
|
88
|
+
translateY: y
|
|
89
|
+
}]
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
transitionSpec: {
|
|
94
|
+
open: DefaultSpec,
|
|
95
|
+
close: DefaultSpec
|
|
96
|
+
},
|
|
97
|
+
...config
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export const DraggableCard = (config = {}) => {
|
|
101
|
+
return {
|
|
102
|
+
enableTransitions: true,
|
|
103
|
+
gestureEnabled: true,
|
|
104
|
+
gestureDirection: ["horizontal", "vertical"],
|
|
105
|
+
screenStyleInterpolator: ({
|
|
106
|
+
current,
|
|
107
|
+
progress,
|
|
108
|
+
layouts: {
|
|
109
|
+
screen
|
|
110
|
+
}
|
|
111
|
+
}) => {
|
|
112
|
+
"worklet";
|
|
113
|
+
|
|
114
|
+
/** Combined */
|
|
115
|
+
const scale = interpolate(progress, [0, 1, 2], [0, 1, 0.75]);
|
|
116
|
+
|
|
117
|
+
/** Vertical */
|
|
118
|
+
const translateY = interpolate(current.gesture.normalizedY, [-1, 1], [-screen.height * 0.5, screen.height * 0.5], "clamp");
|
|
119
|
+
|
|
120
|
+
/** Horizontal */
|
|
121
|
+
const translateX = interpolate(current.gesture.normalizedX, [-1, 1], [-screen.width * 0.5, screen.width * 0.5], "clamp");
|
|
122
|
+
return {
|
|
123
|
+
contentStyle: {
|
|
124
|
+
transform: [{
|
|
125
|
+
scale
|
|
126
|
+
}, {
|
|
127
|
+
translateY: translateY
|
|
128
|
+
}, {
|
|
129
|
+
translateX
|
|
130
|
+
}]
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
transitionSpec: {
|
|
135
|
+
open: DefaultSpec,
|
|
136
|
+
close: DefaultSpec
|
|
137
|
+
},
|
|
138
|
+
...config
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export const ElasticCard = (config = {
|
|
142
|
+
elasticFactor: 0.5
|
|
143
|
+
}) => {
|
|
144
|
+
return {
|
|
145
|
+
enableTransitions: true,
|
|
146
|
+
gestureEnabled: true,
|
|
147
|
+
gestureDirection: "bidirectional",
|
|
148
|
+
screenStyleInterpolator: ({
|
|
149
|
+
current,
|
|
150
|
+
next,
|
|
151
|
+
layouts: {
|
|
152
|
+
screen
|
|
153
|
+
},
|
|
154
|
+
progress
|
|
155
|
+
}) => {
|
|
156
|
+
"worklet";
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Applies to both screens ( previous and incoming)
|
|
160
|
+
*/
|
|
161
|
+
const scale = interpolate(progress, [0, 1, 2], [0, 1, 0.8]);
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Applies to current screen
|
|
165
|
+
*/
|
|
166
|
+
const maxElasticityX = screen.width * (config.elasticFactor ?? 0.5);
|
|
167
|
+
const maxElasticityY = screen.height * (config.elasticFactor ?? 0.5);
|
|
168
|
+
const translateX = interpolate(current.gesture.normalizedX, [-1, 0, 1], [-maxElasticityX, 0, maxElasticityX], "clamp");
|
|
169
|
+
const translateY = interpolate(current.gesture.normalizedY, [-1, 0, 1], [-maxElasticityY, 0, maxElasticityY], "clamp");
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Applies to unfocused screen ( previous screen )
|
|
173
|
+
*/
|
|
174
|
+
const overlayColor = interpolateColor(progress, [0, 1], ["rgba(0,0,0,0)", "rgba(0,0,0,0.5)"]);
|
|
175
|
+
return {
|
|
176
|
+
contentStyle: {
|
|
177
|
+
transform: [{
|
|
178
|
+
scale
|
|
179
|
+
}, {
|
|
180
|
+
translateX
|
|
181
|
+
}, {
|
|
182
|
+
translateY
|
|
183
|
+
}]
|
|
184
|
+
},
|
|
185
|
+
overlayStyle: {
|
|
186
|
+
backgroundColor: !next ? overlayColor : "rgba(0,0,0,0)"
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
transitionSpec: {
|
|
191
|
+
open: DefaultSpec,
|
|
192
|
+
close: DefaultSpec
|
|
193
|
+
},
|
|
194
|
+
...config
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
//# sourceMappingURL=presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Extrapolation","interpolate","interpolateColor","DefaultSpec","SlideFromTop","config","enableTransitions","gestureEnabled","gestureDirection","screenStyleInterpolator","current","next","layouts","screen","height","progress","y","contentStyle","transform","translateY","transitionSpec","open","close","ZoomIn","scale","CLAMP","opacity","SlideFromBottom","DraggableCard","gesture","normalizedY","translateX","normalizedX","width","ElasticCard","elasticFactor","maxElasticityX","maxElasticityY","overlayColor","overlayStyle","backgroundColor"],"sourceRoot":"../../../src","sources":["configs/presets.ts"],"mappings":";;AAAA,SACCA,aAAa,EACbC,WAAW,EACXC,gBAAgB,QACV,yBAAyB;AAEhC,SAASC,WAAW,QAAQ,SAAS;AAErC,OAAO,MAAMC,YAAY,GAAGA,CAC3BC,MAAuC,GAAG,CAAC,CAAC,KAChB;EAC5B,OAAO;IACNC,iBAAiB,EAAE,IAAI;IACvBC,cAAc,EAAE,IAAI;IACpBC,gBAAgB,EAAE,mBAAmB;IACrCC,uBAAuB,EAAEA,CAAC;MACzBC,OAAO;MACPC,IAAI;MACJC,OAAO,EAAE;QACRC,MAAM,EAAE;UAAEC;QAAO;MAClB;IACD,CAAC,KAAK;MACL,SAAS;;MAET,MAAMC,QAAQ,GAAGL,OAAO,CAACK,QAAQ,IAAIJ,IAAI,EAAEI,QAAQ,IAAI,CAAC,CAAC;MAEzD,MAAMC,CAAC,GAAGf,WAAW,CAACc,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAACD,MAAM,EAAE,CAAC,EAAEA,MAAM,CAAC,CAAC;MAEhE,OAAO;QACNG,YAAY,EAAE;UACbC,SAAS,EAAE,CAAC;YAAEC,UAAU,EAAEH;UAAE,CAAC;QAC9B;MACD,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AU,GAAG9B,WAAW,CAC7BS,OAAO,CAACmB,OAAO,CAACG,WAAW,EAC3B,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACV,CAAC,CAACI,cAAc,EAAE,CAAC,EAAEA,cAAc,CAAC,EACpC,OACD,CAAC;MAED,MAAMjB,UAAU,GAAGlB,WAAW,CAC7BS,OAAO,CAACmB,OAAO,CAACC,WAAW,EAC3B,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACV,CAAC,CAACO,cAAc,EAAE,CAAC,EAAEA,cAAc,CAAC,EACpC,OACD,CAAC;;MAED;AACH;AACA;MACG,MAAMC,YAAY,GAAGpC,gBAAgB,CACpCa,QAAQ,EACR,CAAC,CAAC,EAAE,CAAC,CAAC,EACN,CAAC,eAAe,EAAE,iBAAiB,CACpC,CAAC;MAED,OAAO;QACNE,YAAY,EAAE;UACbC,SAAS,EAAE,CAAC;YAAEM;UAAM,CAAC,EAAE;YAAEO;UAAW,CAAC,EAAE;YAAEZ;UAAW,CAAC;QACtD,CAAC;QACDoB,YAAY,EAAE;UACbC,eAAe,EAAE,CAAC7B,IAAI,GAAG2B,YAAY,GAAG;QACzC;MACD,CAAC;IACF,CAAC;IACDlB,cAAc,EAAE;MACfC,IAAI,EAAElB,WAAW;MACjBmB,KAAK,EAAEnB;IACR,CAAC;IACD,GAAGE;EACJ,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DefaultSpec","stiffness","damping","mass","overshootClamping","restSpeedThreshold"],"sourceRoot":"../../../src","sources":["configs/specs.ts"],"mappings":";;AAEA,OAAO,MAAMA,WAA6B,GAAG;EAC5CC,SAAS,EAAE,IAAI;EACfC,OAAO,EAAE,GAAG;EACZC,IAAI,EAAE,CAAC;EACPC,iBAAiB,EAAE,IAAI;EACvBC,kBAAkB,EAAE;AACrB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useAnimatedStyle } from "react-native-reanimated";
|
|
4
|
+
import { _useScreenAnimation } from "./use-screen-animation";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This hook is used to get the associated styles for a given styleId.
|
|
8
|
+
* It is used to get the associated styles for a given styleId.
|
|
9
|
+
* It is used to get the associated styles for a given styleId.
|
|
10
|
+
*/
|
|
11
|
+
export const useAssociatedStyles = ({
|
|
12
|
+
id
|
|
13
|
+
} = {}) => {
|
|
14
|
+
const {
|
|
15
|
+
screenStyleInterpolator,
|
|
16
|
+
screenInterpolatorProps
|
|
17
|
+
} = _useScreenAnimation();
|
|
18
|
+
const associatedStyles = useAnimatedStyle(() => {
|
|
19
|
+
"worklet";
|
|
20
|
+
|
|
21
|
+
if (!id || !screenStyleInterpolator) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
return screenStyleInterpolator(screenInterpolatorProps.value)[id] || {
|
|
25
|
+
opacity: 1 // <-- This fixes flickering?? We'll have to deep dive this?? wtf
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
associatedStyles
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=use-associated-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useAnimatedStyle","_useScreenAnimation","useAssociatedStyles","id","screenStyleInterpolator","screenInterpolatorProps","associatedStyles","value","opacity"],"sourceRoot":"../../../../src","sources":["hooks/animation/use-associated-style.tsx"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,mBAAmB,QAAQ,wBAAwB;;AAE5D;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC;AAAoB,CAAC,GAAG,CAAC,CAAC,KAAK;EACpE,MAAM;IAAEC,uBAAuB;IAAEC;EAAwB,CAAC,GACzDJ,mBAAmB,CAAC,CAAC;EAEtB,MAAMK,gBAAgB,GAAGN,gBAAgB,CAAC,MAAM;IAC/C,SAAS;;IAET,IAAI,CAACG,EAAE,IAAI,CAACC,uBAAuB,EAAE;MACpC,OAAO,CAAC,CAAC;IACV;IAEA,OACCA,uBAAuB,CAACC,uBAAuB,CAACE,KAAK,CAAC,CAACJ,EAAE,CAAC,IAAI;MAC7DK,OAAO,EAAE,CAAC,CAAE;IACb,CAAC;EAEH,CAAC,CAAC;EAEF,OAAO;IAAEF;EAAiB,CAAC;AAC5B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useWindowDimensions } from "react-native";
|
|
4
|
+
import { useDerivedValue } from "react-native-reanimated";
|
|
5
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
|
+
import { useKeys } from "../../providers/keys";
|
|
7
|
+
import { Animations } from "../../stores/animations";
|
|
8
|
+
import { Bounds } from "../../stores/bounds";
|
|
9
|
+
import { Gestures } from "../../stores/gestures";
|
|
10
|
+
import { buildBoundsAccessor } from "../../utils/bounds";
|
|
11
|
+
const FALLBACK = Object.freeze({
|
|
12
|
+
progress: 0,
|
|
13
|
+
closing: 0,
|
|
14
|
+
animating: 0,
|
|
15
|
+
gesture: {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0,
|
|
18
|
+
normalizedX: 0,
|
|
19
|
+
normalizedY: 0,
|
|
20
|
+
isDismissing: 0,
|
|
21
|
+
isDragging: 0
|
|
22
|
+
},
|
|
23
|
+
bounds: {},
|
|
24
|
+
route: {}
|
|
25
|
+
});
|
|
26
|
+
const useBuildScreenTransitionState = descriptor => {
|
|
27
|
+
const key = descriptor?.route.key;
|
|
28
|
+
if (!key) return undefined;
|
|
29
|
+
const progress = Animations.getAnimation(key, "progress");
|
|
30
|
+
const closing = Animations.getAnimation(key, "closing");
|
|
31
|
+
const animating = Animations.getAnimation(key, "animating");
|
|
32
|
+
const gesture = Gestures.getRouteGestures(key);
|
|
33
|
+
const route = descriptor?.route;
|
|
34
|
+
return {
|
|
35
|
+
progress,
|
|
36
|
+
closing,
|
|
37
|
+
animating,
|
|
38
|
+
gesture,
|
|
39
|
+
route
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const unwrap = (s, key) => {
|
|
43
|
+
"worklet";
|
|
44
|
+
|
|
45
|
+
return s && key ? {
|
|
46
|
+
progress: s.progress.value ?? 0,
|
|
47
|
+
closing: s.closing.value ?? 0,
|
|
48
|
+
animating: s.animating.value ?? 0,
|
|
49
|
+
gesture: {
|
|
50
|
+
x: s.gesture.x.value ?? 0,
|
|
51
|
+
y: s.gesture.y.value ?? 0,
|
|
52
|
+
normalizedX: s.gesture.normalizedX.value ?? 0,
|
|
53
|
+
normalizedY: s.gesture.normalizedY.value ?? 0,
|
|
54
|
+
isDismissing: s.gesture.isDismissing.value ?? 0,
|
|
55
|
+
isDragging: s.gesture.isDragging.value ?? 0
|
|
56
|
+
},
|
|
57
|
+
bounds: Bounds.getBounds(key) ?? {},
|
|
58
|
+
route: s.route
|
|
59
|
+
} : undefined;
|
|
60
|
+
};
|
|
61
|
+
export function _useScreenAnimation() {
|
|
62
|
+
const {
|
|
63
|
+
current: currentDescriptor,
|
|
64
|
+
next: nextDescriptor,
|
|
65
|
+
previous: previousDescriptor
|
|
66
|
+
} = useKeys();
|
|
67
|
+
const dimensions = useWindowDimensions();
|
|
68
|
+
const currentAnimation = useBuildScreenTransitionState(currentDescriptor);
|
|
69
|
+
const nextAnimation = useBuildScreenTransitionState(nextDescriptor);
|
|
70
|
+
const prevAnimation = useBuildScreenTransitionState(previousDescriptor);
|
|
71
|
+
const insets = useSafeAreaInsets();
|
|
72
|
+
const screenInterpolatorProps = useDerivedValue(() => {
|
|
73
|
+
"worklet";
|
|
74
|
+
|
|
75
|
+
const previous = unwrap(prevAnimation, previousDescriptor?.route.key);
|
|
76
|
+
const next = unwrap(nextAnimation, nextDescriptor?.route.key);
|
|
77
|
+
const current = unwrap(currentAnimation, currentDescriptor?.route.key) ?? FALLBACK;
|
|
78
|
+
const progress = current.progress + (next?.progress ?? 0);
|
|
79
|
+
const focused = !next;
|
|
80
|
+
const activeBoundId = Bounds.getActiveBoundId() || "";
|
|
81
|
+
const bounds = buildBoundsAccessor({
|
|
82
|
+
activeBoundId,
|
|
83
|
+
current,
|
|
84
|
+
previous,
|
|
85
|
+
next,
|
|
86
|
+
progress,
|
|
87
|
+
dimensions
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
layouts: {
|
|
91
|
+
screen: dimensions
|
|
92
|
+
},
|
|
93
|
+
insets,
|
|
94
|
+
previous,
|
|
95
|
+
current,
|
|
96
|
+
next,
|
|
97
|
+
focused,
|
|
98
|
+
activeBoundId,
|
|
99
|
+
progress,
|
|
100
|
+
bounds
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
const screenStyleInterpolator = nextDescriptor?.options.screenStyleInterpolator || currentDescriptor?.options.screenStyleInterpolator;
|
|
104
|
+
return {
|
|
105
|
+
screenInterpolatorProps,
|
|
106
|
+
screenStyleInterpolator
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export function useScreenAnimation() {
|
|
110
|
+
const {
|
|
111
|
+
screenInterpolatorProps
|
|
112
|
+
} = _useScreenAnimation();
|
|
113
|
+
return useDerivedValue(() => screenInterpolatorProps.value);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=use-screen-animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useWindowDimensions","useDerivedValue","useSafeAreaInsets","useKeys","Animations","Bounds","Gestures","buildBoundsAccessor","FALLBACK","Object","freeze","progress","closing","animating","gesture","x","y","normalizedX","normalizedY","isDismissing","isDragging","bounds","route","useBuildScreenTransitionState","descriptor","key","undefined","getAnimation","getRouteGestures","unwrap","s","value","getBounds","_useScreenAnimation","current","currentDescriptor","next","nextDescriptor","previous","previousDescriptor","dimensions","currentAnimation","nextAnimation","prevAnimation","insets","screenInterpolatorProps","focused","activeBoundId","getActiveBoundId","layouts","screen","screenStyleInterpolator","options","useScreenAnimation"],"sourceRoot":"../../../../src","sources":["hooks/animation/use-screen-animation.tsx"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAClD,SAA2BC,eAAe,QAAQ,yBAAyB;AAC3E,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAA0BC,QAAQ,QAAQ,uBAAuB;AAOjE,SAASC,mBAAmB,QAAQ,oBAAoB;AAUxD,MAAMC,QAAQ,GAAGC,MAAM,CAACC,MAAM,CAAC;EAC9BC,QAAQ,EAAE,CAAC;EACXC,OAAO,EAAE,CAAC;EACVC,SAAS,EAAE,CAAC;EACZC,OAAO,EAAE;IACRC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE,CAAC;IACfC,UAAU,EAAE;EACb,CAAC;EACDC,MAAM,EAAE,CAAC,CAA+B;EACxCC,KAAK,EAAE,CAAC;AACT,CAAC,CAAC;AAEF,MAAMC,6BAA6B,GAClCC,UAA6C,IACjB;EAC5B,MAAMC,GAAG,GAAGD,UAAU,EAAEF,KAAK,CAACG,GAAG;EACjC,IAAI,CAACA,GAAG,EAAE,OAAOC,SAAS;EAC1B,MAAMf,QAAQ,GAAGP,UAAU,CAACuB,YAAY,CAACF,GAAG,EAAE,UAAU,CAAC;EACzD,MAAMb,OAAO,GAAGR,UAAU,CAACuB,YAAY,CAACF,GAAG,EAAE,SAAS,CAAC;EACvD,MAAMZ,SAAS,GAAGT,UAAU,CAACuB,YAAY,CAACF,GAAG,EAAE,WAAW,CAAC;EAC3D,MAAMX,OAAO,GAAGR,QAAQ,CAACsB,gBAAgB,C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d,cAAc,EAAEe,OAAO,CAACD,uBAAuB,IAC/ChB,iBAAiB,EAAEiB,OAAO,CAACD,uBAAuB;EAEnD,OAAO;IAAEN,uBAAuB;IAAEM;EAAwB,CAAC;AAC5D;AACA,OAAO,SAASE,kBAAkBA,CAAA,EAAG;EACpC,MAAM;IAAER;EAAwB,CAAC,GAAGZ,mBAAmB,CAAC,CAAC;EAEzD,OAAOhC,eAAe,CAAC,MAAM4C,uBAAuB,CAACd,KAAK,CAAC;AAC5D","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { measure, useSharedValue } from "react-native-reanimated";
|
|
5
|
+
import { useKeys } from "../../providers/keys";
|
|
6
|
+
import { Bounds } from "../../stores/bounds";
|
|
7
|
+
import { flattenStyle } from "../../utils/bounds/flatten-styles";
|
|
8
|
+
import { useScreenAnimation } from "../animation/use-screen-animation";
|
|
9
|
+
export const useBoundMeasurer = ({
|
|
10
|
+
sharedBoundTag,
|
|
11
|
+
animatedRef,
|
|
12
|
+
current,
|
|
13
|
+
style
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
previous
|
|
17
|
+
} = useKeys();
|
|
18
|
+
const interpolatorProps = useScreenAnimation();
|
|
19
|
+
const hasAlreadyMeasured = useSharedValue(false);
|
|
20
|
+
const measureAndSet = useCallback(() => {
|
|
21
|
+
"worklet";
|
|
22
|
+
|
|
23
|
+
if (!sharedBoundTag) return;
|
|
24
|
+
const measured = measure(animatedRef);
|
|
25
|
+
if (measured) {
|
|
26
|
+
Bounds.setBounds(current.route.key, sharedBoundTag, measured, flattenStyle(style));
|
|
27
|
+
}
|
|
28
|
+
}, [sharedBoundTag, animatedRef, current.route.key, style]);
|
|
29
|
+
const measureOnLayout = useCallback(() => {
|
|
30
|
+
"worklet";
|
|
31
|
+
|
|
32
|
+
if (!sharedBoundTag || hasAlreadyMeasured.value) return;
|
|
33
|
+
const previousRouteKey = previous?.route.key;
|
|
34
|
+
if (!previousRouteKey) return;
|
|
35
|
+
const previousBounds = Bounds.getBounds(previousRouteKey);
|
|
36
|
+
const hasPreviousBoundForTag = previousBounds[sharedBoundTag];
|
|
37
|
+
if (interpolatorProps.value.current.animating && hasPreviousBoundForTag) {
|
|
38
|
+
measureAndSet();
|
|
39
|
+
hasAlreadyMeasured.value = true;
|
|
40
|
+
}
|
|
41
|
+
}, [measureAndSet, interpolatorProps, sharedBoundTag, previous?.route.key, hasAlreadyMeasured]);
|
|
42
|
+
return {
|
|
43
|
+
measureAndSet,
|
|
44
|
+
measureOnLayout
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=use-bound-measurer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","measure","useSharedValue","useKeys","Bounds","flattenStyle","useScreenAnimation","useBoundMeasurer","sharedBoundTag","animatedRef","current","style","previous","interpolatorProps","hasAlreadyMeasured","measureAndSet","measured","setBounds","route","key","measureOnLayout","value","previousRouteKey","previousBounds","getBounds","hasPreviousBoundForTag","animating"],"sourceRoot":"../../../../src","sources":["hooks/bounds/use-bound-measurer.tsx"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,OAAO;AAEnC,SAECC,OAAO,EAEPC,cAAc,QACR,yBAAyB;AAChC,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,YAAY,QAAQ,mCAAmC;AAChE,SAASC,kBAAkB,QAAQ,mCAAmC;AAStE,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAChCC,cAAc;EACdC,WAAW;EACXC,OAAO;EACPC;AACuB,CAAC,KAAK;EAC7B,MAAM;IAAEC;EAAS,CAAC,GAAGT,OAAO,CAAC,CAAC;EAC9B,MAAMU,iBAAiB,GAAGP,kBAAkB,CAAC,CAAC;EAC9C,MAAMQ,kBAAkB,GAAGZ,cAAc,CAA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