@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,6 +1,5 @@
|
|
|
1
|
-
import type { ComponentType, ReactElement } from 'react';
|
|
2
|
-
import type { ColorValue, NativeSyntheticEvent, ViewProps } from 'react-native';
|
|
3
|
-
import type { TrueSheetGrabberProps } from './TrueSheetGrabber';
|
|
1
|
+
import type { Component, ComponentType, ReactElement, RefObject } from 'react';
|
|
2
|
+
import type { ColorValue, NativeSyntheticEvent, StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
4
3
|
export interface DetentInfoEventPayload {
|
|
5
4
|
/**
|
|
6
5
|
* The index position from the provided `detents`.
|
|
@@ -10,13 +9,17 @@ export interface DetentInfoEventPayload {
|
|
|
10
9
|
* The Y position of the sheet relative to the screen.
|
|
11
10
|
*/
|
|
12
11
|
position: number;
|
|
12
|
+
/**
|
|
13
|
+
* The detent value (0-1) for the current index.
|
|
14
|
+
*/
|
|
15
|
+
detent: number;
|
|
13
16
|
}
|
|
14
17
|
export interface PositionChangeEventPayload extends DetentInfoEventPayload {
|
|
15
18
|
/**
|
|
16
|
-
*
|
|
17
|
-
* When
|
|
19
|
+
* Indicates whether the position value is real-time (e.g., during drag or animation tracking).
|
|
20
|
+
* When false, the position should be animated in JS.
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
realtime: boolean;
|
|
20
23
|
}
|
|
21
24
|
export type MountEvent = NativeSyntheticEvent<null>;
|
|
22
25
|
export type DetentChangeEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
@@ -24,44 +27,298 @@ export type WillPresentEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
|
24
27
|
export type DidPresentEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
25
28
|
export type WillDismissEvent = NativeSyntheticEvent<null>;
|
|
26
29
|
export type DidDismissEvent = NativeSyntheticEvent<null>;
|
|
30
|
+
export type DismissAttemptEvent = NativeSyntheticEvent<null>;
|
|
27
31
|
export type DragBeginEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
28
32
|
export type DragChangeEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
29
33
|
export type DragEndEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
30
34
|
export type PositionChangeEvent = NativeSyntheticEvent<PositionChangeEventPayload>;
|
|
35
|
+
export type DidFocusEvent = NativeSyntheticEvent<null>;
|
|
36
|
+
export type DidBlurEvent = NativeSyntheticEvent<null>;
|
|
37
|
+
export type WillFocusEvent = NativeSyntheticEvent<null>;
|
|
38
|
+
export type WillBlurEvent = NativeSyntheticEvent<null>;
|
|
31
39
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @internal
|
|
40
|
+
* Options for customizing the grabber (drag handle) appearance.
|
|
34
41
|
*/
|
|
35
|
-
export interface
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
export interface GrabberOptions {
|
|
43
|
+
/**
|
|
44
|
+
* The width of the grabber pill.
|
|
45
|
+
*
|
|
46
|
+
* @default iOS: 36, Android: 32
|
|
47
|
+
*/
|
|
48
|
+
width?: number;
|
|
49
|
+
/**
|
|
50
|
+
* The height of the grabber pill.
|
|
51
|
+
*
|
|
52
|
+
* @default iOS: 5, Android: 4
|
|
53
|
+
*/
|
|
54
|
+
height?: number;
|
|
55
|
+
/**
|
|
56
|
+
* The top margin of the grabber from the sheet edge.
|
|
57
|
+
*
|
|
58
|
+
* @default iOS: 5, Android: 16
|
|
59
|
+
*/
|
|
60
|
+
topMargin?: number;
|
|
61
|
+
/**
|
|
62
|
+
* The corner radius of the grabber pill.
|
|
63
|
+
*
|
|
64
|
+
* @default height / 2
|
|
65
|
+
*/
|
|
66
|
+
cornerRadius?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The color of the grabber.
|
|
69
|
+
* Uses native vibrancy/material styling when not provided.
|
|
70
|
+
*/
|
|
71
|
+
color?: ColorValue;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the grabber color adapts to light/dark mode.
|
|
74
|
+
* When enabled, the grabber uses vibrancy effect on iOS and
|
|
75
|
+
* adjusts color based on the current theme on Android.
|
|
76
|
+
*
|
|
77
|
+
* @default true
|
|
78
|
+
*/
|
|
79
|
+
adaptive?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Options for customizing (e.g. localizing) the accessibility strings
|
|
83
|
+
* announced by screen readers.
|
|
84
|
+
*
|
|
85
|
+
* On iOS, the grabber strings only apply when `grabberOptions` is provided.
|
|
86
|
+
* Without it, iOS uses the system grabber which is already localized.
|
|
87
|
+
*/
|
|
88
|
+
export interface AccessibilityOptions {
|
|
89
|
+
/**
|
|
90
|
+
* The accessibility label of the grabber.
|
|
91
|
+
*
|
|
92
|
+
* @default iOS: 'Sheet Grabber', Android: 'Drag handle'
|
|
93
|
+
*/
|
|
94
|
+
grabberLabel?: string;
|
|
95
|
+
/**
|
|
96
|
+
* The accessibility hint of the grabber.
|
|
97
|
+
*
|
|
98
|
+
* @platform ios
|
|
99
|
+
* @default 'Double-tap to expand. Swipe up or down to resize the sheet'
|
|
100
|
+
*/
|
|
101
|
+
grabberHint?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The value announced when the sheet is at the last detent.
|
|
104
|
+
*
|
|
105
|
+
* @default 'Expanded'
|
|
106
|
+
*/
|
|
107
|
+
expandedValue?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The value announced when the sheet is at the first detent.
|
|
110
|
+
*
|
|
111
|
+
* @default 'Collapsed'
|
|
112
|
+
*/
|
|
113
|
+
collapsedValue?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The value announced when the sheet is at an intermediate detent.
|
|
116
|
+
* Supports `{index}` and `{count}` placeholders.
|
|
117
|
+
*
|
|
118
|
+
* @default 'Detent {index} of {count}'
|
|
119
|
+
*/
|
|
120
|
+
detentValue?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The label of the expand accessibility action.
|
|
123
|
+
*
|
|
124
|
+
* @platform android
|
|
125
|
+
* @default 'Expand'
|
|
126
|
+
*/
|
|
127
|
+
expandActionLabel?: string;
|
|
128
|
+
/**
|
|
129
|
+
* The label of the collapse accessibility action.
|
|
130
|
+
*
|
|
131
|
+
* @platform android
|
|
132
|
+
* @default 'Collapse'
|
|
133
|
+
*/
|
|
134
|
+
collapseActionLabel?: string;
|
|
135
|
+
/**
|
|
136
|
+
* The title announced when the sheet appears.
|
|
137
|
+
* Sets the accessibility pane title on Android and the
|
|
138
|
+
* hidden dialog title on Web.
|
|
139
|
+
*
|
|
140
|
+
* @platform android, web
|
|
141
|
+
* @default Android: 'Bottom sheet', Web: 'Sheet'
|
|
142
|
+
*/
|
|
143
|
+
paneTitle?: string;
|
|
38
144
|
}
|
|
39
145
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
146
|
+
* Scroll edge effect style for iOS 26+.
|
|
147
|
+
* Controls the blur/gradient overlay applied to scroll view edges.
|
|
148
|
+
*
|
|
149
|
+
* @platform ios 26+
|
|
42
150
|
*/
|
|
43
|
-
export type
|
|
151
|
+
export type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden';
|
|
152
|
+
/**
|
|
153
|
+
* Options for scrollable behavior.
|
|
154
|
+
*/
|
|
155
|
+
export interface ScrollableOptions {
|
|
156
|
+
/**
|
|
157
|
+
* Applies the bottom safe-area inset to the scroll content automatically
|
|
158
|
+
* while the content can scroll, so the last item clears the home indicator
|
|
159
|
+
* (iOS) and navigation bar (Android).
|
|
160
|
+
*
|
|
161
|
+
* - **iOS**: Sets the scroll view's native
|
|
162
|
+
* [`contentInsetAdjustmentBehavior`](https://developer.apple.com/documentation/uikit/uiscrollview/contentinsetadjustmentbehavior)
|
|
163
|
+
* to `automatic` while it's plugged into the sheet — no need to set React
|
|
164
|
+
* Native's iOS-only prop yourself.
|
|
165
|
+
* - **Android**: Pads the scroll content with the bottom window inset,
|
|
166
|
+
* mirroring iOS's `automatic` behavior — parity React Native's iOS-only
|
|
167
|
+
* prop can't provide.
|
|
168
|
+
* - **Web**: Lifts the content above the safe area
|
|
169
|
+
* (`env(safe-area-inset-bottom)`).
|
|
170
|
+
*
|
|
171
|
+
* Only applies while the sheet's `insetAdjustment` is `'automatic'`. When
|
|
172
|
+
* the sheet has a relative footer, the footer absorbs the inset instead.
|
|
173
|
+
*
|
|
174
|
+
* @default true
|
|
175
|
+
*/
|
|
176
|
+
contentInsetAdjustmentBehavior?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Extra offset when scrolling to the focused input when keyboard appears.
|
|
179
|
+
*
|
|
180
|
+
* @default 0
|
|
181
|
+
*/
|
|
182
|
+
keyboardScrollOffset?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Adjusts the bottom inset applied to the scrollable when the keyboard is shown.
|
|
185
|
+
* Positive values increase the inset; negative values reduce it.
|
|
186
|
+
* Pass `-insets.bottom` to cancel out safe-area padding already included in
|
|
187
|
+
* the content's `paddingBottom`.
|
|
188
|
+
* Does not affect the auto scroll of the focused input — it always targets
|
|
189
|
+
* the keyboard edge.
|
|
190
|
+
*
|
|
191
|
+
* @default 0
|
|
192
|
+
*/
|
|
193
|
+
keyboardOffset?: number;
|
|
194
|
+
/**
|
|
195
|
+
* Whether scrolling the content expands the sheet to the next detent.
|
|
196
|
+
* When `false`, only the grabber can expand the sheet.
|
|
197
|
+
*
|
|
198
|
+
* @default true
|
|
199
|
+
*/
|
|
200
|
+
scrollingExpandsSheet?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* The scroll edge effect applied to the top edge of the scroll view.
|
|
203
|
+
*
|
|
204
|
+
* @platform ios 26+
|
|
205
|
+
* @default 'hidden'
|
|
206
|
+
*/
|
|
207
|
+
topScrollEdgeEffect?: ScrollEdgeEffect;
|
|
208
|
+
/**
|
|
209
|
+
* The scroll edge effect applied to the bottom edge of the scroll view.
|
|
210
|
+
*
|
|
211
|
+
* @platform ios 26+
|
|
212
|
+
* @default 'hidden'
|
|
213
|
+
*/
|
|
214
|
+
bottomScrollEdgeEffect?: ScrollEdgeEffect;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Options for header behavior
|
|
218
|
+
*/
|
|
219
|
+
export interface HeaderOptions {
|
|
220
|
+
/**
|
|
221
|
+
* How the header participates in the sheet layout.
|
|
222
|
+
*
|
|
223
|
+
* - `'relative'`: The header takes up space above the content, and its height
|
|
224
|
+
* is included in the `auto` detent calculation.
|
|
225
|
+
* - `'absolute'`: The header floats over the content, pinned to the top edge,
|
|
226
|
+
* and is excluded from the `auto` detent calculation.
|
|
227
|
+
*
|
|
228
|
+
* @default 'relative'
|
|
229
|
+
*/
|
|
230
|
+
position?: 'relative' | 'absolute';
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Options for footer behavior
|
|
234
|
+
*/
|
|
235
|
+
export interface FooterOptions {
|
|
236
|
+
/**
|
|
237
|
+
* How the footer participates in the sheet layout.
|
|
238
|
+
*
|
|
239
|
+
* - `'relative'`: The footer takes up space below the content, pinned to the
|
|
240
|
+
* bottom edge. Its height is included in the `auto` detent calculation but
|
|
241
|
+
* excluded from the `peek` detent (it's pushed off-screen at peek).
|
|
242
|
+
* - `'absolute'`: The footer floats over the content, pinned to the bottom
|
|
243
|
+
* edge. Its height is excluded from the `auto` detent calculation but
|
|
244
|
+
* included in the `peek` detent.
|
|
245
|
+
*
|
|
246
|
+
* @default 'relative'
|
|
247
|
+
*/
|
|
248
|
+
position?: 'relative' | 'absolute';
|
|
249
|
+
/**
|
|
250
|
+
* Adjusts how far an `absolute` footer rises when the keyboard opens.
|
|
251
|
+
* Positive values raise it higher; negative values reduce the rise.
|
|
252
|
+
* Pass `-insets.bottom` to tuck the footer's safe-area padding behind the keyboard.
|
|
253
|
+
* A `relative` footer stays in the layout flow behind the keyboard, so this has no effect.
|
|
254
|
+
*
|
|
255
|
+
* @default 0
|
|
256
|
+
*/
|
|
257
|
+
keyboardOffset?: number;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Options for customizing the blur effect.
|
|
261
|
+
* Only applies when `backgroundBlur` is set.
|
|
262
|
+
*
|
|
263
|
+
* @platform ios
|
|
264
|
+
*/
|
|
265
|
+
export interface BlurOptions {
|
|
266
|
+
/**
|
|
267
|
+
* The intensity of the blur effect (0-100).
|
|
268
|
+
* Uses system default if not provided.
|
|
269
|
+
*/
|
|
270
|
+
intensity?: number;
|
|
271
|
+
/**
|
|
272
|
+
* Enables or disables user interaction on the blur view.
|
|
273
|
+
* Disabling this can help with visual artifacts (flash) on iOS 18+
|
|
274
|
+
* when touching the sheet content with blur enabled.
|
|
275
|
+
*
|
|
276
|
+
* @default true
|
|
277
|
+
*/
|
|
278
|
+
interaction?: boolean;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Inset adjustment behavior for the sheet content.
|
|
282
|
+
*/
|
|
283
|
+
export type InsetAdjustment =
|
|
284
|
+
/**
|
|
285
|
+
* Automatically adjusts the sheet height to account for system insets (safe area).
|
|
286
|
+
* This ensures the sheet content is properly inset from system UI elements.
|
|
287
|
+
*/
|
|
288
|
+
'automatic'
|
|
289
|
+
/**
|
|
290
|
+
* Does not adjust the sheet height for system insets.
|
|
291
|
+
* The sheet height is calculated purely from the detent values.
|
|
292
|
+
*/
|
|
293
|
+
| 'never';
|
|
44
294
|
/**
|
|
45
295
|
* Blur style mapped to native values in IOS.
|
|
46
296
|
*
|
|
47
297
|
* @platform ios
|
|
48
298
|
*/
|
|
49
|
-
export type
|
|
299
|
+
export type BackgroundBlur = 'light' | 'dark' | 'default' | 'extra-light' | 'regular' | 'prominent' | 'system-ultra-thin-material' | 'system-thin-material' | 'system-material' | 'system-thick-material' | 'system-chrome-material' | 'system-ultra-thin-material-light' | 'system-thin-material-light' | 'system-material-light' | 'system-thick-material-light' | 'system-chrome-material-light' | 'system-ultra-thin-material-dark' | 'system-thin-material-dark' | 'system-material-dark' | 'system-thick-material-dark' | 'system-chrome-material-dark';
|
|
50
300
|
/**
|
|
51
301
|
* Supported Sheet detent.
|
|
52
|
-
*
|
|
53
|
-
* @platform android
|
|
54
|
-
* @platform ios 15+
|
|
55
302
|
*/
|
|
56
303
|
export type SheetDetent =
|
|
57
304
|
/**
|
|
58
305
|
* Auto resize based on content height, clamped to container height.
|
|
59
|
-
* Use the `
|
|
306
|
+
* Use the `maxContentHeight` prop to set a custom limit.
|
|
60
307
|
*
|
|
61
308
|
* @platform android
|
|
62
309
|
* @platform ios 16+
|
|
63
310
|
*/
|
|
64
311
|
'auto'
|
|
312
|
+
/**
|
|
313
|
+
* Collapsed height based on the combined `header` and `footer` heights.
|
|
314
|
+
* Render a `TrueSheetPeek` component within the content to also include
|
|
315
|
+
* the content up to its bottom edge.
|
|
316
|
+
* Falls back to a fixed height of `150` when none is provided.
|
|
317
|
+
*
|
|
318
|
+
* @platform android
|
|
319
|
+
* @platform ios 16+
|
|
320
|
+
*/
|
|
321
|
+
| 'peek'
|
|
65
322
|
/**
|
|
66
323
|
* Relative height as a fraction (0-1) of the available height.
|
|
67
324
|
* For example, 0.5 represents 50% of the available height.
|
|
@@ -95,6 +352,9 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
95
352
|
* detents={['auto', 0.6, 1]}
|
|
96
353
|
* ```
|
|
97
354
|
*
|
|
355
|
+
* @note It's recommended to sort detents from smallest to largest.
|
|
356
|
+
* When using `auto`, place it at the first index if you plan to adjust content dynamically.
|
|
357
|
+
*
|
|
98
358
|
* @default [0.5, 1]
|
|
99
359
|
*/
|
|
100
360
|
detents?: SheetDetent[];
|
|
@@ -102,8 +362,6 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
102
362
|
* Specify whether the sheet background is dimmed.
|
|
103
363
|
* Set to `false` to allow interaction with the background components.
|
|
104
364
|
*
|
|
105
|
-
* @platform android
|
|
106
|
-
* @platform ios 15+
|
|
107
365
|
* @default true
|
|
108
366
|
*/
|
|
109
367
|
dimmed?: boolean;
|
|
@@ -121,23 +379,44 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
121
379
|
* @default true
|
|
122
380
|
*/
|
|
123
381
|
initialDetentAnimated?: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Specify whether the sheet content should mount lazily, on first presentation.
|
|
384
|
+
* Set to `false` to mount the content before presentation without presenting the sheet.
|
|
385
|
+
* Use this when content is not ready on the first render, then call `present()`
|
|
386
|
+
* after your readiness signal so auto detents measure the settled content.
|
|
387
|
+
*
|
|
388
|
+
* Content that requires window attachment to measure, such as SwiftUI-hosted views,
|
|
389
|
+
* still only measures during presentation.
|
|
390
|
+
*
|
|
391
|
+
* @platform android
|
|
392
|
+
* @platform ios
|
|
393
|
+
* @default true
|
|
394
|
+
*/
|
|
395
|
+
lazy?: boolean;
|
|
124
396
|
/**
|
|
125
397
|
* The detent index that the sheet should start to dim the background.
|
|
126
398
|
* This is ignored if `dimmed` is set to `false`.
|
|
127
399
|
*
|
|
128
400
|
* @default 0
|
|
129
401
|
*/
|
|
130
|
-
|
|
402
|
+
dimmedDetentIndex?: number;
|
|
131
403
|
/**
|
|
132
404
|
* Prevents interactive dismissal of the Sheet.
|
|
405
|
+
* Blocked attempts fire `onDismissAttempt`, so you can confirm before dismissing programmatically.
|
|
133
406
|
*
|
|
134
407
|
* @default true
|
|
135
408
|
*/
|
|
136
409
|
dismissible?: boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Enables or disables dragging the sheet to resize it.
|
|
412
|
+
* When disabled, the sheet becomes static and can only be resized programmatically.
|
|
413
|
+
*
|
|
414
|
+
* @default true
|
|
415
|
+
*/
|
|
416
|
+
draggable?: boolean;
|
|
137
417
|
/**
|
|
138
418
|
* Main sheet background color.
|
|
139
|
-
|
|
140
|
-
* @default white
|
|
419
|
+
* Uses system default when not provided.
|
|
141
420
|
*/
|
|
142
421
|
backgroundColor?: ColorValue;
|
|
143
422
|
/**
|
|
@@ -146,56 +425,163 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
146
425
|
* - `undefined` (not provided): Uses system default corner radius
|
|
147
426
|
* - `0`: Sharp corners (no rounding)
|
|
148
427
|
* - `> 0`: Custom corner radius value
|
|
149
|
-
*
|
|
150
|
-
* @platform android
|
|
151
|
-
* @platform ios 15+
|
|
152
428
|
*/
|
|
153
429
|
cornerRadius?: number;
|
|
154
430
|
/**
|
|
155
|
-
* Shows native grabber (or handle) on
|
|
431
|
+
* Shows a native grabber (or drag handle) on the sheet.
|
|
432
|
+
*
|
|
433
|
+
* iOS uses the native `UISheetPresentationController` grabber.
|
|
434
|
+
* Android renders a native view following Material Design 3 specifications.
|
|
156
435
|
*
|
|
157
|
-
* @platform ios
|
|
158
436
|
* @default true
|
|
159
437
|
*/
|
|
160
438
|
grabber?: boolean;
|
|
161
439
|
/**
|
|
162
|
-
*
|
|
440
|
+
* Options for customizing the grabber appearance.
|
|
441
|
+
* Only applies when `grabber` is `true`.
|
|
442
|
+
*/
|
|
443
|
+
grabberOptions?: GrabberOptions;
|
|
444
|
+
/**
|
|
445
|
+
* Options for customizing (e.g. localizing) the accessibility strings
|
|
446
|
+
* announced by screen readers.
|
|
447
|
+
*/
|
|
448
|
+
accessibilityOptions?: AccessibilityOptions;
|
|
449
|
+
/**
|
|
450
|
+
* Controls the sheet presentation style on iPad and web (landscape/tablet).
|
|
451
|
+
* - `'page'`: bottom-attached page sheet (full or readable width).
|
|
452
|
+
* - `'form'`: centered floating form sheet (default form-sheet width).
|
|
163
453
|
*
|
|
164
|
-
*
|
|
454
|
+
* `'form'` is absolute — `maxContentWidth` is ignored when set.
|
|
455
|
+
*
|
|
456
|
+
* @platform ios 17+, web
|
|
457
|
+
* @default 'page'
|
|
165
458
|
*/
|
|
166
|
-
|
|
459
|
+
presentation?: 'page' | 'form';
|
|
167
460
|
/**
|
|
168
461
|
* The blur effect style on iOS.
|
|
169
|
-
*
|
|
462
|
+
* Blends with `backgroundColor` when provided.
|
|
170
463
|
*
|
|
171
464
|
* @platform ios
|
|
172
465
|
*/
|
|
173
|
-
|
|
466
|
+
backgroundBlur?: BackgroundBlur;
|
|
467
|
+
/**
|
|
468
|
+
* Options for customizing the blur effect.
|
|
469
|
+
* Only applies when `backgroundBlur` is set.
|
|
470
|
+
*
|
|
471
|
+
* @platform ios
|
|
472
|
+
*/
|
|
473
|
+
blurOptions?: BlurOptions;
|
|
174
474
|
/**
|
|
175
475
|
* Overrides `large` or `100%` height.
|
|
176
476
|
* Also sets the maximum height for 'auto' detents.
|
|
177
477
|
*/
|
|
178
|
-
|
|
478
|
+
maxContentHeight?: number;
|
|
179
479
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
480
|
+
* The maximum width of the sheet content.
|
|
481
|
+
* On Android and Web, defaults to `640dp`. On iOS, the sheet uses system default width.
|
|
482
|
+
*
|
|
483
|
+
* Ignored on phones in portrait orientation.
|
|
484
|
+
*/
|
|
485
|
+
maxContentWidth?: number;
|
|
486
|
+
/**
|
|
487
|
+
* Anchors the sheet to the specified horizontal edge.
|
|
488
|
+
*
|
|
489
|
+
* - `'center'`: Centers the sheet horizontally (default).
|
|
490
|
+
* - `'left'`: Anchors the sheet to the left edge.
|
|
491
|
+
* - `'right'`: Anchors the sheet to the right edge.
|
|
492
|
+
*
|
|
493
|
+
* Ignored on phones in portrait orientation.
|
|
494
|
+
*
|
|
495
|
+
* @default 'center'
|
|
496
|
+
*/
|
|
497
|
+
anchor?: 'left' | 'center' | 'right';
|
|
498
|
+
/**
|
|
499
|
+
* The offset from the screen edge.
|
|
500
|
+
* Only applies when `anchor` is `'left'` or `'right'`.
|
|
182
501
|
*
|
|
183
502
|
* @platform android
|
|
184
|
-
* @
|
|
503
|
+
* @platform web
|
|
504
|
+
* @default 16
|
|
505
|
+
*/
|
|
506
|
+
anchorOffset?: number;
|
|
507
|
+
/**
|
|
508
|
+
* Controls how the sheet adjusts its height for system insets (safe area).
|
|
509
|
+
*
|
|
510
|
+
* - `'automatic'`: Adds the bottom safe area inset to the sheet height,
|
|
511
|
+
* ensuring content is properly inset from system UI elements.
|
|
512
|
+
* - `'never'`: Does not adjust for insets; height is calculated purely from detent values.
|
|
513
|
+
*
|
|
514
|
+
* @default 'automatic'
|
|
515
|
+
*/
|
|
516
|
+
insetAdjustment?: InsetAdjustment;
|
|
517
|
+
/**
|
|
518
|
+
* The elevation (shadow depth) of the sheet.
|
|
519
|
+
*
|
|
520
|
+
* @platform android
|
|
521
|
+
* @platform web
|
|
522
|
+
* @default 4
|
|
523
|
+
*/
|
|
524
|
+
elevation?: number;
|
|
525
|
+
/**
|
|
526
|
+
* A component that is fixed at the top of the Sheet content.
|
|
527
|
+
* Useful for search bars, titles, or other header content.
|
|
528
|
+
*/
|
|
529
|
+
header?: ComponentType<unknown> | ReactElement;
|
|
530
|
+
/**
|
|
531
|
+
* Style for the header container.
|
|
532
|
+
*/
|
|
533
|
+
headerStyle?: StyleProp<ViewStyle>;
|
|
534
|
+
/**
|
|
535
|
+
* Options for header behavior.
|
|
185
536
|
*/
|
|
186
|
-
|
|
537
|
+
headerOptions?: HeaderOptions;
|
|
187
538
|
/**
|
|
188
539
|
* A component that floats at the bottom of the Sheet.
|
|
189
540
|
*/
|
|
190
541
|
footer?: ComponentType<unknown> | ReactElement;
|
|
191
542
|
/**
|
|
192
|
-
*
|
|
193
|
-
|
|
543
|
+
* Style for the footer container.
|
|
544
|
+
*/
|
|
545
|
+
footerStyle?: StyleProp<ViewStyle>;
|
|
546
|
+
/**
|
|
547
|
+
* A ref to the scrollable component (e.g. `ScrollView`, `FlatList`)
|
|
548
|
+
* rendered within the sheet content.
|
|
549
|
+
* Required for scrollable handling — nested scrolling, keyboard insets,
|
|
550
|
+
* and `auto` detent sizing are wired to this scrollable.
|
|
194
551
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
552
|
+
* Example:
|
|
553
|
+
* ```tsx
|
|
554
|
+
* const scrollableRef = useRef<ScrollView>(null)
|
|
555
|
+
*
|
|
556
|
+
* <TrueSheet scrollableRef={scrollableRef}>
|
|
557
|
+
* <ScrollView ref={scrollableRef} />
|
|
558
|
+
* </TrueSheet>
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
scrollableRef?: RefObject<Component<unknown> | null>;
|
|
562
|
+
/**
|
|
563
|
+
* Options for scrollable behavior.
|
|
564
|
+
* Applies to the scrollable provided via `scrollableRef`.
|
|
565
|
+
*/
|
|
566
|
+
scrollableOptions?: ScrollableOptions;
|
|
567
|
+
/**
|
|
568
|
+
* Options for footer behavior.
|
|
569
|
+
*/
|
|
570
|
+
footerOptions?: FooterOptions;
|
|
571
|
+
/**
|
|
572
|
+
* Renders the sheet as a detached floating card, not attached to the bottom edge.
|
|
573
|
+
*
|
|
574
|
+
* @platform web
|
|
575
|
+
* @default false
|
|
576
|
+
*/
|
|
577
|
+
detached?: boolean;
|
|
578
|
+
/**
|
|
579
|
+
* The offset from the bottom edge when [`detached`](#detached) is enabled.
|
|
580
|
+
*
|
|
581
|
+
* @platform web
|
|
582
|
+
* @default 16
|
|
197
583
|
*/
|
|
198
|
-
|
|
584
|
+
detachedOffset?: number;
|
|
199
585
|
/**
|
|
200
586
|
* Called when the sheet's content is mounted and ready.
|
|
201
587
|
* The sheet automatically waits for this event before presenting.
|
|
@@ -218,6 +604,12 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
218
604
|
* Called when the Sheet has been dismissed
|
|
219
605
|
*/
|
|
220
606
|
onDidDismiss?: (event: DidDismissEvent) => void;
|
|
607
|
+
/**
|
|
608
|
+
* Called when the user tries to dismiss the sheet while `dismissible` is `false`,
|
|
609
|
+
* e.g. by dragging down or pressing back/escape. Tapping the dim does not count.
|
|
610
|
+
* The sheet stays presented. Confirm with the user, then call `dismiss()` to proceed.
|
|
611
|
+
*/
|
|
612
|
+
onDismissAttempt?: (event: DismissAttemptEvent) => void;
|
|
221
613
|
/**
|
|
222
614
|
* Called when the detent of the sheet has changed.
|
|
223
615
|
* Either by dragging or programatically.
|
|
@@ -226,35 +618,123 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
226
618
|
/**
|
|
227
619
|
* Called when the sheet has began dragging.
|
|
228
620
|
* Comes with the detent info.
|
|
229
|
-
*
|
|
230
|
-
* @platform android
|
|
231
|
-
* @platform ios 15+
|
|
232
621
|
*/
|
|
233
622
|
onDragBegin?: (event: DragBeginEvent) => void;
|
|
234
623
|
/**
|
|
235
624
|
* Called when the sheet is being dragged.
|
|
236
625
|
* Comes with the detent info.
|
|
237
|
-
*
|
|
238
|
-
* @platform android
|
|
239
|
-
* @platform ios 15+
|
|
240
626
|
*/
|
|
241
627
|
onDragChange?: (event: DragChangeEvent) => void;
|
|
242
628
|
/**
|
|
243
629
|
* Called when the sheet dragging has ended.
|
|
244
630
|
* Comes with the detent info.
|
|
245
|
-
*
|
|
246
|
-
* @platform android
|
|
247
|
-
* @platform ios 15+
|
|
248
631
|
*/
|
|
249
632
|
onDragEnd?: (event: DragEndEvent) => void;
|
|
250
633
|
/**
|
|
251
634
|
* Called when the sheet's position changes.
|
|
252
635
|
* This fires continuously during sheet position changes.
|
|
253
636
|
* Comes with the detent info.
|
|
637
|
+
*/
|
|
638
|
+
onPositionChange?: (event: PositionChangeEvent) => void;
|
|
639
|
+
/**
|
|
640
|
+
* Called when the sheet is about to regain focus because a sheet presented on top of it is being dismissed.
|
|
641
|
+
*/
|
|
642
|
+
onWillFocus?: (event: WillFocusEvent) => void;
|
|
643
|
+
/**
|
|
644
|
+
* Called when the sheet regains focus after a sheet presented on top of it is dismissed.
|
|
645
|
+
*/
|
|
646
|
+
onDidFocus?: (event: DidFocusEvent) => void;
|
|
647
|
+
/**
|
|
648
|
+
* Called when the sheet is about to lose focus because another sheet is being presented on top of it.
|
|
649
|
+
*/
|
|
650
|
+
onWillBlur?: (event: WillBlurEvent) => void;
|
|
651
|
+
/**
|
|
652
|
+
* Called when the sheet loses focus because another sheet is presented on top of it.
|
|
653
|
+
*/
|
|
654
|
+
onDidBlur?: (event: DidBlurEvent) => void;
|
|
655
|
+
/**
|
|
656
|
+
* Called when the hardware back button is pressed on Android.
|
|
657
|
+
* Optionally return `false` to let the back event propagate to other handlers (e.g. navigation).
|
|
254
658
|
*
|
|
255
659
|
* @platform android
|
|
256
|
-
* @platform ios 15+
|
|
257
660
|
*/
|
|
258
|
-
|
|
661
|
+
onBackPress?: () => boolean | void;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Imperative methods available on a TrueSheet ref.
|
|
665
|
+
*
|
|
666
|
+
* Example:
|
|
667
|
+
* ```tsx
|
|
668
|
+
* const sheetRef = useRef<TrueSheetMethods>(null);
|
|
669
|
+
* sheetRef.current?.present();
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
export interface TrueSheetMethods {
|
|
673
|
+
/**
|
|
674
|
+
* Present the sheet at a given detent index.
|
|
675
|
+
*
|
|
676
|
+
* @param index - The detent index to present at (default: `0`).
|
|
677
|
+
* @param animated - Whether to animate the presentation (default: `true`). Ignored on web.
|
|
678
|
+
*/
|
|
679
|
+
present(index?: number, animated?: boolean): Promise<void>;
|
|
680
|
+
/**
|
|
681
|
+
* Resize the sheet to a given detent index.
|
|
682
|
+
*
|
|
683
|
+
* @param index - The detent index to resize to.
|
|
684
|
+
*/
|
|
685
|
+
resize(index: number): Promise<void>;
|
|
686
|
+
/**
|
|
687
|
+
* Dismiss this sheet and all sheets presented on top of it in a single animation.
|
|
688
|
+
*
|
|
689
|
+
* @param animated - Whether to animate the dismissal (default: `true`). Ignored on web.
|
|
690
|
+
*/
|
|
691
|
+
dismiss(animated?: boolean): Promise<void>;
|
|
692
|
+
/**
|
|
693
|
+
* Dismiss only the sheets presented on top of this sheet, keeping this sheet presented.
|
|
694
|
+
* No-op if no sheets are presented on top.
|
|
695
|
+
*
|
|
696
|
+
* @param animated - Whether to animate the dismissal (default: `true`). Ignored on web.
|
|
697
|
+
*/
|
|
698
|
+
dismissStack(animated?: boolean): Promise<void>;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Static methods exposed on the `TrueSheet` component for controlling sheets by `name`.
|
|
702
|
+
*
|
|
703
|
+
* Example:
|
|
704
|
+
* ```ts
|
|
705
|
+
* TrueSheet.present('my-sheet')
|
|
706
|
+
* ```
|
|
707
|
+
*
|
|
708
|
+
* @note Not supported on web — use the `useTrueSheet()` hook instead.
|
|
709
|
+
*/
|
|
710
|
+
export interface TrueSheetStaticMethods {
|
|
711
|
+
/**
|
|
712
|
+
* Present the sheet with the given `name`.
|
|
713
|
+
*
|
|
714
|
+
* @throws if no sheet with the given `name` is registered.
|
|
715
|
+
*/
|
|
716
|
+
present(name: string, index?: number, animated?: boolean): Promise<void>;
|
|
717
|
+
/**
|
|
718
|
+
* Resize the sheet with the given `name`.
|
|
719
|
+
*
|
|
720
|
+
* @throws if no sheet with the given `name` is registered.
|
|
721
|
+
*/
|
|
722
|
+
resize(name: string, index: number): Promise<void>;
|
|
723
|
+
/**
|
|
724
|
+
* Dismiss the sheet with the given `name` and all sheets presented on top of it.
|
|
725
|
+
*
|
|
726
|
+
* @throws if no sheet with the given `name` is registered.
|
|
727
|
+
*/
|
|
728
|
+
dismiss(name: string, animated?: boolean): Promise<void>;
|
|
729
|
+
/**
|
|
730
|
+
* Dismiss only the sheets presented on top of the sheet with the given `name`.
|
|
731
|
+
*
|
|
732
|
+
* @throws if no sheet with the given `name` is registered.
|
|
733
|
+
*/
|
|
734
|
+
dismissStack(name: string, animated?: boolean): Promise<void>;
|
|
735
|
+
/**
|
|
736
|
+
* Dismiss every presented sheet, from the top of the stack downward.
|
|
737
|
+
*/
|
|
738
|
+
dismissAll(animated?: boolean): Promise<void>;
|
|
259
739
|
}
|
|
260
740
|
//# sourceMappingURL=TrueSheet.types.d.ts.map
|