@lodev09/react-native-true-sheet 4.0.0-beta.0 → 4.0.0-beta.10
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 +1 -1
- package/README.md +62 -30
- package/RNTrueSheet.podspec +10 -2
- package/android/build.gradle +24 -2
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +189 -47
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerViewManager.kt +7 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +401 -19
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +18 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +145 -21
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterViewManager.kt +14 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetHeaderView.kt +38 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetHeaderViewManager.kt +28 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetModule.kt +84 -24
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +106 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayViewManager.kt +45 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +6 -4
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPeekView.kt +72 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPeekViewManager.kt +33 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +63 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +564 -226
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +1399 -598
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +161 -29
- package/android/src/main/java/com/lodev09/truesheet/core/RNScreensEventObserver.kt +63 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetBehavior.kt +36 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetView.kt +255 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +375 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +299 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDimView.kt +162 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetGrabberView.kt +180 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetKeyboardObserver.kt +207 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +137 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetStackManager.kt +220 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetDragEvents.kt +71 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetFocusEvents.kt +65 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetLifecycleEvents.kt +127 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetStateEvents.kt +56 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/KeyboardUtils.kt +84 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/ScreenUtils.kt +93 -67
- package/android/src/main/java/com/lodev09/truesheet/utils/TouchEventDeduper.kt +31 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/ViewUtils.kt +42 -0
- package/android/src/main/jni/CMakeLists.txt +63 -0
- package/android/src/main/jni/TrueSheetSpec.h +20 -0
- package/android/src/main/jni/TrueSheetStateUpdater.cpp +96 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +16 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +68 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +33 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +11 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +39 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h +24 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +63 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h +28 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.cpp +11 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h +41 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.cpp +18 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.h +16 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +46 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h +21 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.cpp +17 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h +36 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewComponentDescriptor.h +28 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +30 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.h +45 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.cpp +23 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.h +52 -0
- package/ios/TrueSheetContainerView.h +88 -6
- package/ios/TrueSheetContainerView.mm +278 -21
- package/ios/TrueSheetContentView.h +54 -1
- package/ios/TrueSheetContentView.mm +371 -47
- package/ios/TrueSheetFooterView.h +33 -2
- package/ios/TrueSheetFooterView.mm +187 -35
- package/ios/{events/OnWillDismissEvent.h → TrueSheetHeaderView.h} +10 -7
- package/ios/TrueSheetHeaderView.mm +64 -0
- package/ios/TrueSheetModule.h +2 -7
- package/ios/TrueSheetModule.mm +98 -20
- package/ios/TrueSheetOverlayView.h +32 -0
- package/ios/TrueSheetOverlayView.mm +161 -0
- package/ios/TrueSheetPeekView.h +32 -0
- package/ios/TrueSheetPeekView.mm +99 -0
- package/ios/TrueSheetView.h +7 -15
- package/ios/TrueSheetView.mm +775 -215
- package/ios/TrueSheetViewController.h +94 -16
- package/ios/TrueSheetViewController.mm +1316 -331
- package/ios/core/RNScreensEventObserver.h +46 -0
- package/ios/core/RNScreensEventObserver.mm +280 -0
- package/ios/core/TrueSheetBlurView.h +27 -0
- package/ios/core/TrueSheetBlurView.mm +82 -0
- package/ios/core/TrueSheetDetentCalculator.h +107 -0
- package/ios/core/TrueSheetDetentCalculator.mm +197 -0
- package/ios/core/TrueSheetGrabberView.h +72 -0
- package/ios/core/TrueSheetGrabberView.mm +188 -0
- package/ios/core/TrueSheetKeyboardObserver.h +39 -0
- package/ios/core/TrueSheetKeyboardObserver.mm +112 -0
- package/ios/core/TrueSheetOverlayContainerView.h +31 -0
- package/ios/core/TrueSheetOverlayContainerView.mm +35 -0
- package/ios/events/TrueSheetDragEvents.h +39 -0
- package/ios/events/TrueSheetDragEvents.mm +62 -0
- package/ios/events/{OnPositionChangeEvent.h → TrueSheetFocusEvents.h} +8 -5
- package/ios/events/TrueSheetFocusEvents.mm +49 -0
- package/ios/events/TrueSheetLifecycleEvents.h +42 -0
- package/ios/events/TrueSheetLifecycleEvents.mm +79 -0
- package/ios/events/TrueSheetStateEvents.h +35 -0
- package/ios/events/TrueSheetStateEvents.mm +49 -0
- package/ios/tvos/TrueSheetStubs.mm +166 -0
- package/ios/{events/OnMountEvent.h → utils/BlurUtil.h} +5 -7
- package/ios/utils/BlurUtil.mm +69 -0
- package/ios/utils/GestureUtil.h +7 -0
- package/ios/utils/GestureUtil.mm +12 -0
- package/ios/utils/PlatformUtil.h +15 -0
- package/ios/utils/UIView+FirstResponder.h +15 -0
- package/ios/utils/UIView+FirstResponder.mm +26 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.h +26 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.mm +84 -0
- package/ios/utils/WindowUtil.mm +17 -1
- package/lib/module/TrueSheet.js +349 -74
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +1270 -0
- package/lib/module/TrueSheet.web.js.map +1 -0
- package/lib/module/TrueSheetOverlay.js +30 -0
- package/lib/module/TrueSheetOverlay.js.map +1 -0
- package/lib/module/TrueSheetOverlay.web.js +35 -0
- package/lib/module/TrueSheetOverlay.web.js.map +1 -0
- package/lib/module/TrueSheetPeek.js +15 -0
- package/lib/module/TrueSheetPeek.js.map +1 -0
- package/lib/module/TrueSheetPeek.web.js +55 -0
- package/lib/module/TrueSheetPeek.web.js.map +1 -0
- package/lib/module/TrueSheetProvider.js +28 -0
- package/lib/module/TrueSheetProvider.js.map +1 -0
- package/lib/module/TrueSheetProvider.web.js +157 -0
- package/lib/module/TrueSheetProvider.web.js.map +1 -0
- package/lib/module/fabric/TrueSheetContainerViewNativeComponent.ts +1 -1
- package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +5 -1
- package/lib/module/fabric/TrueSheetFooterViewNativeComponent.ts +10 -2
- package/lib/module/fabric/TrueSheetHeaderViewNativeComponent.ts +8 -0
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/fabric/TrueSheetPeekViewNativeComponent.ts +8 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +110 -18
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +103 -0
- package/lib/module/mocks/index.js.map +1 -0
- package/lib/module/mocks/navigation.js +95 -0
- package/lib/module/mocks/navigation.js.map +1 -0
- package/lib/module/mocks/navigationExpoRouter.js +21 -0
- package/lib/module/mocks/navigationExpoRouter.js.map +1 -0
- package/lib/module/mocks/reanimated.js +91 -0
- package/lib/module/mocks/reanimated.js.map +1 -0
- package/lib/module/navigation/TrueSheetNavigatorContent.js +73 -0
- package/lib/module/navigation/TrueSheetNavigatorContent.js.map +1 -0
- package/lib/module/navigation/actions.js +50 -0
- package/lib/module/navigation/actions.js.map +1 -0
- package/lib/module/navigation/base-types.js +2 -0
- package/lib/module/navigation/base-types.js.map +1 -0
- package/lib/module/navigation/createTrueSheetRouter.js +157 -0
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -0
- package/lib/module/navigation/expo-router/base-types.js +2 -0
- package/lib/module/navigation/expo-router/base-types.js.map +1 -0
- package/lib/module/navigation/expo-router/index.js +50 -0
- package/lib/module/navigation/expo-router/index.js.map +1 -0
- package/lib/module/navigation/expo-router/types.js +4 -0
- package/lib/module/navigation/expo-router/types.js.map +1 -0
- package/lib/module/navigation/index.js +47 -0
- package/lib/module/navigation/index.js.map +1 -0
- package/lib/module/navigation/navigator.js +10 -0
- package/lib/module/navigation/navigator.js.map +1 -0
- package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js +56 -0
- package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js.map +1 -0
- package/lib/module/navigation/screen/TrueSheetScreen.js +49 -0
- package/lib/module/navigation/screen/TrueSheetScreen.js.map +1 -0
- package/lib/module/navigation/screen/index.js +5 -0
- package/lib/module/navigation/screen/index.js.map +1 -0
- package/lib/module/navigation/screen/types.js +4 -0
- package/lib/module/navigation/screen/types.js.map +1 -0
- package/lib/module/navigation/screen/useSheetScreenState.js +69 -0
- package/lib/module/navigation/screen/useSheetScreenState.js.map +1 -0
- package/lib/module/navigation/types.js +4 -0
- package/lib/module/navigation/types.js.map +1 -0
- package/lib/module/navigation/useTrueSheetNavigation.js +24 -0
- package/lib/module/navigation/useTrueSheetNavigation.js.map +1 -0
- package/lib/module/reanimated/ReanimatedTrueSheet.js +15 -9
- package/lib/module/reanimated/ReanimatedTrueSheet.js.map +1 -1
- package/lib/module/reanimated/ReanimatedTrueSheet.web.js +81 -0
- package/lib/module/reanimated/ReanimatedTrueSheet.web.js.map +1 -0
- package/lib/module/reanimated/ReanimatedTrueSheetProvider.js +4 -2
- package/lib/module/reanimated/ReanimatedTrueSheetProvider.js.map +1 -1
- package/lib/module/reanimated/index.js +2 -2
- package/lib/module/reanimated/index.js.map +1 -1
- package/lib/module/reanimated/useReanimatedPositionChangeHandler.web.js +20 -0
- package/lib/module/reanimated/useReanimatedPositionChangeHandler.web.js.map +1 -0
- package/lib/module/specs/NativeTrueSheetModule.js.map +1 -1
- package/lib/module/web/constants.js +16 -0
- package/lib/module/web/constants.js.map +1 -0
- package/lib/module/web/dom.js +10 -0
- package/lib/module/web/dom.js.map +1 -0
- package/lib/module/web/vaul/README.md +9 -0
- package/lib/module/web/vaul/browser.js +30 -0
- package/lib/module/web/vaul/browser.js.map +1 -0
- package/lib/module/web/vaul/constants.js +19 -0
- package/lib/module/web/vaul/constants.js.map +1 -0
- package/lib/module/web/vaul/context.js +59 -0
- package/lib/module/web/vaul/context.js.map +1 -0
- package/lib/module/web/vaul/helpers.js +99 -0
- package/lib/module/web/vaul/helpers.js.map +1 -0
- package/lib/module/web/vaul/index.js +1342 -0
- package/lib/module/web/vaul/index.js.map +1 -0
- package/lib/module/web/vaul/style.css +287 -0
- package/lib/module/web/vaul/style.css.d.js +2 -0
- package/lib/module/web/vaul/style.css.d.js.map +1 -0
- package/lib/module/web/vaul/types.js +2 -0
- package/lib/module/web/vaul/types.js.map +1 -0
- package/lib/module/web/vaul/use-composed-refs.js +34 -0
- package/lib/module/web/vaul/use-composed-refs.js.map +1 -0
- package/lib/module/web/vaul/use-controllable-state.js +54 -0
- package/lib/module/web/vaul/use-controllable-state.js.map +1 -0
- package/lib/module/web/vaul/use-position-fixed.js +123 -0
- package/lib/module/web/vaul/use-position-fixed.js.map +1 -0
- package/lib/module/web/vaul/use-prevent-scroll.js +258 -0
- package/lib/module/web/vaul/use-prevent-scroll.js.map +1 -0
- package/lib/module/web/vaul/use-scale-background.js +57 -0
- package/lib/module/web/vaul/use-scale-background.js.map +1 -0
- package/lib/module/web/vaul/use-snap-points.js +305 -0
- package/lib/module/web/vaul/use-snap-points.js.map +1 -0
- package/lib/typescript/src/TrueSheet.d.ts +57 -14
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +535 -55
- package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.web.d.ts +5 -0
- package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetPeek.d.ts +9 -0
- package/lib/typescript/src/TrueSheetPeek.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetPeek.web.d.ts +28 -0
- package/lib/typescript/src/TrueSheetPeek.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetProvider.d.ts +18 -0
- package/lib/typescript/src/TrueSheetProvider.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetProvider.web.d.ts +27 -0
- package/lib/typescript/src/TrueSheetProvider.web.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetContainerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetContentViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts +2 -0
- package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetHeaderViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetHeaderViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetPeekViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetPeekViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +71 -16
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/index.d.ts +47 -0
- package/lib/typescript/src/mocks/index.d.ts.map +1 -0
- package/lib/typescript/src/mocks/navigation.d.ts +70 -0
- package/lib/typescript/src/mocks/navigation.d.ts.map +1 -0
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts +22 -0
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -0
- package/lib/typescript/src/mocks/reanimated.d.ts +48 -0
- package/lib/typescript/src/mocks/reanimated.d.ts.map +1 -0
- package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts +5 -0
- package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts.map +1 -0
- package/lib/typescript/src/navigation/actions.d.ts +71 -0
- package/lib/typescript/src/navigation/actions.d.ts.map +1 -0
- package/lib/typescript/src/navigation/base-types.d.ts +9 -0
- package/lib/typescript/src/navigation/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +3 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts +8 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts +37 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts +44 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/index.d.ts +45 -0
- package/lib/typescript/src/navigation/index.d.ts.map +1 -0
- package/lib/typescript/src/navigation/navigator.d.ts +7 -0
- package/lib/typescript/src/navigation/navigator.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts +3 -0
- package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts +3 -0
- package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/index.d.ts +4 -0
- package/lib/typescript/src/navigation/screen/index.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/types.d.ts +14 -0
- package/lib/typescript/src/navigation/screen/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +34 -0
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -0
- package/lib/typescript/src/navigation/types.d.ts +213 -0
- package/lib/typescript/src/navigation/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts +23 -0
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/ReanimatedTrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/ReanimatedTrueSheet.web.d.ts +41 -0
- package/lib/typescript/src/reanimated/ReanimatedTrueSheet.web.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/ReanimatedTrueSheetProvider.d.ts +8 -2
- package/lib/typescript/src/reanimated/ReanimatedTrueSheetProvider.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/useReanimatedPositionChangeHandler.web.d.ts +15 -0
- package/lib/typescript/src/reanimated/useReanimatedPositionChangeHandler.web.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeTrueSheetModule.d.ts +25 -3
- package/lib/typescript/src/specs/NativeTrueSheetModule.d.ts.map +1 -1
- package/lib/typescript/src/web/constants.d.ts +14 -0
- package/lib/typescript/src/web/constants.d.ts.map +1 -0
- package/lib/typescript/src/web/dom.d.ts +7 -0
- package/lib/typescript/src/web/dom.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/browser.d.ts +8 -0
- package/lib/typescript/src/web/vaul/browser.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts +14 -0
- package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/context.d.ts +54 -0
- package/lib/typescript/src/web/vaul/context.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/helpers.d.ts +17 -0
- package/lib/typescript/src/web/vaul/helpers.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/index.d.ts +234 -0
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/types.d.ts +7 -0
- package/lib/typescript/src/web/vaul/types.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-composed-refs.d.ts +14 -0
- package/lib/typescript/src/web/vaul/use-composed-refs.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-controllable-state.d.ts +9 -0
- package/lib/typescript/src/web/vaul/use-controllable-state.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-position-fixed.d.ts +19 -0
- package/lib/typescript/src/web/vaul/use-position-fixed.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-prevent-scroll.d.ts +18 -0
- package/lib/typescript/src/web/vaul/use-prevent-scroll.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-scale-background.d.ts +2 -0
- package/lib/typescript/src/web/vaul/use-scale-background.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts +38 -0
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts.map +1 -0
- package/package.json +104 -37
- package/react-native.config.js +10 -2
- package/src/TrueSheet.tsx +424 -70
- package/src/TrueSheet.types.ts +602 -72
- package/src/TrueSheet.web.tsx +1437 -0
- package/src/TrueSheetOverlay.tsx +24 -0
- package/src/TrueSheetOverlay.web.tsx +33 -0
- package/src/TrueSheetPeek.tsx +11 -0
- package/src/TrueSheetPeek.web.tsx +64 -0
- package/src/TrueSheetProvider.tsx +33 -0
- package/src/TrueSheetProvider.web.tsx +220 -0
- package/src/fabric/TrueSheetContainerViewNativeComponent.ts +1 -1
- package/src/fabric/TrueSheetContentViewNativeComponent.ts +5 -1
- package/src/fabric/TrueSheetFooterViewNativeComponent.ts +10 -2
- package/src/fabric/TrueSheetHeaderViewNativeComponent.ts +8 -0
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/fabric/TrueSheetPeekViewNativeComponent.ts +8 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +110 -18
- package/src/index.ts +3 -2
- package/src/mocks/index.ts +96 -0
- package/src/mocks/navigation.ts +79 -0
- package/src/mocks/navigationExpoRouter.ts +41 -0
- package/src/mocks/reanimated.ts +100 -0
- package/src/navigation/TrueSheetNavigatorContent.tsx +106 -0
- package/src/navigation/actions.ts +78 -0
- package/src/navigation/base-types.ts +20 -0
- package/src/navigation/createTrueSheetRouter.ts +194 -0
- package/src/navigation/expo-router/base-types.ts +18 -0
- package/src/navigation/expo-router/index.ts +90 -0
- package/src/navigation/expo-router/types.ts +116 -0
- package/src/navigation/index.ts +80 -0
- package/src/navigation/navigator.ts +18 -0
- package/src/navigation/screen/ReanimatedTrueSheetScreen.tsx +61 -0
- package/src/navigation/screen/TrueSheetScreen.tsx +54 -0
- package/src/navigation/screen/index.ts +3 -0
- package/src/navigation/screen/types.ts +19 -0
- package/src/navigation/screen/useSheetScreenState.ts +102 -0
- package/src/navigation/types.ts +302 -0
- package/src/navigation/useTrueSheetNavigation.ts +26 -0
- package/src/reanimated/ReanimatedTrueSheet.tsx +12 -7
- package/src/reanimated/ReanimatedTrueSheet.web.tsx +75 -0
- package/src/reanimated/ReanimatedTrueSheetProvider.tsx +12 -8
- package/src/reanimated/useReanimatedPositionChangeHandler.web.ts +31 -0
- package/src/specs/NativeTrueSheetModule.ts +28 -3
- package/src/web/constants.ts +13 -0
- package/src/web/dom.ts +9 -0
- package/src/web/vaul/README.md +9 -0
- package/src/web/vaul/browser.ts +38 -0
- package/src/web/vaul/constants.ts +24 -0
- package/src/web/vaul/context.ts +102 -0
- package/src/web/vaul/helpers.ts +131 -0
- package/src/web/vaul/index.tsx +1785 -0
- package/src/web/vaul/style.css +287 -0
- package/src/web/vaul/style.css.d.ts +1 -0
- package/src/web/vaul/types.ts +7 -0
- package/src/web/vaul/use-composed-refs.ts +35 -0
- package/src/web/vaul/use-controllable-state.ts +66 -0
- package/src/web/vaul/use-position-fixed.ts +147 -0
- package/src/web/vaul/use-prevent-scroll.ts +309 -0
- package/src/web/vaul/use-scale-background.ts +64 -0
- package/src/web/vaul/use-snap-points.ts +455 -0
- package/android/src/main/java/com/lodev09/truesheet/events/DetentChangeEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/DidDismissEvent.kt +0 -20
- package/android/src/main/java/com/lodev09/truesheet/events/DidPresentEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/DragBeginEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/DragChangeEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/DragEndEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/MountEvent.kt +0 -20
- package/android/src/main/java/com/lodev09/truesheet/events/PositionChangeEvent.kt +0 -32
- package/android/src/main/java/com/lodev09/truesheet/events/SizeChangeEvent.kt +0 -27
- package/android/src/main/java/com/lodev09/truesheet/events/WillDismissEvent.kt +0 -20
- package/android/src/main/java/com/lodev09/truesheet/events/WillPresentEvent.kt +0 -26
- package/android/src/main/res/values/styles.xml +0 -8
- package/ios/events/OnDetentChangeEvent.h +0 -28
- package/ios/events/OnDetentChangeEvent.mm +0 -30
- package/ios/events/OnDidDismissEvent.h +0 -26
- package/ios/events/OnDidDismissEvent.mm +0 -25
- package/ios/events/OnDidPresentEvent.h +0 -28
- package/ios/events/OnDidPresentEvent.mm +0 -30
- package/ios/events/OnDragBeginEvent.h +0 -28
- package/ios/events/OnDragBeginEvent.mm +0 -30
- package/ios/events/OnDragChangeEvent.h +0 -28
- package/ios/events/OnDragChangeEvent.mm +0 -30
- package/ios/events/OnDragEndEvent.h +0 -28
- package/ios/events/OnDragEndEvent.mm +0 -30
- package/ios/events/OnMountEvent.mm +0 -25
- package/ios/events/OnPositionChangeEvent.mm +0 -32
- package/ios/events/OnSizeChangeEvent.h +0 -28
- package/ios/events/OnSizeChangeEvent.mm +0 -30
- package/ios/events/OnWillDismissEvent.mm +0 -25
- package/ios/events/OnWillPresentEvent.h +0 -28
- package/ios/events/OnWillPresentEvent.mm +0 -30
- package/ios/utils/LayoutUtil.h +0 -44
- package/ios/utils/LayoutUtil.mm +0 -50
- package/lib/module/TrueSheetGrabber.js +0 -51
- package/lib/module/TrueSheetGrabber.js.map +0 -1
- package/lib/typescript/src/TrueSheetGrabber.d.ts +0 -39
- package/lib/typescript/src/TrueSheetGrabber.d.ts.map +0 -1
- package/src/TrueSheetGrabber.tsx +0 -82
- package/src/__mocks__/index.js +0 -67
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["navigation/base-types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { TrueSheetActions } from "./actions.js";
|
|
4
|
+
const uid = () => Math.random().toString(36).slice(2, 10);
|
|
5
|
+
const ensureBaseRoute = (state, baseRouteName, routeParamList) => {
|
|
6
|
+
if (!baseRouteName) {
|
|
7
|
+
return state;
|
|
8
|
+
}
|
|
9
|
+
const hasBaseRoute = state.routes.some(r => r.name === baseRouteName);
|
|
10
|
+
if (!hasBaseRoute) {
|
|
11
|
+
const baseRoute = {
|
|
12
|
+
key: `${baseRouteName}-${uid()}`,
|
|
13
|
+
name: baseRouteName,
|
|
14
|
+
params: routeParamList?.[baseRouteName]
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
...state,
|
|
18
|
+
index: state.routes.length,
|
|
19
|
+
routes: [baseRoute, ...state.routes]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return state;
|
|
23
|
+
};
|
|
24
|
+
export const createTrueSheetRouter = stackRouter => routerOptions => {
|
|
25
|
+
const baseRouter = stackRouter(routerOptions);
|
|
26
|
+
return {
|
|
27
|
+
...baseRouter,
|
|
28
|
+
type: 'true-sheet',
|
|
29
|
+
getInitialState(options) {
|
|
30
|
+
const state = baseRouter.getInitialState(options);
|
|
31
|
+
const baseRouteName = routerOptions.initialRouteName ?? options.routeNames[0];
|
|
32
|
+
const stateWithBaseRoute = ensureBaseRoute(state, baseRouteName, options.routeParamList);
|
|
33
|
+
return {
|
|
34
|
+
...stateWithBaseRoute,
|
|
35
|
+
stale: false,
|
|
36
|
+
type: 'true-sheet',
|
|
37
|
+
key: `true-sheet-${uid()}`
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
getStateForAction(state, action, options) {
|
|
41
|
+
switch (action.type) {
|
|
42
|
+
case 'RESIZE':
|
|
43
|
+
{
|
|
44
|
+
const routeIndex = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
|
|
45
|
+
return {
|
|
46
|
+
...state,
|
|
47
|
+
routes: state.routes.map((route, i) => i === routeIndex ? {
|
|
48
|
+
...route,
|
|
49
|
+
resizeIndex: action.index,
|
|
50
|
+
resizeKey: (route.resizeKey ?? 0) + 1
|
|
51
|
+
} : route)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
case 'GO_BACK':
|
|
55
|
+
case 'DISMISS':
|
|
56
|
+
{
|
|
57
|
+
return this.getStateForAction(state, TrueSheetActions.pop(1), options);
|
|
58
|
+
}
|
|
59
|
+
case 'POP':
|
|
60
|
+
{
|
|
61
|
+
// Only base screen remains - let parent navigator handle it
|
|
62
|
+
if (state.routes.length <= 1) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const count = 'payload' in action && typeof action.payload?.count === 'number' ? action.payload.count : 1;
|
|
66
|
+
|
|
67
|
+
// Calculate how many routes we can actually pop (don't pop base screen)
|
|
68
|
+
const maxPopCount = state.routes.length - 1;
|
|
69
|
+
const actualCount = Math.min(count, maxPopCount);
|
|
70
|
+
|
|
71
|
+
// Base screen - let parent navigator handle it
|
|
72
|
+
if (actualCount <= 0) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Target index is the route we want to stay on (land on after pop)
|
|
77
|
+
// closingIndex is the first route to be dismissed (the one after target)
|
|
78
|
+
const targetIndex = state.routes.length - 1 - actualCount;
|
|
79
|
+
const closingIndex = targetIndex + 1;
|
|
80
|
+
|
|
81
|
+
// Mark only the bottom-most route to pop as closing
|
|
82
|
+
// The sheet's dismiss() will handle dismissing sheets above it first
|
|
83
|
+
return {
|
|
84
|
+
...state,
|
|
85
|
+
index: closingIndex,
|
|
86
|
+
routes: state.routes.map((route, i) => i === closingIndex ? {
|
|
87
|
+
...route,
|
|
88
|
+
closing: true
|
|
89
|
+
} : route)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
case 'POP_TO_TOP':
|
|
93
|
+
{
|
|
94
|
+
const popCount = state.routes.length - 1;
|
|
95
|
+
return this.getStateForAction(state, TrueSheetActions.pop(popCount), options);
|
|
96
|
+
}
|
|
97
|
+
case 'POP_TO':
|
|
98
|
+
{
|
|
99
|
+
const targetName = 'payload' in action && typeof action.payload?.name === 'string' ? action.payload.name : null;
|
|
100
|
+
if (!targetName) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const targetIndex = state.routes.findIndex(r => r.name === targetName);
|
|
104
|
+
|
|
105
|
+
// Target not found or is the current route
|
|
106
|
+
if (targetIndex === -1 || targetIndex >= state.index) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const popCount = state.routes.length - 1 - targetIndex;
|
|
110
|
+
return this.getStateForAction(state, TrueSheetActions.pop(popCount), options);
|
|
111
|
+
}
|
|
112
|
+
case 'REMOVE':
|
|
113
|
+
{
|
|
114
|
+
// Actually remove the closing route and all routes above it
|
|
115
|
+
const routeKey = action.source;
|
|
116
|
+
const routeIndex = routeKey ? state.routes.findIndex(r => r.key === routeKey) : state.routes.findIndex(r => r.closing);
|
|
117
|
+
if (routeIndex === -1) {
|
|
118
|
+
return state;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Remove the route and all routes above it (they were dismissed together)
|
|
122
|
+
const routes = state.routes.filter((_, i) => i < routeIndex);
|
|
123
|
+
return {
|
|
124
|
+
...state,
|
|
125
|
+
index: Math.min(state.index, routes.length - 1),
|
|
126
|
+
routes
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
default:
|
|
130
|
+
return baseRouter.getStateForAction(state, action, options);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
getRehydratedState(partialState, {
|
|
134
|
+
routeNames,
|
|
135
|
+
routeParamList,
|
|
136
|
+
routeGetIdList
|
|
137
|
+
}) {
|
|
138
|
+
if (partialState.stale === false) {
|
|
139
|
+
return partialState;
|
|
140
|
+
}
|
|
141
|
+
const state = baseRouter.getRehydratedState(partialState, {
|
|
142
|
+
routeNames,
|
|
143
|
+
routeParamList,
|
|
144
|
+
routeGetIdList
|
|
145
|
+
});
|
|
146
|
+
const baseRouteName = routerOptions.initialRouteName ?? routeNames[0];
|
|
147
|
+
const stateWithBaseRoute = ensureBaseRoute(state, baseRouteName, routeParamList);
|
|
148
|
+
return {
|
|
149
|
+
...stateWithBaseRoute,
|
|
150
|
+
type: 'true-sheet',
|
|
151
|
+
key: `true-sheet-${uid()}`
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
actionCreators: TrueSheetActions
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=createTrueSheetRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TrueSheetActions","uid","Math","random","toString","slice","ensureBaseRoute","state","baseRouteName","routeParamList","hasBaseRoute","routes","some","r","name","baseRoute","key","params","index","length","createTrueSheetRouter","stackRouter","routerOptions","baseRouter","type","getInitialState","options","initialRouteName","routeNames","stateWithBaseRoute","stale","getStateForAction","action","routeIndex","target","source","findIndex","map","route","i","resizeIndex","resizeKey","pop","count","payload","maxPopCount","actualCount","min","targetIndex","closingIndex","closing","popCount","targetName","routeKey","filter","_","getRehydratedState","partialState","routeGetIdList","actionCreators"],"sourceRoot":"../../../src","sources":["navigation/createTrueSheetRouter.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,cAAW;AAG5C,MAAMC,GAAG,GAAGA,CAAA,KAAMC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;AAEzD,MAAMC,eAAe,GAAGA,CACtBC,KAAQ,EACRC,aAAiC,EACjCC,cAA8D,KACf;EAC/C,IAAI,CAACD,aAAa,EAAE;IAClB,OAAOD,KAAK;EACd;EAEA,MAAMG,YAAY,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,KAAKN,aAAa,CAAC;EAEvE,IAAI,CAACE,YAAY,EAAE;IACjB,MAAMK,SAAS,GAAG;MAChBC,GAAG,EAAE,GAAGR,aAAa,IAAIP,GAAG,CAAC,CAAC,EAAE;MAChCa,IAAI,EAAEN,aAAa;MACnBS,MAAM,EAAER,cAAc,GAAGD,aAAa;IACxC,CAAC;IAED,OAAO;MACL,GAAGD,KAAK;MACRW,KAAK,EAAEX,KAAK,CAACI,MAAM,CAACQ,MAAM;MAC1BR,MAAM,EAAE,CAACI,SAAS,EAAE,GAAGR,KAAK,CAACI,MAAM;IACrC,CAAC;EACH;EAEA,OAAOJ,KA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AAC,EAAEhB,CAAC,KAAKA,CAAC,GAAGN,UAAU,CAAC;YAE5D,OAAO;cACL,GAAG1B,KAAK;cACRW,KAAK,EAAEhB,IAAI,CAAC6C,GAAG,CAACxC,KAAK,CAACW,KAAK,EAAEP,MAAM,CAACQ,MAAM,GAAG,CAAC,CAAC;cAC/CR;YACF,CAAC;UACH;QAEA;UACE,OAAOY,UAAU,CAACQ,iBAAiB,CAACxB,KAAK,EAAEyB,MAAM,EAAEN,OAAO,CAAC;MAC/D;IACF,CAAC;IAED8B,kBAAkBA,CAACC,YAAY,EAAE;MAAE7B,UAAU;MAAEnB,cAAc;MAAEiD;IAAe,CAAC,EAAE;MAC/E,IAAID,YAAY,CAAC3B,KAAK,KAAK,KAAK,EAAE;QAChC,OAAO2B,YAAY;MACrB;MAEA,MAAMlD,KAAK,GAAGgB,UAAU,CAACiC,kBAAkB,CAACC,YAAY,EAAE;QACxD7B,UAAU;QACVnB,cAAc;QACdiD;MACF,CAAC,CAAC;MAEF,MAAMlD,aAAa,GAAGc,aAAa,CAACK,gBAAgB,IAAIC,UAAU,CAAC,CAAC,CAAC;MACrE,MAAMC,kBAAkB,GAAGvB,eAAe,CAACC,KAAK,EAAEC,aAAa,EAAEC,cAAc,CAAC;MAEhF,OAAO;QACL,GAAGoB,kBAAkB;QACrBL,IAAI,EAAE,YAAY;QAClBR,GAAG,EAAE,cAAcf,GAAG,CAAC,CAAC;MAC1B,CAAC;IACH,CAAC;IAED0D,cAAc,EAAE3D;EAClB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["navigation/expo-router/base-types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StackRouter, unstable_integrateWithRouter, useNavigation } from 'expo-router';
|
|
4
|
+
import { createTrueSheetRouter } from "../createTrueSheetRouter.js";
|
|
5
|
+
import { trueSheetNavigator } from "../navigator.js";
|
|
6
|
+
// expo-router's vendored StackRouter is structurally identical to @react-navigation's.
|
|
7
|
+
// Pinned to this entry's own router types: `createTrueSheetRouter` is shared and typed
|
|
8
|
+
// against React Navigation, which resolves to `any` in apps that only install expo-router.
|
|
9
|
+
const sheetRouter = createTrueSheetRouter(StackRouter);
|
|
10
|
+
const SheetNavigator = unstable_integrateWithRouter(trueSheetNavigator, sheetRouter, {
|
|
11
|
+
createProps: ({
|
|
12
|
+
state,
|
|
13
|
+
dispatch
|
|
14
|
+
}) => ({
|
|
15
|
+
routes: state.routes,
|
|
16
|
+
dispatch
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Public props: `routes`/`dispatch` are injected by `createProps` (optional here
|
|
21
|
+
// so the navigator type stays comparable), and expo-router intersects the event
|
|
22
|
+
// map with an index signature which breaks precisely typed `screenListeners`
|
|
23
|
+
// callbacks - replace it with the exact map
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* TrueSheet navigator layout for Expo Router.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // app/sheet/_layout.tsx
|
|
31
|
+
* import { Sheet } from '@lodev09/react-native-true-sheet/navigation/expo-router';
|
|
32
|
+
*
|
|
33
|
+
* export default function SheetLayout() {
|
|
34
|
+
* return (
|
|
35
|
+
* <Sheet initialRouteName="(home)">
|
|
36
|
+
* <Sheet.Screen name="details" options={{ detents: [0.5, 1] }} />
|
|
37
|
+
* </Sheet>
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export const Sheet = SheetNavigator;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Hook to access TrueSheet navigation with the resize helper.
|
|
46
|
+
* Built on expo-router's `useNavigation`.
|
|
47
|
+
*/
|
|
48
|
+
export const useTrueSheetNavigation = () => useNavigation();
|
|
49
|
+
export { TrueSheetActions } from "../actions.js";
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StackRouter","unstable_integrateWithRouter","useNavigation","createTrueSheetRouter","trueSheetNavigator","sheetRouter","SheetNavigator","createProps","state","dispatch","routes","Sheet","useTrueSheetNavigation","TrueSheetActions"],"sourceRoot":"../../../../src","sources":["navigation/expo-router/index.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,4BAA4B,EAAEC,aAAa,QAAQ,aAAa;AAEtF,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,kBAAkB,QAAQ,iBAAc;AAcjD;AACA;AACA;AACA,MAAMC,WAAmC,GAAGF,qBAAqB,CAC/DH,WACF,CAAC;AAED,MAAMM,cAAc,GAAGL,4BAA4B,CAMjDG,kBAAkB,EAAEC,WAAW,EAAE;EACjCE,WAAW,EAAEA,CAAC;IAAEC,KAAK;IAAEC;EAAS,CAAC,MAAM;IACrCC,MAAM,EAAEF,KAAK,CAACE,MAAM;IACpBD;EACF,CAAC;AACH,CAAC,CAAC;;AAEF;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,KAAK,GAAGL,cAGpB;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMM,sBAAsB,GAAGA,CAAA,KAEHV,aAAa,CAA6B,CAAC;AAE9E,SAASW,gBAAgB,QAAkC,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["navigation/expo-router/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createStandardNavigationFactories, StackRouter } from '@react-navigation/native';
|
|
4
|
+
import { createTrueSheetRouter } from "./createTrueSheetRouter.js";
|
|
5
|
+
import { trueSheetNavigator } from "./navigator.js";
|
|
6
|
+
const {
|
|
7
|
+
createNavigator,
|
|
8
|
+
createScreen
|
|
9
|
+
} = createStandardNavigationFactories(trueSheetNavigator, createTrueSheetRouter(StackRouter), ({
|
|
10
|
+
state,
|
|
11
|
+
navigation
|
|
12
|
+
}) => ({
|
|
13
|
+
routes: state.routes,
|
|
14
|
+
dispatch: navigation.dispatch
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a TrueSheet navigator.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const Sheet = createTrueSheetNavigator();
|
|
23
|
+
*
|
|
24
|
+
* function App() {
|
|
25
|
+
* return (
|
|
26
|
+
* <Sheet.Navigator>
|
|
27
|
+
* <Sheet.Screen name="Home" component={HomeScreen} />
|
|
28
|
+
* <Sheet.Screen
|
|
29
|
+
* name="Details"
|
|
30
|
+
* component={DetailsSheet}
|
|
31
|
+
* options={{ detents: [0.5, 1] }}
|
|
32
|
+
* />
|
|
33
|
+
* </Sheet.Navigator>
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export const createTrueSheetNavigator = createNavigator;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a screen configuration for the static API.
|
|
42
|
+
*/
|
|
43
|
+
export const createTrueSheetScreen = createScreen;
|
|
44
|
+
export { TrueSheetActions } from "./actions.js";
|
|
45
|
+
export { createTrueSheetRouter } from "./createTrueSheetRouter.js";
|
|
46
|
+
export { useTrueSheetNavigation } from "./useTrueSheetNavigation.js";
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createStandardNavigationFactories","StackRouter","createTrueSheetRouter","trueSheetNavigator","createNavigator","createScreen","state","navigation","routes","dispatch","createTrueSheetNavigator","createTrueSheetScreen","TrueSheetActions","useTrueSheetNavigation"],"sourceRoot":"../../../src","sources":["navigation/index.ts"],"mappings":";;AAAA,SACEA,iCAAiC,EACjCC,WAAW,QAEN,0BAA0B;AAEjC,SAASC,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASC,kBAAkB,QAAQ,gBAAa;AAmBhD,MAAM;EAAEC,eAAe;EAAEC;AAAa,CAAC,GAAGL,iCAAiC,CAKzEG,kBAAkB,EAClBD,qBAAqB,CAACD,WAAiC,CAAC,EACxD,CAAC;EAAEK,KAAK;EAAEC;AAAW,CAAC,MAAM;EAAEC,MAAM,EAAEF,KAAK,CAACE,MAAM;EAAEC,QAAQ,EAAEF,UAAU,CAACE;AAAS,CAAC,CACrF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAGN,eAAe;;AAEvD;AACA;AACA;AACA,OAAO,MAAMO,qBAAqB,GAAGN,YAAY;AAEjD,SAASO,gBAAgB,QAAkC,cAAW;AACtE,SAASV,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASW,sBAAsB,QAAQ,6BAA0B","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createStandardNavigator } from 'standard-navigation';
|
|
4
|
+
import { TrueSheetNavigatorContent } from "./TrueSheetNavigatorContent.js";
|
|
5
|
+
/**
|
|
6
|
+
* Framework-agnostic TrueSheet navigator.
|
|
7
|
+
* Wired into React Navigation via `./index` and Expo Router via `./expo-router`.
|
|
8
|
+
*/
|
|
9
|
+
export const trueSheetNavigator = createStandardNavigator(TrueSheetNavigatorContent);
|
|
10
|
+
//# sourceMappingURL=navigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createStandardNavigator","TrueSheetNavigatorContent","trueSheetNavigator"],"sourceRoot":"../../../src","sources":["navigation/navigator.ts"],"mappings":";;AAAA,SAASA,uBAAuB,QAAQ,qBAAqB;AAE7D,SAASC,yBAAyB,QAAQ,gCAA6B;AAOvE;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGF,uBAAuB,CAIvDC,yBAAyB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Animated from 'react-native-reanimated';
|
|
4
|
+
import { scheduleOnRN } from 'react-native-worklets';
|
|
5
|
+
import { useReanimatedPositionChangeHandler } from "../../reanimated/index.js";
|
|
6
|
+
import { TrueSheet } from '../../TrueSheet';
|
|
7
|
+
import { useSheetScreenState } from "./useSheetScreenState.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const AnimatedTrueSheet = Animated.createAnimatedComponent(TrueSheet);
|
|
10
|
+
export const ReanimatedTrueSheetScreen = ({
|
|
11
|
+
detentIndex,
|
|
12
|
+
resizeKey,
|
|
13
|
+
dispatch,
|
|
14
|
+
emit,
|
|
15
|
+
routeKey,
|
|
16
|
+
closing,
|
|
17
|
+
detents,
|
|
18
|
+
children,
|
|
19
|
+
positionChangeHandler,
|
|
20
|
+
...sheetProps
|
|
21
|
+
}) => {
|
|
22
|
+
const {
|
|
23
|
+
ref,
|
|
24
|
+
initialDetentIndex,
|
|
25
|
+
eventHandlers: {
|
|
26
|
+
onPositionChange,
|
|
27
|
+
...eventHandlers
|
|
28
|
+
}
|
|
29
|
+
} = useSheetScreenState({
|
|
30
|
+
detentIndex,
|
|
31
|
+
resizeKey,
|
|
32
|
+
closing,
|
|
33
|
+
dispatch,
|
|
34
|
+
routeKey,
|
|
35
|
+
emit
|
|
36
|
+
});
|
|
37
|
+
const reanimatedPositionChangeHandler = useReanimatedPositionChangeHandler(payload => {
|
|
38
|
+
'worklet';
|
|
39
|
+
|
|
40
|
+
positionChangeHandler?.(payload);
|
|
41
|
+
scheduleOnRN(onPositionChange, {
|
|
42
|
+
nativeEvent: payload
|
|
43
|
+
});
|
|
44
|
+
}, [onPositionChange, positionChangeHandler]);
|
|
45
|
+
return /*#__PURE__*/_jsx(AnimatedTrueSheet, {
|
|
46
|
+
ref: ref,
|
|
47
|
+
name: `navigation-sheet-${routeKey}`,
|
|
48
|
+
initialDetentIndex: initialDetentIndex,
|
|
49
|
+
detents: detents,
|
|
50
|
+
onPositionChange: reanimatedPositionChangeHandler,
|
|
51
|
+
...sheetProps,
|
|
52
|
+
...eventHandlers,
|
|
53
|
+
children: children
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=ReanimatedTrueSheetScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Animated","scheduleOnRN","useReanimatedPositionChangeHandler","TrueSheet","useSheetScreenState","jsx","_jsx","AnimatedTrueSheet","createAnimatedComponent","ReanimatedTrueSheetScreen","detentIndex","resizeKey","dispatch","emit","routeKey","closing","detents","children","positionChangeHandler","sheetProps","ref","initialDetentIndex","eventHandlers","onPositionChange","reanimatedPositionChangeHandler","payload","nativeEvent","name"],"sourceRoot":"../../../../src","sources":["navigation/screen/ReanimatedTrueSheetScreen.tsx"],"mappings":";;AAAA,OAAOA,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,YAAY,QAAQ,uBAAuB;AAEpD,SAASC,kCAAkC,QAAQ,2BAAkB;AACrE,SAASC,SAAS,QAAQ,iBAAiB;AAG3C,SAASC,mBAAmB,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5D,MAAMC,iBAAiB,GAAGP,QAAQ,CAACQ,uBAAuB,CAACL,SAAS,CAAC;AAErE,OAAO,MAAMM,yBAAyB,GAAGA,CAAC;EACxCC,WAAW;EACXC,SAAS;EACTC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,OAAO;EACPC,OAAO;EACPC,QAAQ;EACRC,qBAAqB;EACrB,GAAGC;AACiB,CAAC,KAAK;EAC1B,MAAM;IACJC,GAAG;IACHC,kBAAkB;IAClBC,aAAa,EAAE;MAAEC,gBAAgB;MAAE,GAAGD;IAAc;EACtD,CAAC,GAAGlB,mBAAmB,CAAC;IACtBM,WAAW;IACXC,SAAS;IACTI,OAAO;IACPH,QAAQ;IACRE,QAAQ;IACRD;EACF,CAAC,CAAC;EAEF,MAAMW,+BAA+B,GAAGtB,kCAAkC,CACvEuB,OAAO,IAAK;IACX,SAAS;;IACTP,qBAAqB,GAAGO,OAAO,CAAC;IAChCxB,YAAY,CAACsB,gBAAgB,EAAE;MAC7BG,WAAW,EAAED;IACf,CAAwB,CAAC;EAC3B,CAAC,EACD,CAACF,gBAAgB,EAAEL,qBAAqB,CAC1C,CAAC;EAED,oBACEZ,IAAA,CAACC,iBAAiB;IAChBa,GAAG,EAAEA,GAAI;IACTO,IAAI,EAAE,oBAAoBb,QAAQ,EAAG;IACrCO,kBAAkB,EAAEA,kBAAmB;IACvCL,OAAO,EAAEA,OAAQ;IACjBO,gBAAgB,EAAEC,+BAAgC;IAAA,GAC9CL,UAAU;IAAA,GACVG,aAAa;IAAAL,QAAA,EAEhBA;EAAQ,CACQ,CAAC;AAExB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { TrueSheet } from '../../TrueSheet';
|
|
5
|
+
import { useSheetScreenState } from "./useSheetScreenState.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export const TrueSheetScreen = ({
|
|
8
|
+
detentIndex,
|
|
9
|
+
resizeKey,
|
|
10
|
+
dispatch,
|
|
11
|
+
emit,
|
|
12
|
+
routeKey,
|
|
13
|
+
closing,
|
|
14
|
+
detents,
|
|
15
|
+
children,
|
|
16
|
+
positionChangeHandler,
|
|
17
|
+
...sheetProps
|
|
18
|
+
}) => {
|
|
19
|
+
const {
|
|
20
|
+
ref,
|
|
21
|
+
initialDetentIndex,
|
|
22
|
+
eventHandlers: {
|
|
23
|
+
onPositionChange,
|
|
24
|
+
...eventHandlers
|
|
25
|
+
}
|
|
26
|
+
} = useSheetScreenState({
|
|
27
|
+
detentIndex,
|
|
28
|
+
resizeKey,
|
|
29
|
+
closing,
|
|
30
|
+
dispatch,
|
|
31
|
+
routeKey,
|
|
32
|
+
emit
|
|
33
|
+
});
|
|
34
|
+
const handlePositionChange = useCallback(e => {
|
|
35
|
+
onPositionChange(e);
|
|
36
|
+
positionChangeHandler?.(e.nativeEvent);
|
|
37
|
+
}, [onPositionChange, positionChangeHandler]);
|
|
38
|
+
return /*#__PURE__*/_jsx(TrueSheet, {
|
|
39
|
+
ref: ref,
|
|
40
|
+
name: `navigation-sheet-${routeKey}`,
|
|
41
|
+
initialDetentIndex: initialDetentIndex,
|
|
42
|
+
detents: detents,
|
|
43
|
+
onPositionChange: handlePositionChange,
|
|
44
|
+
...sheetProps,
|
|
45
|
+
...eventHandlers,
|
|
46
|
+
children: children
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=TrueSheetScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","TrueSheet","useSheetScreenState","jsx","_jsx","TrueSheetScreen","detentIndex","resizeKey","dispatch","emit","routeKey","closing","detents","children","positionChangeHandler","sheetProps","ref","initialDetentIndex","eventHandlers","onPositionChange","handlePositionChange","e","nativeEvent","name"],"sourceRoot":"../../../../src","sources":["navigation/screen/TrueSheetScreen.tsx"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,OAAO;AAEnC,SAASC,SAAS,QAAQ,iBAAiB;AAG3C,SAASC,mBAAmB,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5D,OAAO,MAAMC,eAAe,GAAGA,CAAC;EAC9BC,WAAW;EACXC,SAAS;EACTC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,OAAO;EACPC,OAAO;EACPC,QAAQ;EACRC,qBAAqB;EACrB,GAAGC;AACiB,CAAC,KAAK;EAC1B,MAAM;IACJC,GAAG;IACHC,kBAAkB;IAClBC,aAAa,EAAE;MAAEC,gBAAgB;MAAE,GAAGD;IAAc;EACtD,CAAC,GAAGhB,mBAAmB,CAAC;IACtBI,WAAW;IACXC,SAAS;IACTI,OAAO;IACPH,QAAQ;IACRE,QAAQ;IACRD;EACF,CAAC,CAAC;EAEF,MAAMW,oBAAoB,GAAGpB,WAAW,CACrCqB,CAAsB,IAAK;IAC1BF,gBAAgB,CAACE,CAAC,CAAC;IACnBP,qBAAqB,GAAGO,CAAC,CAACC,WAAW,CAAC;EACxC,CAAC,EACD,CAACH,gBAAgB,EAAEL,qBAAqB,CAC1C,CAAC;EAED,oBACEV,IAAA,CAACH,SAAS;IACRe,GAAG,EAAEA,GAAI;IACTO,IAAI,EAAE,oBAAoBb,QAAQ,EAAG;IACrCO,kBAAkB,EAAEA,kBAAmB;IACvCL,OAAO,EAAEA,OAAQ;IACjBO,gBAAgB,EAAEC,oBAAqB;IAAA,GACnCL,UAAU;IAAA,GACVG,aAAa;IAAAL,QAAA,EAEhBA;EAAQ,CACA,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TrueSheetScreen","useSheetScreenState"],"sourceRoot":"../../../../src","sources":["navigation/screen/index.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,sBAAmB;AACnD,SAASC,mBAAmB,QAAQ,0BAAuB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["navigation/screen/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { TrueSheetActions } from "../actions.js";
|
|
5
|
+
export const useSheetScreenState = props => {
|
|
6
|
+
const {
|
|
7
|
+
detentIndex,
|
|
8
|
+
resizeKey,
|
|
9
|
+
closing,
|
|
10
|
+
dispatch,
|
|
11
|
+
routeKey,
|
|
12
|
+
emit
|
|
13
|
+
} = props;
|
|
14
|
+
const ref = useRef(null);
|
|
15
|
+
const isDismissedRef = useRef(false);
|
|
16
|
+
const isFirstRenderRef = useRef(true);
|
|
17
|
+
const initialDetentIndexRef = useRef(detentIndex);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (closing && !isDismissedRef.current) {
|
|
20
|
+
isDismissedRef.current = true;
|
|
21
|
+
ref.current?.dismiss();
|
|
22
|
+
}
|
|
23
|
+
}, [closing]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (isFirstRenderRef.current) {
|
|
26
|
+
isFirstRenderRef.current = false;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
ref.current?.resize(detentIndex);
|
|
30
|
+
}, [detentIndex, resizeKey]);
|
|
31
|
+
const emitEvent = useCallback((type, data) => {
|
|
32
|
+
emit({
|
|
33
|
+
type,
|
|
34
|
+
target: routeKey,
|
|
35
|
+
data
|
|
36
|
+
});
|
|
37
|
+
}, [emit, routeKey]);
|
|
38
|
+
const onDidDismiss = useCallback(() => {
|
|
39
|
+
emitEvent('sheetDidDismiss', undefined);
|
|
40
|
+
isDismissedRef.current = true;
|
|
41
|
+
dispatch({
|
|
42
|
+
...TrueSheetActions.remove(),
|
|
43
|
+
source: routeKey
|
|
44
|
+
});
|
|
45
|
+
}, [emitEvent, dispatch, routeKey]);
|
|
46
|
+
const eventHandlers = useMemo(() => ({
|
|
47
|
+
onWillPresent: e => emitEvent('sheetWillPresent', e.nativeEvent),
|
|
48
|
+
onDidPresent: e => emitEvent('sheetDidPresent', e.nativeEvent),
|
|
49
|
+
onWillDismiss: _e => emitEvent('sheetWillDismiss', undefined),
|
|
50
|
+
onDidDismiss,
|
|
51
|
+
onDismissAttempt: _e => emitEvent('sheetDismissAttempt', undefined),
|
|
52
|
+
onDetentChange: e => emitEvent('sheetDetentChange', e.nativeEvent),
|
|
53
|
+
onDragBegin: e => emitEvent('sheetDragBegin', e.nativeEvent),
|
|
54
|
+
onDragChange: e => emitEvent('sheetDragChange', e.nativeEvent),
|
|
55
|
+
onDragEnd: e => emitEvent('sheetDragEnd', e.nativeEvent),
|
|
56
|
+
onPositionChange: e => emitEvent('sheetPositionChange', e.nativeEvent),
|
|
57
|
+
onWillFocus: _e => emitEvent('sheetWillFocus', undefined),
|
|
58
|
+
onDidFocus: _e => emitEvent('sheetDidFocus', undefined),
|
|
59
|
+
onWillBlur: _e => emitEvent('sheetWillBlur', undefined),
|
|
60
|
+
onDidBlur: _e => emitEvent('sheetDidBlur', undefined)
|
|
61
|
+
}), [emitEvent, onDidDismiss]);
|
|
62
|
+
return {
|
|
63
|
+
ref,
|
|
64
|
+
initialDetentIndex: initialDetentIndexRef.current,
|
|
65
|
+
emitEvent,
|
|
66
|
+
eventHandlers
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=useSheetScreenState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useMemo","useRef","TrueSheetActions","useSheetScreenState","props","detentIndex","resizeKey","closing","dispatch","routeKey","emit","ref","isDismissedRef","isFirstRenderRef","initialDetentIndexRef","current","dismiss","resize","emitEvent","type","data","target","onDidDismiss","undefined","remove","source","eventHandlers","onWillPresent","e","nativeEvent","onDidPresent","onWillDismiss","_e","onDismissAttempt","onDetentChange","onDragBegin","onDragChange","onDragEnd","onPositionChange","onWillFocus","onDidFocus","onWillBlur","onDidBlur","initialDetentIndex"],"sourceRoot":"../../../../src","sources":["navigation/screen/useSheetScreenState.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAqB/D,SAASC,gBAAgB,QAAQ,eAAY;AAW7C,OAAO,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,CAACL,SAAS,EAAEI,YAAY,CAC1B,CAAC;EAED,OAAO;IACLX,GAAG;IACHgC,kBAAkB,EAAE7B,qBAAqB,CAACC,OAAO;IACjDG,SAAS;IACTQ;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["navigation/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useNavigation } from '@react-navigation/native';
|
|
4
|
+
/**
|
|
5
|
+
* Hook to access TrueSheet navigation with the resize helper.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* function MySheet() {
|
|
10
|
+
* const navigation = useTrueSheetNavigation();
|
|
11
|
+
*
|
|
12
|
+
* // Resize to a specific detent
|
|
13
|
+
* const handleExpand = () => {
|
|
14
|
+
* navigation.resize(1); // Resize to second detent
|
|
15
|
+
* };
|
|
16
|
+
*
|
|
17
|
+
* return (
|
|
18
|
+
* <Button title="Expand" onPress={handleExpand} />
|
|
19
|
+
* );
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export const useTrueSheetNavigation = () => useNavigation();
|
|
24
|
+
//# sourceMappingURL=useTrueSheetNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useNavigation","useTrueSheetNavigation"],"sourceRoot":"../../../src","sources":["navigation/useTrueSheetNavigation.ts"],"mappings":";;AAAA,SAASA,aAAa,QAA4B,0BAA0B;AAI5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAEHD,aAAa,CAA6B,CAAC","ignoreList":[]}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import Animated, { withSpring, withTiming, Easing } from 'react-native-reanimated';
|
|
5
5
|
import { Platform } from 'react-native';
|
|
6
|
-
import { TrueSheet } from
|
|
6
|
+
import { TrueSheet } from '../TrueSheet';
|
|
7
7
|
import { useReanimatedTrueSheet } from "./ReanimatedTrueSheetProvider.js";
|
|
8
|
-
import { useReanimatedPositionChangeHandler } from
|
|
8
|
+
import { useReanimatedPositionChangeHandler } from './useReanimatedPositionChangeHandler';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const SPRING_CONFIG = {
|
|
11
11
|
damping: 500,
|
|
@@ -57,23 +57,29 @@ export const ReanimatedTrueSheet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
57
57
|
} = props;
|
|
58
58
|
const {
|
|
59
59
|
animatedPosition,
|
|
60
|
-
animatedIndex
|
|
60
|
+
animatedIndex,
|
|
61
|
+
animatedDetent
|
|
61
62
|
} = useReanimatedTrueSheet();
|
|
62
63
|
const positionChangeHandler = useReanimatedPositionChangeHandler(payload => {
|
|
63
64
|
'worklet';
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (payload.realtime) {
|
|
67
|
+
// Update directly when we have real-time values (during drag or animation tracking)
|
|
68
|
+
animatedPosition.value = payload.position;
|
|
69
|
+
animatedIndex.value = payload.index;
|
|
70
|
+
animatedDetent.value = payload.detent;
|
|
71
|
+
} else {
|
|
72
|
+
// Animate position, index, and detent when not real-time
|
|
68
73
|
if (Platform.OS === 'android') {
|
|
69
74
|
animatedPosition.value = withTiming(payload.position, TIMING_CONFIG);
|
|
75
|
+
animatedIndex.value = withTiming(payload.index, TIMING_CONFIG);
|
|
76
|
+
animatedDetent.value = withTiming(payload.detent, TIMING_CONFIG);
|
|
70
77
|
} else {
|
|
71
78
|
animatedPosition.value = withSpring(payload.position, SPRING_CONFIG);
|
|
79
|
+
animatedIndex.value = withSpring(payload.index, SPRING_CONFIG);
|
|
80
|
+
animatedDetent.value = withSpring(payload.detent, SPRING_CONFIG);
|
|
72
81
|
}
|
|
73
|
-
} else {
|
|
74
|
-
animatedPosition.value = payload.position;
|
|
75
82
|
}
|
|
76
|
-
animatedIndex.value = payload.index;
|
|
77
83
|
onPositionChange?.({
|
|
78
84
|
nativeEvent: payload
|
|
79
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","Animated","withSpring","withTiming","Easing","Platform","TrueSheet","useReanimatedTrueSheet","useReanimatedPositionChangeHandler","jsx","_jsx","SPRING_CONFIG","damping","stiffness","mass","overshootClamping","TIMING_CONFIG","duration","easing","bezier","AnimatedTrueSheet","createAnimatedComponent","ReanimatedTrueSheet","props","ref","onPositionChange","rest","animatedPosition","animatedIndex","
|
|
1
|
+
{"version":3,"names":["forwardRef","Animated","withSpring","withTiming","Easing","Platform","TrueSheet","useReanimatedTrueSheet","useReanimatedPositionChangeHandler","jsx","_jsx","SPRING_CONFIG","damping","stiffness","mass","overshootClamping","TIMING_CONFIG","duration","easing","bezier","AnimatedTrueSheet","createAnimatedComponent","ReanimatedTrueSheet","props","ref","onPositionChange","rest","animatedPosition","animatedIndex","animatedDetent","positionChangeHandler","payload","realtime","value","position","index","detent","OS","nativeEvent"],"sourceRoot":"../../../src","sources":["reanimated/ReanimatedTrueSheet.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,OAAOC,QAAQ,IAGbC,UAAU,EACVC,UAAU,EACVC,MAAM,QACD,yBAAyB;AAChC,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,SAAS,QAAQ,cAAc;AAExC,SAASC,sBAAsB,QAAQ,kCAA+B;AACtE,SAASC,kCAAkC,QAAQ,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1F,MAAMC,aAA+B,GAAG;EACtCC,OAAO,EAAE,GAAG;EACZC,SAAS,EAAE,IAAI;EACfC,IAAI,EAAE,CAAC;EACPC,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