@lodev09/react-native-true-sheet 4.0.0-beta.0 → 4.0.0-beta.2
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 +42 -31
- package/RNTrueSheet.podspec +10 -2
- package/android/build.gradle +2 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +174 -49
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerViewManager.kt +7 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +371 -18
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +14 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +156 -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/TrueSheetPackage.kt +5 -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 +45 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +526 -231
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +1224 -603
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +136 -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 +303 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +277 -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/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 +112 -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 +30 -0
- package/android/src/main/jni/CMakeLists.txt +63 -0
- package/android/src/main/jni/TrueSheetSpec.h +19 -0
- package/android/src/main/jni/TrueSheetStateUpdater.cpp +96 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +24 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +43 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +28 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +11 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +37 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h +24 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +56 -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/TrueSheetViewComponentDescriptor.h +28 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +61 -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 +81 -6
- package/ios/TrueSheetContainerView.mm +275 -21
- package/ios/TrueSheetContentView.h +38 -1
- package/ios/TrueSheetContentView.mm +413 -43
- package/ios/TrueSheetFooterView.h +27 -2
- package/ios/TrueSheetFooterView.mm +141 -35
- package/ios/{events/OnDidDismissEvent.h → TrueSheetHeaderView.h} +10 -7
- package/ios/TrueSheetHeaderView.mm +64 -0
- package/ios/TrueSheetModule.mm +92 -5
- package/ios/TrueSheetPeekView.h +32 -0
- package/ios/TrueSheetPeekView.mm +99 -0
- package/ios/TrueSheetView.h +7 -15
- package/ios/TrueSheetView.mm +633 -215
- package/ios/TrueSheetViewController.h +84 -16
- package/ios/TrueSheetViewController.mm +1133 -333
- 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 +178 -0
- package/ios/core/TrueSheetKeyboardObserver.h +39 -0
- package/ios/core/TrueSheetKeyboardObserver.mm +112 -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 +40 -0
- package/ios/events/TrueSheetLifecycleEvents.mm +71 -0
- package/ios/events/TrueSheetStateEvents.h +35 -0
- package/ios/events/TrueSheetStateEvents.mm +49 -0
- package/ios/tvos/TrueSheetStubs.mm +154 -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/{events/OnWillDismissEvent.h → utils/UIView+ScrollEdgeInteraction.h} +6 -7
- package/ios/utils/UIView+ScrollEdgeInteraction.mm +62 -0
- package/ios/utils/WindowUtil.mm +17 -1
- package/lib/module/TrueSheet.js +230 -64
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +1203 -0
- package/lib/module/TrueSheet.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/TrueSheetPeekViewNativeComponent.ts +8 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +105 -18
- package/lib/module/index.js +3 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +93 -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/createTrueSheetRouter.js +166 -0
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -0
- package/lib/module/navigation/expo-router/index.js +48 -0
- package/lib/module/navigation/expo-router/index.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 +68 -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 +15 -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 +1309 -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 +51 -14
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +463 -54
- 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/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/TrueSheetPeekViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetPeekViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +67 -16
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/index.d.ts +43 -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/createTrueSheetRouter.d.ts +14 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.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/index.d.ts +46 -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 +33 -0
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -0
- package/lib/typescript/src/navigation/types.d.ts +177 -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 +13 -0
- package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/context.d.ts +53 -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 +228 -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 +95 -36
- package/react-native.config.js +9 -2
- package/src/TrueSheet.tsx +281 -62
- package/src/TrueSheet.types.ts +525 -71
- package/src/TrueSheet.web.tsx +1362 -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/TrueSheetPeekViewNativeComponent.ts +8 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +105 -18
- package/src/index.ts +2 -2
- package/src/mocks/index.ts +89 -0
- package/src/mocks/navigation.ts +79 -0
- package/src/mocks/navigationExpoRouter.ts +40 -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/createTrueSheetRouter.ts +222 -0
- package/src/navigation/expo-router/index.ts +89 -0
- package/src/navigation/index.ts +81 -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 +100 -0
- package/src/navigation/types.ts +251 -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 +20 -0
- package/src/web/vaul/context.ts +101 -0
- package/src/web/vaul/helpers.ts +131 -0
- package/src/web/vaul/index.tsx +1740 -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.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
package/src/TrueSheet.types.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ComponentType, ReactElement } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type {
|
|
3
|
+
ColorValue,
|
|
4
|
+
NativeSyntheticEvent,
|
|
5
|
+
StyleProp,
|
|
6
|
+
ViewProps,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
} from 'react-native';
|
|
5
9
|
|
|
6
10
|
export interface DetentInfoEventPayload {
|
|
7
11
|
/**
|
|
@@ -12,14 +16,18 @@ export interface DetentInfoEventPayload {
|
|
|
12
16
|
* The Y position of the sheet relative to the screen.
|
|
13
17
|
*/
|
|
14
18
|
position: number;
|
|
19
|
+
/**
|
|
20
|
+
* The detent value (0-1) for the current index.
|
|
21
|
+
*/
|
|
22
|
+
detent: number;
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
export interface PositionChangeEventPayload extends DetentInfoEventPayload {
|
|
18
26
|
/**
|
|
19
|
-
*
|
|
20
|
-
* When
|
|
27
|
+
* Indicates whether the position value is real-time (e.g., during drag or animation tracking).
|
|
28
|
+
* When false, the position should be animated in JS.
|
|
21
29
|
*/
|
|
22
|
-
|
|
30
|
+
realtime: boolean;
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
export type MountEvent = NativeSyntheticEvent<null>;
|
|
@@ -32,66 +40,298 @@ export type DragBeginEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
|
32
40
|
export type DragChangeEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
33
41
|
export type DragEndEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
34
42
|
export type PositionChangeEvent = NativeSyntheticEvent<PositionChangeEventPayload>;
|
|
43
|
+
export type DidFocusEvent = NativeSyntheticEvent<null>;
|
|
44
|
+
export type DidBlurEvent = NativeSyntheticEvent<null>;
|
|
45
|
+
export type WillFocusEvent = NativeSyntheticEvent<null>;
|
|
46
|
+
export type WillBlurEvent = NativeSyntheticEvent<null>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Options for customizing the grabber (drag handle) appearance.
|
|
50
|
+
*/
|
|
51
|
+
export interface GrabberOptions {
|
|
52
|
+
/**
|
|
53
|
+
* The width of the grabber pill.
|
|
54
|
+
*
|
|
55
|
+
* @default iOS: 36, Android: 32
|
|
56
|
+
*/
|
|
57
|
+
width?: number;
|
|
58
|
+
/**
|
|
59
|
+
* The height of the grabber pill.
|
|
60
|
+
*
|
|
61
|
+
* @default iOS: 5, Android: 4
|
|
62
|
+
*/
|
|
63
|
+
height?: number;
|
|
64
|
+
/**
|
|
65
|
+
* The top margin of the grabber from the sheet edge.
|
|
66
|
+
*
|
|
67
|
+
* @default iOS: 5, Android: 16
|
|
68
|
+
*/
|
|
69
|
+
topMargin?: number;
|
|
70
|
+
/**
|
|
71
|
+
* The corner radius of the grabber pill.
|
|
72
|
+
*
|
|
73
|
+
* @default height / 2
|
|
74
|
+
*/
|
|
75
|
+
cornerRadius?: number;
|
|
76
|
+
/**
|
|
77
|
+
* The color of the grabber.
|
|
78
|
+
* Uses native vibrancy/material styling when not provided.
|
|
79
|
+
*/
|
|
80
|
+
color?: ColorValue;
|
|
81
|
+
/**
|
|
82
|
+
* Whether the grabber color adapts to light/dark mode.
|
|
83
|
+
* When enabled, the grabber uses vibrancy effect on iOS and
|
|
84
|
+
* adjusts color based on the current theme on Android.
|
|
85
|
+
*
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
adaptive?: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Options for customizing (e.g. localizing) the accessibility strings
|
|
93
|
+
* announced by screen readers.
|
|
94
|
+
*
|
|
95
|
+
* On iOS, the grabber strings only apply when `grabberOptions` is provided.
|
|
96
|
+
* Without it, iOS uses the system grabber which is already localized.
|
|
97
|
+
*/
|
|
98
|
+
export interface AccessibilityOptions {
|
|
99
|
+
/**
|
|
100
|
+
* The accessibility label of the grabber.
|
|
101
|
+
*
|
|
102
|
+
* @default iOS: 'Sheet Grabber', Android: 'Drag handle'
|
|
103
|
+
*/
|
|
104
|
+
grabberLabel?: string;
|
|
105
|
+
/**
|
|
106
|
+
* The accessibility hint of the grabber.
|
|
107
|
+
*
|
|
108
|
+
* @platform ios
|
|
109
|
+
* @default 'Double-tap to expand. Swipe up or down to resize the sheet'
|
|
110
|
+
*/
|
|
111
|
+
grabberHint?: string;
|
|
112
|
+
/**
|
|
113
|
+
* The value announced when the sheet is at the last detent.
|
|
114
|
+
*
|
|
115
|
+
* @default 'Expanded'
|
|
116
|
+
*/
|
|
117
|
+
expandedValue?: string;
|
|
118
|
+
/**
|
|
119
|
+
* The value announced when the sheet is at the first detent.
|
|
120
|
+
*
|
|
121
|
+
* @default 'Collapsed'
|
|
122
|
+
*/
|
|
123
|
+
collapsedValue?: string;
|
|
124
|
+
/**
|
|
125
|
+
* The value announced when the sheet is at an intermediate detent.
|
|
126
|
+
* Supports `{index}` and `{count}` placeholders.
|
|
127
|
+
*
|
|
128
|
+
* @default 'Detent {index} of {count}'
|
|
129
|
+
*/
|
|
130
|
+
detentValue?: string;
|
|
131
|
+
/**
|
|
132
|
+
* The label of the expand accessibility action.
|
|
133
|
+
*
|
|
134
|
+
* @platform android
|
|
135
|
+
* @default 'Expand'
|
|
136
|
+
*/
|
|
137
|
+
expandActionLabel?: string;
|
|
138
|
+
/**
|
|
139
|
+
* The label of the collapse accessibility action.
|
|
140
|
+
*
|
|
141
|
+
* @platform android
|
|
142
|
+
* @default 'Collapse'
|
|
143
|
+
*/
|
|
144
|
+
collapseActionLabel?: string;
|
|
145
|
+
/**
|
|
146
|
+
* The title announced when the sheet appears.
|
|
147
|
+
* Sets the accessibility pane title on Android and the
|
|
148
|
+
* hidden dialog title on Web.
|
|
149
|
+
*
|
|
150
|
+
* @platform android, web
|
|
151
|
+
* @default Android: 'Bottom sheet', Web: 'Sheet'
|
|
152
|
+
*/
|
|
153
|
+
paneTitle?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Scroll edge effect style for iOS 26+.
|
|
158
|
+
* Controls the blur/gradient overlay applied to scroll view edges.
|
|
159
|
+
*
|
|
160
|
+
* @platform ios 26+
|
|
161
|
+
*/
|
|
162
|
+
export type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden';
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Options for scrollable behavior.
|
|
166
|
+
*/
|
|
167
|
+
export interface ScrollableOptions {
|
|
168
|
+
/**
|
|
169
|
+
* Extra offset when scrolling to the focused input when keyboard appears.
|
|
170
|
+
*
|
|
171
|
+
* @default 0
|
|
172
|
+
*/
|
|
173
|
+
keyboardScrollOffset?: number;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Whether scrolling the content expands the sheet to the next detent.
|
|
177
|
+
* When `false`, only the grabber can expand the sheet.
|
|
178
|
+
*
|
|
179
|
+
* @default true
|
|
180
|
+
*/
|
|
181
|
+
scrollingExpandsSheet?: boolean;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The scroll edge effect applied to the top edge of the scroll view.
|
|
185
|
+
*
|
|
186
|
+
* @platform ios 26+
|
|
187
|
+
* @default 'hidden'
|
|
188
|
+
*/
|
|
189
|
+
topScrollEdgeEffect?: ScrollEdgeEffect;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The scroll edge effect applied to the bottom edge of the scroll view.
|
|
193
|
+
*
|
|
194
|
+
* @platform ios 26+
|
|
195
|
+
* @default 'hidden'
|
|
196
|
+
*/
|
|
197
|
+
bottomScrollEdgeEffect?: ScrollEdgeEffect;
|
|
198
|
+
}
|
|
35
199
|
|
|
36
200
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @internal
|
|
201
|
+
* Options for header behavior
|
|
39
202
|
*/
|
|
40
|
-
export interface
|
|
41
|
-
|
|
42
|
-
|
|
203
|
+
export interface HeaderOptions {
|
|
204
|
+
/**
|
|
205
|
+
* How the header participates in the sheet layout.
|
|
206
|
+
*
|
|
207
|
+
* - `'relative'`: The header takes up space above the content, and its height
|
|
208
|
+
* is included in the `auto` detent calculation.
|
|
209
|
+
* - `'absolute'`: The header floats over the content, pinned to the top edge,
|
|
210
|
+
* and is excluded from the `auto` detent calculation.
|
|
211
|
+
*
|
|
212
|
+
* @default 'relative'
|
|
213
|
+
*/
|
|
214
|
+
position?: 'relative' | 'absolute';
|
|
43
215
|
}
|
|
44
216
|
|
|
45
217
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @internal
|
|
218
|
+
* Options for footer behavior
|
|
48
219
|
*/
|
|
49
|
-
export
|
|
220
|
+
export interface FooterOptions {
|
|
221
|
+
/**
|
|
222
|
+
* How the footer participates in the sheet layout.
|
|
223
|
+
*
|
|
224
|
+
* - `'relative'`: The footer takes up space below the content, pinned to the
|
|
225
|
+
* bottom edge. Its height is included in the `auto` detent calculation but
|
|
226
|
+
* excluded from the `peek` detent (it's pushed off-screen at peek).
|
|
227
|
+
* - `'absolute'`: The footer floats over the content, pinned to the bottom
|
|
228
|
+
* edge. Its height is excluded from the `auto` detent calculation but
|
|
229
|
+
* included in the `peek` detent.
|
|
230
|
+
*
|
|
231
|
+
* @default 'relative'
|
|
232
|
+
*/
|
|
233
|
+
position?: 'relative' | 'absolute';
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Adjusts how far an `absolute` footer rises when the keyboard opens.
|
|
237
|
+
* Positive values raise it higher; negative values reduce the rise.
|
|
238
|
+
* Pass `-insets.bottom` to tuck the footer's safe-area padding behind the keyboard.
|
|
239
|
+
* A `relative` footer stays in the layout flow behind the keyboard, so this has no effect.
|
|
240
|
+
*
|
|
241
|
+
* @default 0
|
|
242
|
+
*/
|
|
243
|
+
keyboardOffset?: number;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Options for customizing the blur effect.
|
|
248
|
+
* Only applies when `backgroundBlur` is set.
|
|
249
|
+
*
|
|
250
|
+
* @platform ios
|
|
251
|
+
*/
|
|
252
|
+
export interface BlurOptions {
|
|
253
|
+
/**
|
|
254
|
+
* The intensity of the blur effect (0-100).
|
|
255
|
+
* Uses system default if not provided.
|
|
256
|
+
*/
|
|
257
|
+
intensity?: number;
|
|
258
|
+
/**
|
|
259
|
+
* Enables or disables user interaction on the blur view.
|
|
260
|
+
* Disabling this can help with visual artifacts (flash) on iOS 18+
|
|
261
|
+
* when touching the sheet content with blur enabled.
|
|
262
|
+
*
|
|
263
|
+
* @default true
|
|
264
|
+
*/
|
|
265
|
+
interaction?: boolean;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Inset adjustment behavior for the sheet content.
|
|
270
|
+
*/
|
|
271
|
+
export type InsetAdjustment =
|
|
272
|
+
/**
|
|
273
|
+
* Automatically adjusts the sheet height to account for system insets (safe area).
|
|
274
|
+
* This ensures the sheet content is properly inset from system UI elements.
|
|
275
|
+
*/
|
|
276
|
+
| 'automatic'
|
|
277
|
+
/**
|
|
278
|
+
* Does not adjust the sheet height for system insets.
|
|
279
|
+
* The sheet height is calculated purely from the detent values.
|
|
280
|
+
*/
|
|
281
|
+
| 'never';
|
|
50
282
|
|
|
51
283
|
/**
|
|
52
284
|
* Blur style mapped to native values in IOS.
|
|
53
285
|
*
|
|
54
286
|
* @platform ios
|
|
55
287
|
*/
|
|
56
|
-
export type
|
|
288
|
+
export type BackgroundBlur =
|
|
57
289
|
| 'light'
|
|
58
290
|
| 'dark'
|
|
59
291
|
| 'default'
|
|
60
|
-
| '
|
|
292
|
+
| 'extra-light'
|
|
61
293
|
| 'regular'
|
|
62
294
|
| 'prominent'
|
|
63
|
-
| '
|
|
64
|
-
| '
|
|
65
|
-
| '
|
|
66
|
-
| '
|
|
67
|
-
| '
|
|
68
|
-
| '
|
|
69
|
-
| '
|
|
70
|
-
| '
|
|
71
|
-
| '
|
|
72
|
-
| '
|
|
73
|
-
| '
|
|
74
|
-
| '
|
|
75
|
-
| '
|
|
76
|
-
| '
|
|
77
|
-
| '
|
|
295
|
+
| 'system-ultra-thin-material'
|
|
296
|
+
| 'system-thin-material'
|
|
297
|
+
| 'system-material'
|
|
298
|
+
| 'system-thick-material'
|
|
299
|
+
| 'system-chrome-material'
|
|
300
|
+
| 'system-ultra-thin-material-light'
|
|
301
|
+
| 'system-thin-material-light'
|
|
302
|
+
| 'system-material-light'
|
|
303
|
+
| 'system-thick-material-light'
|
|
304
|
+
| 'system-chrome-material-light'
|
|
305
|
+
| 'system-ultra-thin-material-dark'
|
|
306
|
+
| 'system-thin-material-dark'
|
|
307
|
+
| 'system-material-dark'
|
|
308
|
+
| 'system-thick-material-dark'
|
|
309
|
+
| 'system-chrome-material-dark';
|
|
78
310
|
|
|
79
311
|
/**
|
|
80
312
|
* Supported Sheet detent.
|
|
81
|
-
*
|
|
82
|
-
* @platform android
|
|
83
|
-
* @platform ios 15+
|
|
84
313
|
*/
|
|
85
314
|
export type SheetDetent =
|
|
86
315
|
/**
|
|
87
316
|
* Auto resize based on content height, clamped to container height.
|
|
88
|
-
* Use the `
|
|
317
|
+
* Use the `maxContentHeight` prop to set a custom limit.
|
|
89
318
|
*
|
|
90
319
|
* @platform android
|
|
91
320
|
* @platform ios 16+
|
|
92
321
|
*/
|
|
93
322
|
| 'auto'
|
|
94
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Collapsed height based on the combined `header` and `footer` heights.
|
|
326
|
+
* Render a `TrueSheetPeek` component within the content to also include
|
|
327
|
+
* the content up to its bottom edge.
|
|
328
|
+
* Falls back to a fixed height of `150` when none is provided.
|
|
329
|
+
*
|
|
330
|
+
* @platform android
|
|
331
|
+
* @platform ios 16+
|
|
332
|
+
*/
|
|
333
|
+
| 'peek'
|
|
334
|
+
|
|
95
335
|
/**
|
|
96
336
|
* Relative height as a fraction (0-1) of the available height.
|
|
97
337
|
* For example, 0.5 represents 50% of the available height.
|
|
@@ -126,6 +366,9 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
126
366
|
* detents={['auto', 0.6, 1]}
|
|
127
367
|
* ```
|
|
128
368
|
*
|
|
369
|
+
* @note It's recommended to sort detents from smallest to largest.
|
|
370
|
+
* When using `auto`, place it at the first index if you plan to adjust content dynamically.
|
|
371
|
+
*
|
|
129
372
|
* @default [0.5, 1]
|
|
130
373
|
*/
|
|
131
374
|
detents?: SheetDetent[];
|
|
@@ -134,8 +377,6 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
134
377
|
* Specify whether the sheet background is dimmed.
|
|
135
378
|
* Set to `false` to allow interaction with the background components.
|
|
136
379
|
*
|
|
137
|
-
* @platform android
|
|
138
|
-
* @platform ios 15+
|
|
139
380
|
* @default true
|
|
140
381
|
*/
|
|
141
382
|
dimmed?: boolean;
|
|
@@ -162,7 +403,7 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
162
403
|
*
|
|
163
404
|
* @default 0
|
|
164
405
|
*/
|
|
165
|
-
|
|
406
|
+
dimmedDetentIndex?: number;
|
|
166
407
|
|
|
167
408
|
/**
|
|
168
409
|
* Prevents interactive dismissal of the Sheet.
|
|
@@ -172,9 +413,16 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
172
413
|
dismissible?: boolean;
|
|
173
414
|
|
|
174
415
|
/**
|
|
175
|
-
*
|
|
416
|
+
* Enables or disables dragging the sheet to resize it.
|
|
417
|
+
* When disabled, the sheet becomes static and can only be resized programmatically.
|
|
418
|
+
*
|
|
419
|
+
* @default true
|
|
420
|
+
*/
|
|
421
|
+
draggable?: boolean;
|
|
176
422
|
|
|
177
|
-
|
|
423
|
+
/**
|
|
424
|
+
* Main sheet background color.
|
|
425
|
+
* Uses system default when not provided.
|
|
178
426
|
*/
|
|
179
427
|
backgroundColor?: ColorValue;
|
|
180
428
|
|
|
@@ -184,49 +432,131 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
184
432
|
* - `undefined` (not provided): Uses system default corner radius
|
|
185
433
|
* - `0`: Sharp corners (no rounding)
|
|
186
434
|
* - `> 0`: Custom corner radius value
|
|
187
|
-
*
|
|
188
|
-
* @platform android
|
|
189
|
-
* @platform ios 15+
|
|
190
435
|
*/
|
|
191
436
|
cornerRadius?: number;
|
|
192
437
|
|
|
193
438
|
/**
|
|
194
|
-
* Shows native grabber (or handle) on
|
|
439
|
+
* Shows a native grabber (or drag handle) on the sheet.
|
|
440
|
+
*
|
|
441
|
+
* iOS uses the native `UISheetPresentationController` grabber.
|
|
442
|
+
* Android renders a native view following Material Design 3 specifications.
|
|
195
443
|
*
|
|
196
|
-
* @platform ios
|
|
197
444
|
* @default true
|
|
198
445
|
*/
|
|
199
446
|
grabber?: boolean;
|
|
200
447
|
|
|
201
448
|
/**
|
|
202
|
-
*
|
|
449
|
+
* Options for customizing the grabber appearance.
|
|
450
|
+
* Only applies when `grabber` is `true`.
|
|
451
|
+
*/
|
|
452
|
+
grabberOptions?: GrabberOptions;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Options for customizing (e.g. localizing) the accessibility strings
|
|
456
|
+
* announced by screen readers.
|
|
457
|
+
*/
|
|
458
|
+
accessibilityOptions?: AccessibilityOptions;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Controls the sheet presentation style on iPad and web (landscape/tablet).
|
|
462
|
+
* - `'page'`: bottom-attached page sheet (full or readable width).
|
|
463
|
+
* - `'form'`: centered floating form sheet (default form-sheet width).
|
|
203
464
|
*
|
|
204
|
-
*
|
|
465
|
+
* `'form'` is absolute — `maxContentWidth` is ignored when set.
|
|
466
|
+
*
|
|
467
|
+
* @platform ios 17+, web
|
|
468
|
+
* @default 'page'
|
|
205
469
|
*/
|
|
206
|
-
|
|
470
|
+
presentation?: 'page' | 'form';
|
|
207
471
|
|
|
208
472
|
/**
|
|
209
473
|
* The blur effect style on iOS.
|
|
210
|
-
*
|
|
474
|
+
* Blends with `backgroundColor` when provided.
|
|
211
475
|
*
|
|
212
476
|
* @platform ios
|
|
213
477
|
*/
|
|
214
|
-
|
|
478
|
+
backgroundBlur?: BackgroundBlur;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Options for customizing the blur effect.
|
|
482
|
+
* Only applies when `backgroundBlur` is set.
|
|
483
|
+
*
|
|
484
|
+
* @platform ios
|
|
485
|
+
*/
|
|
486
|
+
blurOptions?: BlurOptions;
|
|
215
487
|
|
|
216
488
|
/**
|
|
217
489
|
* Overrides `large` or `100%` height.
|
|
218
490
|
* Also sets the maximum height for 'auto' detents.
|
|
219
491
|
*/
|
|
220
|
-
|
|
492
|
+
maxContentHeight?: number;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* The maximum width of the sheet content.
|
|
496
|
+
* On Android and Web, defaults to `640dp`. On iOS, the sheet uses system default width.
|
|
497
|
+
*
|
|
498
|
+
* Ignored on phones in portrait orientation.
|
|
499
|
+
*/
|
|
500
|
+
maxContentWidth?: number;
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Anchors the sheet to the specified horizontal edge.
|
|
504
|
+
*
|
|
505
|
+
* - `'center'`: Centers the sheet horizontally (default).
|
|
506
|
+
* - `'left'`: Anchors the sheet to the left edge.
|
|
507
|
+
* - `'right'`: Anchors the sheet to the right edge.
|
|
508
|
+
*
|
|
509
|
+
* Ignored on phones in portrait orientation.
|
|
510
|
+
*
|
|
511
|
+
* @default 'center'
|
|
512
|
+
*/
|
|
513
|
+
anchor?: 'left' | 'center' | 'right';
|
|
221
514
|
|
|
222
515
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
516
|
+
* The offset from the screen edge.
|
|
517
|
+
* Only applies when `anchor` is `'left'` or `'right'`.
|
|
225
518
|
*
|
|
226
519
|
* @platform android
|
|
227
|
-
* @
|
|
520
|
+
* @platform web
|
|
521
|
+
* @default 16
|
|
228
522
|
*/
|
|
229
|
-
|
|
523
|
+
anchorOffset?: number;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Controls how the sheet adjusts its height for system insets (safe area).
|
|
527
|
+
*
|
|
528
|
+
* - `'automatic'`: Adds the bottom safe area inset to the sheet height,
|
|
529
|
+
* ensuring content is properly inset from system UI elements.
|
|
530
|
+
* - `'never'`: Does not adjust for insets; height is calculated purely from detent values.
|
|
531
|
+
*
|
|
532
|
+
* @default 'automatic'
|
|
533
|
+
*/
|
|
534
|
+
insetAdjustment?: InsetAdjustment;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* The elevation (shadow depth) of the sheet.
|
|
538
|
+
*
|
|
539
|
+
* @platform android
|
|
540
|
+
* @platform web
|
|
541
|
+
* @default 4
|
|
542
|
+
*/
|
|
543
|
+
elevation?: number;
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* A component that is fixed at the top of the Sheet content.
|
|
547
|
+
* Useful for search bars, titles, or other header content.
|
|
548
|
+
*/
|
|
549
|
+
header?: ComponentType<unknown> | ReactElement;
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Style for the header container.
|
|
553
|
+
*/
|
|
554
|
+
headerStyle?: StyleProp<ViewStyle>;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Options for header behavior.
|
|
558
|
+
*/
|
|
559
|
+
headerOptions?: HeaderOptions;
|
|
230
560
|
|
|
231
561
|
/**
|
|
232
562
|
* A component that floats at the bottom of the Sheet.
|
|
@@ -234,13 +564,35 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
234
564
|
footer?: ComponentType<unknown> | ReactElement;
|
|
235
565
|
|
|
236
566
|
/**
|
|
237
|
-
*
|
|
238
|
-
|
|
567
|
+
* Style for the footer container.
|
|
568
|
+
*/
|
|
569
|
+
footerStyle?: StyleProp<ViewStyle>;
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Options for scrollable behavior.
|
|
573
|
+
*/
|
|
574
|
+
scrollableOptions?: ScrollableOptions;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Options for footer behavior.
|
|
578
|
+
*/
|
|
579
|
+
footerOptions?: FooterOptions;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Renders the sheet as a detached floating card, not attached to the bottom edge.
|
|
239
583
|
*
|
|
240
|
-
* @platform
|
|
241
|
-
* @default
|
|
584
|
+
* @platform web
|
|
585
|
+
* @default false
|
|
586
|
+
*/
|
|
587
|
+
detached?: boolean;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* The offset from the bottom edge when [`detached`](#detached) is enabled.
|
|
591
|
+
*
|
|
592
|
+
* @platform web
|
|
593
|
+
* @default 16
|
|
242
594
|
*/
|
|
243
|
-
|
|
595
|
+
detachedOffset?: number;
|
|
244
596
|
|
|
245
597
|
/**
|
|
246
598
|
* Called when the sheet's content is mounted and ready.
|
|
@@ -278,27 +630,18 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
278
630
|
/**
|
|
279
631
|
* Called when the sheet has began dragging.
|
|
280
632
|
* Comes with the detent info.
|
|
281
|
-
*
|
|
282
|
-
* @platform android
|
|
283
|
-
* @platform ios 15+
|
|
284
633
|
*/
|
|
285
634
|
onDragBegin?: (event: DragBeginEvent) => void;
|
|
286
635
|
|
|
287
636
|
/**
|
|
288
637
|
* Called when the sheet is being dragged.
|
|
289
638
|
* Comes with the detent info.
|
|
290
|
-
*
|
|
291
|
-
* @platform android
|
|
292
|
-
* @platform ios 15+
|
|
293
639
|
*/
|
|
294
640
|
onDragChange?: (event: DragChangeEvent) => void;
|
|
295
641
|
|
|
296
642
|
/**
|
|
297
643
|
* Called when the sheet dragging has ended.
|
|
298
644
|
* Comes with the detent info.
|
|
299
|
-
*
|
|
300
|
-
* @platform android
|
|
301
|
-
* @platform ios 15+
|
|
302
645
|
*/
|
|
303
646
|
onDragEnd?: (event: DragEndEvent) => void;
|
|
304
647
|
|
|
@@ -306,9 +649,120 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
306
649
|
* Called when the sheet's position changes.
|
|
307
650
|
* This fires continuously during sheet position changes.
|
|
308
651
|
* Comes with the detent info.
|
|
652
|
+
*/
|
|
653
|
+
onPositionChange?: (event: PositionChangeEvent) => void;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Called when the sheet is about to regain focus because a sheet presented on top of it is being dismissed.
|
|
657
|
+
*/
|
|
658
|
+
onWillFocus?: (event: WillFocusEvent) => void;
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Called when the sheet regains focus after a sheet presented on top of it is dismissed.
|
|
662
|
+
*/
|
|
663
|
+
onDidFocus?: (event: DidFocusEvent) => void;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Called when the sheet is about to lose focus because another sheet is being presented on top of it.
|
|
667
|
+
*/
|
|
668
|
+
onWillBlur?: (event: WillBlurEvent) => void;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Called when the sheet loses focus because another sheet is presented on top of it.
|
|
672
|
+
*/
|
|
673
|
+
onDidBlur?: (event: DidBlurEvent) => void;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Called when the hardware back button is pressed on Android.
|
|
677
|
+
* Optionally return `false` to let the back event propagate to other handlers (e.g. navigation).
|
|
309
678
|
*
|
|
310
679
|
* @platform android
|
|
311
|
-
* @platform ios 15+
|
|
312
680
|
*/
|
|
313
|
-
|
|
681
|
+
onBackPress?: () => boolean | void;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Imperative methods available on a TrueSheet ref.
|
|
686
|
+
*
|
|
687
|
+
* Example:
|
|
688
|
+
* ```tsx
|
|
689
|
+
* const sheetRef = useRef<TrueSheetMethods>(null);
|
|
690
|
+
* sheetRef.current?.present();
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
export interface TrueSheetMethods {
|
|
694
|
+
/**
|
|
695
|
+
* Present the sheet at a given detent index.
|
|
696
|
+
*
|
|
697
|
+
* @param index - The detent index to present at (default: `0`).
|
|
698
|
+
* @param animated - Whether to animate the presentation (default: `true`). Ignored on web.
|
|
699
|
+
*/
|
|
700
|
+
present(index?: number, animated?: boolean): Promise<void>;
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Resize the sheet to a given detent index.
|
|
704
|
+
*
|
|
705
|
+
* @param index - The detent index to resize to.
|
|
706
|
+
*/
|
|
707
|
+
resize(index: number): Promise<void>;
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Dismiss this sheet and all sheets presented on top of it in a single animation.
|
|
711
|
+
*
|
|
712
|
+
* @param animated - Whether to animate the dismissal (default: `true`). Ignored on web.
|
|
713
|
+
*/
|
|
714
|
+
dismiss(animated?: boolean): Promise<void>;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Dismiss only the sheets presented on top of this sheet, keeping this sheet presented.
|
|
718
|
+
* No-op if no sheets are presented on top.
|
|
719
|
+
*
|
|
720
|
+
* @param animated - Whether to animate the dismissal (default: `true`). Ignored on web.
|
|
721
|
+
*/
|
|
722
|
+
dismissStack(animated?: boolean): Promise<void>;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Static methods exposed on the `TrueSheet` component for controlling sheets by `name`.
|
|
727
|
+
*
|
|
728
|
+
* Example:
|
|
729
|
+
* ```ts
|
|
730
|
+
* TrueSheet.present('my-sheet')
|
|
731
|
+
* ```
|
|
732
|
+
*
|
|
733
|
+
* @note Not supported on web — use the `useTrueSheet()` hook instead.
|
|
734
|
+
*/
|
|
735
|
+
export interface TrueSheetStaticMethods {
|
|
736
|
+
/**
|
|
737
|
+
* Present the sheet with the given `name`.
|
|
738
|
+
*
|
|
739
|
+
* @throws if no sheet with the given `name` is registered.
|
|
740
|
+
*/
|
|
741
|
+
present(name: string, index?: number, animated?: boolean): Promise<void>;
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Resize the sheet with the given `name`.
|
|
745
|
+
*
|
|
746
|
+
* @throws if no sheet with the given `name` is registered.
|
|
747
|
+
*/
|
|
748
|
+
resize(name: string, index: number): Promise<void>;
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Dismiss the sheet with the given `name` and all sheets presented on top of it.
|
|
752
|
+
*
|
|
753
|
+
* @throws if no sheet with the given `name` is registered.
|
|
754
|
+
*/
|
|
755
|
+
dismiss(name: string, animated?: boolean): Promise<void>;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Dismiss only the sheets presented on top of the sheet with the given `name`.
|
|
759
|
+
*
|
|
760
|
+
* @throws if no sheet with the given `name` is registered.
|
|
761
|
+
*/
|
|
762
|
+
dismissStack(name: string, animated?: boolean): Promise<void>;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Dismiss every presented sheet, from the top of the stack downward.
|
|
766
|
+
*/
|
|
767
|
+
dismissAll(animated?: boolean): Promise<void>;
|
|
314
768
|
}
|