@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
|
@@ -1,50 +1,135 @@
|
|
|
1
|
-
import type { ViewProps } from 'react-native';
|
|
1
|
+
import type { ColorValue, ProcessedColorValue, ViewProps } from 'react-native';
|
|
2
2
|
import type {
|
|
3
3
|
DirectEventHandler,
|
|
4
4
|
Double,
|
|
5
5
|
Int32,
|
|
6
6
|
WithDefault,
|
|
7
|
-
Float,
|
|
8
7
|
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
9
8
|
import { codegenNativeComponent } from 'react-native';
|
|
10
9
|
|
|
10
|
+
type GrabberOptionsType = Readonly<{
|
|
11
|
+
width?: Double;
|
|
12
|
+
height?: Double;
|
|
13
|
+
topMargin?: Double;
|
|
14
|
+
cornerRadius?: WithDefault<Double, -1>;
|
|
15
|
+
color?: ProcessedColorValue | null;
|
|
16
|
+
adaptive?: WithDefault<boolean, true>;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
type AccessibilityOptionsType = Readonly<{
|
|
20
|
+
grabberLabel?: WithDefault<string, 'Sheet Grabber'>;
|
|
21
|
+
grabberHint?: WithDefault<string, 'Double-tap to expand. Swipe up or down to resize the sheet'>;
|
|
22
|
+
expandedValue?: WithDefault<string, 'Expanded'>;
|
|
23
|
+
collapsedValue?: WithDefault<string, 'Collapsed'>;
|
|
24
|
+
detentValue?: WithDefault<string, 'Detent {index} of {count}'>;
|
|
25
|
+
expandActionLabel?: WithDefault<string, 'Expand'>;
|
|
26
|
+
collapseActionLabel?: WithDefault<string, 'Collapse'>;
|
|
27
|
+
paneTitle?: WithDefault<string, 'Bottom sheet'>;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
type BlurOptionsType = Readonly<{
|
|
31
|
+
intensity?: WithDefault<Double, -1>;
|
|
32
|
+
interaction?: WithDefault<boolean, true>;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden';
|
|
36
|
+
|
|
37
|
+
type ScrollableOptionsType = Readonly<{
|
|
38
|
+
contentInsetAdjustmentBehavior?: WithDefault<boolean, true>;
|
|
39
|
+
keyboardScrollOffset?: WithDefault<Double, 0>;
|
|
40
|
+
keyboardOffset?: WithDefault<Double, 0>;
|
|
41
|
+
scrollingExpandsSheet?: WithDefault<boolean, true>;
|
|
42
|
+
topScrollEdgeEffect?: WithDefault<ScrollEdgeEffect, 'hidden'>;
|
|
43
|
+
bottomScrollEdgeEffect?: WithDefault<ScrollEdgeEffect, 'hidden'>;
|
|
44
|
+
}>;
|
|
45
|
+
|
|
46
|
+
type FooterOptionsType = Readonly<{
|
|
47
|
+
// Named uniquely across option structs — codegen derives the enum name from
|
|
48
|
+
// the field name, so a second `position` would redefine TrueSheetViewPosition
|
|
49
|
+
footerPosition?: WithDefault<'relative' | 'absolute', 'relative'>;
|
|
50
|
+
keyboardOffset?: WithDefault<Double, 0>;
|
|
51
|
+
}>;
|
|
52
|
+
|
|
53
|
+
type HeaderOptionsType = Readonly<{
|
|
54
|
+
position?: WithDefault<'relative' | 'absolute', 'relative'>;
|
|
55
|
+
}>;
|
|
56
|
+
|
|
11
57
|
export interface DetentInfoEventPayload {
|
|
12
58
|
index: Int32;
|
|
13
59
|
position: Double;
|
|
60
|
+
detent: Double;
|
|
14
61
|
}
|
|
15
62
|
|
|
16
63
|
export interface PositionChangeEventPayload {
|
|
17
|
-
index:
|
|
64
|
+
index: Double;
|
|
18
65
|
position: Double;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export interface SizeChangeEventPayload {
|
|
23
|
-
width: Double;
|
|
24
|
-
height: Double;
|
|
66
|
+
detent: Double;
|
|
67
|
+
realtime: boolean;
|
|
25
68
|
}
|
|
26
69
|
|
|
27
70
|
export interface NativeProps extends ViewProps {
|
|
28
71
|
// Array properties
|
|
29
|
-
detents?: ReadonlyArray<
|
|
72
|
+
detents?: ReadonlyArray<Double>;
|
|
30
73
|
|
|
31
74
|
// Number properties - use 0 as default to avoid nil insertion
|
|
32
|
-
|
|
33
|
-
|
|
75
|
+
maxContentHeight?: WithDefault<Double, 0>;
|
|
76
|
+
maxContentWidth?: WithDefault<Double, 0>;
|
|
34
77
|
cornerRadius?: WithDefault<Double, -1>;
|
|
78
|
+
elevation?: WithDefault<Double, -1>;
|
|
79
|
+
|
|
80
|
+
// Color properties
|
|
81
|
+
backgroundColor?: ColorValue;
|
|
35
82
|
initialDetentIndex?: WithDefault<Int32, -1>;
|
|
36
|
-
|
|
83
|
+
dimmedDetentIndex?: WithDefault<Int32, 0>;
|
|
37
84
|
|
|
38
85
|
// String properties - use empty string as default to avoid nil insertion
|
|
39
|
-
|
|
40
|
-
|
|
86
|
+
backgroundBlur?: WithDefault<
|
|
87
|
+
| 'none'
|
|
88
|
+
| 'light'
|
|
89
|
+
| 'dark'
|
|
90
|
+
| 'default'
|
|
91
|
+
| 'extra-light'
|
|
92
|
+
| 'regular'
|
|
93
|
+
| 'prominent'
|
|
94
|
+
| 'system-ultra-thin-material'
|
|
95
|
+
| 'system-thin-material'
|
|
96
|
+
| 'system-material'
|
|
97
|
+
| 'system-thick-material'
|
|
98
|
+
| 'system-chrome-material'
|
|
99
|
+
| 'system-ultra-thin-material-light'
|
|
100
|
+
| 'system-thin-material-light'
|
|
101
|
+
| 'system-material-light'
|
|
102
|
+
| 'system-thick-material-light'
|
|
103
|
+
| 'system-chrome-material-light'
|
|
104
|
+
| 'system-ultra-thin-material-dark'
|
|
105
|
+
| 'system-thin-material-dark'
|
|
106
|
+
| 'system-material-dark'
|
|
107
|
+
| 'system-thick-material-dark'
|
|
108
|
+
| 'system-chrome-material-dark',
|
|
109
|
+
'none'
|
|
110
|
+
>;
|
|
111
|
+
|
|
112
|
+
anchor?: WithDefault<'left' | 'center' | 'right', 'center'>;
|
|
113
|
+
anchorOffset?: WithDefault<Double, 16>;
|
|
114
|
+
insetAdjustment?: WithDefault<'automatic' | 'never', 'automatic'>;
|
|
115
|
+
|
|
116
|
+
// Blur options
|
|
117
|
+
blurOptions?: BlurOptionsType;
|
|
41
118
|
|
|
42
119
|
// Boolean properties - match defaults from TrueSheet.types.ts
|
|
43
120
|
grabber?: WithDefault<boolean, true>;
|
|
121
|
+
grabberOptions?: GrabberOptionsType;
|
|
122
|
+
accessibilityOptions?: AccessibilityOptionsType;
|
|
44
123
|
dismissible?: WithDefault<boolean, true>;
|
|
124
|
+
draggable?: WithDefault<boolean, true>;
|
|
45
125
|
dimmed?: WithDefault<boolean, true>;
|
|
46
126
|
initialDetentAnimated?: WithDefault<boolean, true>;
|
|
47
|
-
|
|
127
|
+
// React tag of the scrollable component within the content (see scrollableRef)
|
|
128
|
+
scrollableHandle?: WithDefault<Int32, -1>;
|
|
129
|
+
scrollableOptions?: ScrollableOptionsType;
|
|
130
|
+
headerOptions?: HeaderOptionsType;
|
|
131
|
+
footerOptions?: FooterOptionsType;
|
|
132
|
+
presentation?: WithDefault<'page' | 'form', 'page'>;
|
|
48
133
|
|
|
49
134
|
// Event handlers
|
|
50
135
|
onMount?: DirectEventHandler<null>;
|
|
@@ -52,12 +137,19 @@ export interface NativeProps extends ViewProps {
|
|
|
52
137
|
onDidPresent?: DirectEventHandler<DetentInfoEventPayload>;
|
|
53
138
|
onWillDismiss?: DirectEventHandler<null>;
|
|
54
139
|
onDidDismiss?: DirectEventHandler<null>;
|
|
140
|
+
onDismissAttempt?: DirectEventHandler<null>;
|
|
55
141
|
onDetentChange?: DirectEventHandler<DetentInfoEventPayload>;
|
|
56
142
|
onDragBegin?: DirectEventHandler<DetentInfoEventPayload>;
|
|
57
143
|
onDragChange?: DirectEventHandler<DetentInfoEventPayload>;
|
|
58
144
|
onDragEnd?: DirectEventHandler<DetentInfoEventPayload>;
|
|
59
145
|
onPositionChange?: DirectEventHandler<PositionChangeEventPayload>;
|
|
60
|
-
|
|
146
|
+
onWillFocus?: DirectEventHandler<null>;
|
|
147
|
+
onDidFocus?: DirectEventHandler<null>;
|
|
148
|
+
onWillBlur?: DirectEventHandler<null>;
|
|
149
|
+
onDidBlur?: DirectEventHandler<null>;
|
|
150
|
+
onVisibilityChange?: DirectEventHandler<Readonly<{ visible: boolean }>>;
|
|
61
151
|
}
|
|
62
152
|
|
|
63
|
-
export default codegenNativeComponent<NativeProps>('TrueSheetView'
|
|
153
|
+
export default codegenNativeComponent<NativeProps>('TrueSheetView', {
|
|
154
|
+
interfaceOnly: true,
|
|
155
|
+
});
|
package/lib/module/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export * from
|
|
3
|
+
export * from './TrueSheet';
|
|
4
4
|
export * from "./TrueSheet.types.js";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export { TrueSheetPeek } from './TrueSheetPeek';
|
|
6
|
+
export { TrueSheetOverlay } from './TrueSheetOverlay';
|
|
7
|
+
export { TrueSheetProvider, useTrueSheet } from './TrueSheetProvider';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,cAAc,
|
|
1
|
+
{"version":3,"names":["TrueSheetPeek","TrueSheetOverlay","TrueSheetProvider","useTrueSheet"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,cAAc,aAAa;AAC3B,cAAc,sBAAmB;AACjC,SAASA,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { createElement, isValidElement } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
/**
|
|
6
|
+
* Mock TrueSheet component for testing.
|
|
7
|
+
* Import from '@lodev09/react-native-true-sheet/mock' in your test setup.
|
|
8
|
+
*/
|
|
9
|
+
export class TrueSheet extends React.Component {
|
|
10
|
+
static instances = {};
|
|
11
|
+
static dismiss = jest.fn((_name, _animated) => Promise.resolve());
|
|
12
|
+
static dismissStack = jest.fn((_name, _animated) => Promise.resolve());
|
|
13
|
+
static present = jest.fn((_name, _index, _animated) => Promise.resolve());
|
|
14
|
+
static resize = jest.fn((_name, _index) => Promise.resolve());
|
|
15
|
+
static dismissAll = jest.fn(_animated => Promise.resolve());
|
|
16
|
+
dismiss = jest.fn(_animated => Promise.resolve());
|
|
17
|
+
dismissStack = jest.fn(_animated => Promise.resolve());
|
|
18
|
+
present = jest.fn((_index, _animated) => Promise.resolve());
|
|
19
|
+
resize = jest.fn(_index => Promise.resolve());
|
|
20
|
+
componentDidMount() {
|
|
21
|
+
const {
|
|
22
|
+
name
|
|
23
|
+
} = this.props;
|
|
24
|
+
if (name) {
|
|
25
|
+
TrueSheet.instances[name] = this;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
componentWillUnmount() {
|
|
29
|
+
const {
|
|
30
|
+
name
|
|
31
|
+
} = this.props;
|
|
32
|
+
if (name) {
|
|
33
|
+
delete TrueSheet.instances[name];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
renderHeader() {
|
|
37
|
+
const {
|
|
38
|
+
header
|
|
39
|
+
} = this.props;
|
|
40
|
+
if (!header) return null;
|
|
41
|
+
return /*#__PURE__*/isValidElement(header) ? header : /*#__PURE__*/createElement(header);
|
|
42
|
+
}
|
|
43
|
+
renderFooter() {
|
|
44
|
+
const {
|
|
45
|
+
footer
|
|
46
|
+
} = this.props;
|
|
47
|
+
if (!footer) return null;
|
|
48
|
+
return /*#__PURE__*/isValidElement(footer) ? footer : /*#__PURE__*/createElement(footer);
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
const {
|
|
52
|
+
children,
|
|
53
|
+
style
|
|
54
|
+
} = this.props;
|
|
55
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
56
|
+
style
|
|
57
|
+
}, this.renderHeader(), children, this.renderFooter());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Mock TrueSheetPeek component for testing.
|
|
63
|
+
*/
|
|
64
|
+
export function TrueSheetPeek({
|
|
65
|
+
children,
|
|
66
|
+
...rest
|
|
67
|
+
}) {
|
|
68
|
+
return /*#__PURE__*/React.createElement(View, rest, children);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Mock TrueSheetOverlay component for testing.
|
|
73
|
+
*/
|
|
74
|
+
export function TrueSheetOverlay({
|
|
75
|
+
children,
|
|
76
|
+
...rest
|
|
77
|
+
}) {
|
|
78
|
+
return /*#__PURE__*/React.createElement(View, rest, children);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Mock TrueSheetProvider for testing.
|
|
83
|
+
*/
|
|
84
|
+
export function TrueSheetProvider({
|
|
85
|
+
children
|
|
86
|
+
}) {
|
|
87
|
+
return children;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Mock useTrueSheet hook for testing.
|
|
92
|
+
*/
|
|
93
|
+
export function useTrueSheet() {
|
|
94
|
+
return {
|
|
95
|
+
present: TrueSheet.present,
|
|
96
|
+
dismiss: TrueSheet.dismiss,
|
|
97
|
+
dismissStack: TrueSheet.dismissStack,
|
|
98
|
+
resize: TrueSheet.resize,
|
|
99
|
+
dismissAll: TrueSheet.dismissAll
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export * from "../TrueSheet.types.js";
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","createElement","isValidElement","View","TrueSheet","Component","instances","dismiss","jest","fn","_name","_animated","Promise","resolve","dismissStack","present","_index","resize","dismissAll","componentDidMount","name","props","componentWillUnmount","renderHeader","header","renderFooter","footer","render","children","style","TrueSheetPeek","rest","TrueSheetOverlay","TrueSheetProvider","useTrueSheet"],"sourceRoot":"../../../src","sources":["mocks/index.ts"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,cAAc,QAAwB,OAAO;AAC5E,SAASC,IAAI,QAAwB,cAAc;AAQnD;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,SAASJ,KAAK,CAACK,SAAS,CAAiC;EAC7E,OAAOC,SAAS,GAA8B,CAAC,CAAC;EAEhD,OAAOC,OAAO,GAAGC,IAAI,CAACC,EAAE,CAAC,CAACC,KAAa,EAAEC,SAAmB,KAAKC,OAAO,CAACC,OAAO,CAAC,CAAC,CAAC;EACnF,OAAOC,YAAY,GAAGN,IAAI,CAACC,EAAE,CAAC,CAACC,KAAa,EAAEC,SAAmB,KAAKC,OAAO,CAACC,OAAO,CAAC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O,YAAY,EAAEV,SAAS,CAACU,YAAY;IACpCG,MAAM,EAAEb,SAAS,CAACa,MAAM;IACxBC,UAAU,EAAEd,SAAS,CAACc;EACxB,CAAC;AACH;AAEA,cAAc,uBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mock createTrueSheetNavigator for testing.
|
|
5
|
+
* Import from '@lodev09/react-native-true-sheet/navigation/mock' in your test setup.
|
|
6
|
+
*/
|
|
7
|
+
export const createTrueSheetNavigator = jest.fn(() => ({
|
|
8
|
+
Navigator: jest.fn(({
|
|
9
|
+
children
|
|
10
|
+
}) => children),
|
|
11
|
+
Screen: jest.fn(() => null),
|
|
12
|
+
Group: jest.fn(() => null)
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Mock createTrueSheetScreen for testing the static API.
|
|
17
|
+
*/
|
|
18
|
+
export const createTrueSheetScreen = jest.fn(config => config);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Mock TrueSheetActions for testing.
|
|
22
|
+
*/
|
|
23
|
+
export const TrueSheetActions = {
|
|
24
|
+
push: jest.fn((name, params) => ({
|
|
25
|
+
type: 'PUSH',
|
|
26
|
+
payload: {
|
|
27
|
+
name,
|
|
28
|
+
params
|
|
29
|
+
}
|
|
30
|
+
})),
|
|
31
|
+
pop: jest.fn(count => ({
|
|
32
|
+
type: 'POP',
|
|
33
|
+
payload: {
|
|
34
|
+
count
|
|
35
|
+
}
|
|
36
|
+
})),
|
|
37
|
+
popTo: jest.fn((name, params) => ({
|
|
38
|
+
type: 'POP_TO',
|
|
39
|
+
payload: {
|
|
40
|
+
name,
|
|
41
|
+
params
|
|
42
|
+
}
|
|
43
|
+
})),
|
|
44
|
+
popToTop: jest.fn(() => ({
|
|
45
|
+
type: 'POP_TO_TOP'
|
|
46
|
+
})),
|
|
47
|
+
replace: jest.fn((name, params) => ({
|
|
48
|
+
type: 'REPLACE',
|
|
49
|
+
payload: {
|
|
50
|
+
name,
|
|
51
|
+
params
|
|
52
|
+
}
|
|
53
|
+
})),
|
|
54
|
+
resize: jest.fn(index => ({
|
|
55
|
+
type: 'RESIZE',
|
|
56
|
+
index
|
|
57
|
+
})),
|
|
58
|
+
dismiss: jest.fn(() => ({
|
|
59
|
+
type: 'DISMISS'
|
|
60
|
+
})),
|
|
61
|
+
remove: jest.fn(() => ({
|
|
62
|
+
type: 'REMOVE'
|
|
63
|
+
}))
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Mock useTrueSheetNavigation hook for testing.
|
|
68
|
+
*/
|
|
69
|
+
export const useTrueSheetNavigation = jest.fn(() => {
|
|
70
|
+
// Partial drops react-navigation's private-brand member (PrivateValueStore),
|
|
71
|
+
// which no mock can implement — the members themselves stay type-checked.
|
|
72
|
+
const navigation = {
|
|
73
|
+
navigate: jest.fn(),
|
|
74
|
+
goBack: jest.fn(),
|
|
75
|
+
reset: jest.fn(),
|
|
76
|
+
setParams: jest.fn(),
|
|
77
|
+
dispatch: jest.fn(),
|
|
78
|
+
isFocused: jest.fn(() => true),
|
|
79
|
+
canGoBack: jest.fn(() => true),
|
|
80
|
+
getId: jest.fn(),
|
|
81
|
+
getParent: jest.fn(),
|
|
82
|
+
getState: jest.fn(),
|
|
83
|
+
addListener: jest.fn(() => jest.fn()),
|
|
84
|
+
removeListener: jest.fn(),
|
|
85
|
+
setOptions: jest.fn(),
|
|
86
|
+
push: jest.fn(),
|
|
87
|
+
pop: jest.fn(),
|
|
88
|
+
popTo: jest.fn(),
|
|
89
|
+
popToTop: jest.fn(),
|
|
90
|
+
replace: jest.fn(),
|
|
91
|
+
resize: jest.fn()
|
|
92
|
+
};
|
|
93
|
+
return navigation;
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createTrueSheetNavigator","jest","fn","Navigator","children","Screen","Group","createTrueSheetScreen","config","TrueSheetActions","push","name","params","type","payload","pop","count","popTo","popToTop","replace","resize","index","dismiss","remove","useTrueSheetNavigation","navigation","navigate","goBack","reset","setParams","dispatch","isFocused","canGoBack","getId","getParent","getState","addListener","removeListener","setOptions"],"sourceRoot":"../../../src","sources":["mocks/navigation.ts"],"mappings":";;AAIA;AACA;AACA;AACA;AACA,OAAO,MAAMA,wBAAwB,GAAGC,IAAI,CAACC,EAAE,CAAC,OAAO;EACrDC,SAAS,EAAEF,IAAI,CAACC,EAAE,CAAC,CAAC;IAAEE;EAAwC,CAAC,KAAKA,QAAQ,CAAC;EAC7EC,MAAM,EAAEJ,IAAI,CAACC,EAAE,CAAC,MAAM,IAAI,CAAC;EAC3BI,KAAK,EAAEL,IAAI,CAACC,EAAE,CAAC,MAAM,IAAI;AAC3B,CAAC,CAAC,CAAC;;AAEH;AACA;AACA;AACA,OAAO,MAAMK,qBAAqB,GAAGN,IAAI,CAACC,EAAE,CAAEM,MAAc,IAAKA,MAAM,CAAC;;AAExE;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,IAAI,EAAET,IAAI,CAACC,EAAE,CAAC,CAACS,IAAY,EAAEC,MAAe,MAAM;IAAEC,IAAI,EAAE,MAAM;IAAEC,OAAO,EAAE;MAAEH,IAAI;MAAEC;IAAO;EAAE,CAAC,CAAC,CAAC;EAC/FG,GAAG,EAAEd,IAAI,CAACC,EAAE,CAAEc,KAAc,KAAM;IAAEH,IAAI,EAAE,KAAK;IAAEC,OAAO,EAAE;MAAEE;IAAM;EAAE,CAAC,CAAC,CAAC;EACvEC,KAAK,EAAEhB,IAAI,CAACC,EAAE,CAAC,CAACS,IAAY,EAAEC,MAAe,MAAM;IACjDC,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAE;MAAEH,IAAI;MAAEC;IAAO;EAC1B,CAAC,CAAC,CAAC;EACHM,QAAQ,EAAEjB,IAAI,CAACC,EAAE,C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EAAEnC,IAAI,CAACC,EAAE,CAAC,MAAMD,IAAI,CAACC,EAAE,CAAC,CAAC,CAAC;IACrCmC,cAAc,EAAEpC,IAAI,CAACC,EAAE,CAAC,CAAC;IACzBoC,UAAU,EAAErC,IAAI,CAACC,EAAE,CAAC,CAAC;IACrBQ,IAAI,EAAET,IAAI,CAACC,EAAE,CAAC,CAAC;IACfa,GAAG,EAAEd,IAAI,CAACC,EAAE,CAAC,CAAC;IACde,KAAK,EAAEhB,IAAI,CAACC,EAAE,CAAC,CAAC;IAChBgB,QAAQ,EAAEjB,IAAI,CAACC,EAAE,CAAC,CAAC;IACnBiB,OAAO,EAAElB,IAAI,CAACC,EAAE,CAAC,CAAC;IAClBkB,MAAM,EAAEnB,IAAI,CAACC,EAAE,CAAC;EAClB,CAAC;EACD,OAAOuB,UAAU;AACnB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { TrueSheetActions, useTrueSheetNavigation as useTrueSheetNavigationMock } from "./navigation.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Mock Sheet layout for testing.
|
|
7
|
+
* Import from '@lodev09/react-native-true-sheet/navigation/expo-router/mock' in your test setup.
|
|
8
|
+
*/
|
|
9
|
+
export const Sheet = Object.assign(jest.fn(({
|
|
10
|
+
children
|
|
11
|
+
}) => children), {
|
|
12
|
+
Screen: jest.fn(() => null),
|
|
13
|
+
Protected: jest.fn(() => null)
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Mock useTrueSheetNavigation hook for testing.
|
|
18
|
+
*/
|
|
19
|
+
export const useTrueSheetNavigation = jest.fn(() => useTrueSheetNavigationMock());
|
|
20
|
+
export { TrueSheetActions };
|
|
21
|
+
//# sourceMappingURL=navigationExpoRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TrueSheetActions","useTrueSheetNavigation","useTrueSheetNavigationMock","Sheet","Object","assign","jest","fn","children","Screen","Protected"],"sourceRoot":"../../../src","sources":["mocks/navigationExpoRouter.ts"],"mappings":";;AAEA,SACEA,gBAAgB,EAChBC,sBAAsB,IAAIC,0BAA0B,QAC/C,iBAAc;;AAErB;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,GAAGC,MAAM,CAACC,MAAM,CAChCC,IAAI,CAACC,EAAE,CAAC,CAAC;EAAEC;AAAwC,CAAC,KAAKA,QAAQ,CAAC,EAClE;EACEC,MAAM,EAAEH,IAAI,CAACC,EAAE,CAAC,MAAM,IAAI,CAAC;EAC3BG,SAAS,EAAEJ,IAAI,CAACC,EAAE,CAAC,MAAM,IAAI;AAC/B,CACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMN,sBAAsB,GAAGK,IAAI,CAACC,EAAE,CAG3C,MACEL,0BAA0B,CAAC,CAC/B,CAAC;AAED,SAASF,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { createElement, isValidElement } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
const createMockSharedValue = initialValue => ({
|
|
6
|
+
value: initialValue,
|
|
7
|
+
get: () => initialValue,
|
|
8
|
+
set: () => {},
|
|
9
|
+
addListener: () => {},
|
|
10
|
+
removeListener: () => {},
|
|
11
|
+
modify: () => {}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Mock ReanimatedTrueSheet component for testing.
|
|
16
|
+
* Import from '@lodev09/react-native-true-sheet/reanimated/mock' in your test setup.
|
|
17
|
+
*/
|
|
18
|
+
export class ReanimatedTrueSheet extends React.Component {
|
|
19
|
+
static instances = {};
|
|
20
|
+
static dismiss = jest.fn((_name, _animated) => Promise.resolve());
|
|
21
|
+
static dismissStack = jest.fn((_name, _animated) => Promise.resolve());
|
|
22
|
+
static present = jest.fn((_name, _index, _animated) => Promise.resolve());
|
|
23
|
+
static resize = jest.fn((_name, _index) => Promise.resolve());
|
|
24
|
+
dismiss = jest.fn(_animated => Promise.resolve());
|
|
25
|
+
dismissStack = jest.fn(_animated => Promise.resolve());
|
|
26
|
+
present = jest.fn((_index, _animated) => Promise.resolve());
|
|
27
|
+
resize = jest.fn(_index => Promise.resolve());
|
|
28
|
+
componentDidMount() {
|
|
29
|
+
const {
|
|
30
|
+
name
|
|
31
|
+
} = this.props;
|
|
32
|
+
if (name) {
|
|
33
|
+
ReanimatedTrueSheet.instances[name] = this;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
componentWillUnmount() {
|
|
37
|
+
const {
|
|
38
|
+
name
|
|
39
|
+
} = this.props;
|
|
40
|
+
if (name) {
|
|
41
|
+
delete ReanimatedTrueSheet.instances[name];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
renderHeader() {
|
|
45
|
+
const {
|
|
46
|
+
header
|
|
47
|
+
} = this.props;
|
|
48
|
+
if (!header) return null;
|
|
49
|
+
return /*#__PURE__*/isValidElement(header) ? header : /*#__PURE__*/createElement(header);
|
|
50
|
+
}
|
|
51
|
+
renderFooter() {
|
|
52
|
+
const {
|
|
53
|
+
footer
|
|
54
|
+
} = this.props;
|
|
55
|
+
if (!footer) return null;
|
|
56
|
+
return /*#__PURE__*/isValidElement(footer) ? footer : /*#__PURE__*/createElement(footer);
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
const {
|
|
60
|
+
children,
|
|
61
|
+
style
|
|
62
|
+
} = this.props;
|
|
63
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
64
|
+
style
|
|
65
|
+
}, this.renderHeader(), children, this.renderFooter());
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Mock ReanimatedTrueSheetProvider for testing.
|
|
71
|
+
*/
|
|
72
|
+
export function ReanimatedTrueSheetProvider({
|
|
73
|
+
children
|
|
74
|
+
}) {
|
|
75
|
+
return children;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Mock useReanimatedTrueSheet hook for testing.
|
|
80
|
+
*/
|
|
81
|
+
export const useReanimatedTrueSheet = jest.fn(() => ({
|
|
82
|
+
animatedPosition: createMockSharedValue(0),
|
|
83
|
+
animatedIndex: createMockSharedValue(-1),
|
|
84
|
+
animatedDetent: createMockSharedValue(0)
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Mock useReanimatedPositionChangeHandler hook for testing.
|
|
89
|
+
*/
|
|
90
|
+
export const useReanimatedPositionChangeHandler = jest.fn((_handler, _dependencies) => jest.fn());
|
|
91
|
+
//# sourceMappingURL=reanimated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","createElement","isValidElement","View","createMockSharedValue","initialValue","value","get","set","addListener","removeListener","modify","ReanimatedTrueSheet","Component","instances","dismiss","jest","fn","_name","_animated","Promise","resolve","dismissStack","present","_index","resize","componentDidMount","name","props","componentWillUnmount","renderHeader","header","renderFooter","footer","render","children","style","ReanimatedTrueSheetProvider","useReanimatedTrueSheet","animatedPosition","animatedIndex","animatedDetent","useReanimatedPositionChangeHandler","_handler","_dependencies"],"sourceRoot":"../../../src","sources":["mocks/reanimated.ts"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,cAAc,QAAwB,OAAO;AAC5E,SAASC,IAAI,QAAQ,cAAc;AAenC,MAAMC,qBAAqB,GAAOC,YAAe,KAAsB;EACrEC,KAAK,EAAED,YAAY;EACnBE,GAAG,EAAEA,CAAA,KAAMF,YAAY;EACvBG,GAAG,EAAEA,CAAA,KAAM,CAAC,CAAC;EACbC,WAAW,EAAEA,CAAA,KAAM,CAAC,CAAC;EACrBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,MAAM,EAAEA,CAAA,KAAM,CAAC;AACjB,CAAC,CAAC;;AAEF;AACA;A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,OAAO,MAAMsC,kCAAkC,GAAG1B,IAAI,CAACC,EAAE,CACvD,CAAC0B,QAAuD,EAAEC,aAAyB,KAAK5B,IAAI,CAACC,EAAE,CAAC,CAClG,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { TrueSheetScreen } from "./screen/index.js";
|
|
4
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
let ReanimatedTrueSheetScreen = null;
|
|
6
|
+
const getReanimatedScreen = () => {
|
|
7
|
+
if (!ReanimatedTrueSheetScreen) {
|
|
8
|
+
ReanimatedTrueSheetScreen = require('./screen/ReanimatedTrueSheetScreen').ReanimatedTrueSheetScreen;
|
|
9
|
+
}
|
|
10
|
+
return ReanimatedTrueSheetScreen;
|
|
11
|
+
};
|
|
12
|
+
const DEFAULT_DETENTS = ['auto'];
|
|
13
|
+
const clampDetentIndex = (index, detentsLength) => Math.min(index, Math.max(detentsLength - 1, 0));
|
|
14
|
+
export const TrueSheetNavigatorContent = ({
|
|
15
|
+
routes,
|
|
16
|
+
dispatch,
|
|
17
|
+
descriptors,
|
|
18
|
+
emitter
|
|
19
|
+
}) => {
|
|
20
|
+
// First route is the base screen, rest are sheets.
|
|
21
|
+
// Rendered from the raw routes (not the standard state) so custom fields are
|
|
22
|
+
// available and preloaded routes never present as sheets.
|
|
23
|
+
const [baseRoute, ...sheetRoutes] = routes;
|
|
24
|
+
const baseDescriptor = baseRoute ? descriptors[baseRoute.key] : null;
|
|
25
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
26
|
+
children: [baseDescriptor?.render(), sheetRoutes.map(route => {
|
|
27
|
+
const descriptor = descriptors[route.key];
|
|
28
|
+
if (!descriptor) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const {
|
|
32
|
+
options,
|
|
33
|
+
render
|
|
34
|
+
} = descriptor;
|
|
35
|
+
const {
|
|
36
|
+
detentIndex = 0,
|
|
37
|
+
detents = DEFAULT_DETENTS,
|
|
38
|
+
reanimated,
|
|
39
|
+
positionChangeHandler,
|
|
40
|
+
...sheetProps
|
|
41
|
+
} = options;
|
|
42
|
+
const resolvedIndex = clampDetentIndex(route.resizeIndex ?? detentIndex, detents.length);
|
|
43
|
+
if (reanimated) {
|
|
44
|
+
const ReanimatedScreen = getReanimatedScreen();
|
|
45
|
+
return /*#__PURE__*/_jsx(ReanimatedScreen, {
|
|
46
|
+
routeKey: route.key,
|
|
47
|
+
closing: route.closing,
|
|
48
|
+
detentIndex: resolvedIndex,
|
|
49
|
+
resizeKey: route.resizeKey,
|
|
50
|
+
detents: detents,
|
|
51
|
+
dispatch: dispatch,
|
|
52
|
+
emit: emitter.emit,
|
|
53
|
+
positionChangeHandler: positionChangeHandler,
|
|
54
|
+
...sheetProps,
|
|
55
|
+
children: render()
|
|
56
|
+
}, route.key);
|
|
57
|
+
}
|
|
58
|
+
return /*#__PURE__*/_jsx(TrueSheetScreen, {
|
|
59
|
+
routeKey: route.key,
|
|
60
|
+
closing: route.closing,
|
|
61
|
+
detentIndex: resolvedIndex,
|
|
62
|
+
resizeKey: route.resizeKey,
|
|
63
|
+
detents: detents,
|
|
64
|
+
dispatch: dispatch,
|
|
65
|
+
emit: emitter.emit,
|
|
66
|
+
positionChangeHandler: positionChangeHandler,
|
|
67
|
+
...sheetProps,
|
|
68
|
+
children: render()
|
|
69
|
+
}, route.key);
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=TrueSheetNavigatorContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TrueSheetScreen","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ReanimatedTrueSheetScreen","getReanimatedScreen","require","DEFAULT_DETENTS","clampDetentIndex","index","detentsLength","Math","min","max","TrueSheetNavigatorContent","routes","dispatch","descriptors","emitter","baseRoute","sheetRoutes","baseDescriptor","key","children","render","map","route","descriptor","options","detentIndex","detents","reanimated","positionChangeHandler","sheetProps","resolvedIndex","resizeIndex","length","ReanimatedScreen","routeKey","closing","resizeKey","emit"],"sourceRoot":"../../../src","sources":["navigation/TrueSheetNavigatorContent.tsx"],"mappings":";;AAOA,SAASA,eAAe,QAAmC,mBAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtE,IAAIC,yBAA2E,GAAG,IAAI;AAEtF,MAAMC,mBAAmB,GAAGA,CAAA,KAAiD;EAC3E,IAAI,CAACD,yBAAyB,EAAE;IAC9BA,yBAAyB,GACvBE,OAAO,CAAC,oCAAoC,CAAC,CAACF,yBAAyB;EAC3E;EACA,OAAOA,yBAAyB;AAClC,CAAC;AAED,MAAMG,eAAoC,GAAG,CAAC,MAAM,CAAC;AAErD,MAAMC,gBAAgB,GAAGA,CAACC,KAAa,EAAEC,aAAqB,KAC5DC,IAAI,CAACC,GAAG,CAACH,KAAK,EAAEE,IAAI,CAACE,GAAG,CAACH,aAAa,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAQjD,OAAO,MAAMI,yBAAyB,GAAGA,CAAC;EACxCC,MAAM;EACNC,QAAQ;EACRC,WAAW;EACXC;AAC8B,CAAC,KAAK;EACpC;EACA;EACA;EACA,MAAM,CAACC,SAAS,EAAE,GAAGC,WAAW,CAAC,GAAGL,MAAM;EAE1C,MAAMM,cAAc,GAAGF,SAAS,GAAGF,WAAW,CAACE,SAAS,CAACG,GAAG,CAAC,GAAG,IAAI;EAEpE,oBACEnB,KAAA,CAAAF,SAAA;IAAAsB,QAAA,GAEGF,cAAc,EAAEG,MAAM,CAAC,CAAC,EAGxBJ,WAAW,CAACK,GAAG,CAAEC,KAAK,IAAK;MAC1B,MAAMC,UAAU,GAAGV,WAAW,CAACS,KAAK,CAACJ,GAAG,CAAC;MAEzC,IAAI,CAACK,UAAU,EAAE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,CAAC;AAEP,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Action creators for the TrueSheet navigator.
|
|
5
|
+
* Plain objects matching `StackActions` shapes, plus sheet-specific actions.
|
|
6
|
+
*/
|
|
7
|
+
export const TrueSheetActions = {
|
|
8
|
+
push: (name, params) => ({
|
|
9
|
+
type: 'PUSH',
|
|
10
|
+
payload: {
|
|
11
|
+
name,
|
|
12
|
+
params
|
|
13
|
+
}
|
|
14
|
+
}),
|
|
15
|
+
pop: (count = 1) => ({
|
|
16
|
+
type: 'POP',
|
|
17
|
+
payload: {
|
|
18
|
+
count
|
|
19
|
+
}
|
|
20
|
+
}),
|
|
21
|
+
popTo: (name, params, options) => ({
|
|
22
|
+
type: 'POP_TO',
|
|
23
|
+
payload: {
|
|
24
|
+
name,
|
|
25
|
+
params,
|
|
26
|
+
merge: options?.merge
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
popToTop: () => ({
|
|
30
|
+
type: 'POP_TO_TOP'
|
|
31
|
+
}),
|
|
32
|
+
replace: (name, params) => ({
|
|
33
|
+
type: 'REPLACE',
|
|
34
|
+
payload: {
|
|
35
|
+
name,
|
|
36
|
+
params
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
resize: index => ({
|
|
40
|
+
type: 'RESIZE',
|
|
41
|
+
index
|
|
42
|
+
}),
|
|
43
|
+
dismiss: () => ({
|
|
44
|
+
type: 'DISMISS'
|
|
45
|
+
}),
|
|
46
|
+
remove: () => ({
|
|
47
|
+
type: 'REMOVE'
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TrueSheetActions","push","name","params","type","payload","pop","count","popTo","options","merge","popToTop","replace","resize","index","dismiss","remove"],"sourceRoot":"../../../src","sources":["navigation/actions.ts"],"mappings":";;AAoDA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,IAAI,EAAEA,CAACC,IAAY,EAAEC,MAAe,MAA2B;IAC7DC,IAAI,EAAE,MAAM;IACZC,OAAO,EAAE;MAAEH,IAAI;MAAEC;IAAO;EAC1B,CAAC,CAAC;EACFG,GAAG,EAAEA,CAACC,KAAa,GAAG,CAAC,MAA2B;IAChDH,IAAI,EAAE,KAAK;IACXC,OAAO,EAAE;MAAEE;IAAM;EACnB,CAAC,CAAC;EACFC,KAAK,EAAEA,CAACN,IAAY,EAAEC,MAAe,EAAEM,OAA6B,MAA2B;IAC7FL,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAE;MAAEH,IAAI;MAAEC,MAAM;MAAEO,KAAK,EAAED,OAAO,EAAEC;IAAM;EACjD,CAAC,CAAC;EACFC,QAAQ,EAAEA,CAAA,MAA4B;IAAEP,IAAI,EAAE;EAAa,CAAC,CAAC;EAC7DQ,OAAO,EAAEA,CAACV,IAAY,EAAEC,MAAe,MAA2B;IAChEC,IAAI,EAAE,SAAS;IACfC,OAAO,EAAE;MAAEH,IAAI;MAAEC;IAAO;EAC1B,CAAC,CAAC;EACFU,MAAM,EAAGC,KAAa,KAA2B;IAAEV,IAAI,EAAE,QAAQ;IAAEU;EAAM,CAAC,CAAC;EAC3EC,OAAO,EAAEA,CAAA,MAA4B;IAAEX,IAAI,EAAE;EAAU,CAAC,CAAC;EACzDY,MAAM,EAAEA,CAAA,MAA4B;IAAEZ,IAAI,EAAE;EAAS,CAAC;AACxD,CAAC","ignoreList":[]}
|