@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
|
@@ -9,18 +9,24 @@
|
|
|
9
9
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
10
|
|
|
11
11
|
#import "TrueSheetFooterView.h"
|
|
12
|
-
#import <react/renderer/components/TrueSheetSpec/ComponentDescriptors.h>
|
|
13
12
|
#import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
|
|
14
13
|
#import <react/renderer/components/TrueSheetSpec/Props.h>
|
|
15
14
|
#import <react/renderer/components/TrueSheetSpec/RCTComponentViewHelpers.h>
|
|
15
|
+
#import <react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h>
|
|
16
|
+
#import <react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h>
|
|
16
17
|
#import "TrueSheetViewController.h"
|
|
17
|
-
#import "utils/
|
|
18
|
+
#import "utils/UIView+ScrollEdgeInteraction.h"
|
|
18
19
|
|
|
19
20
|
using namespace facebook::react;
|
|
20
21
|
|
|
21
22
|
@implementation TrueSheetFooterView {
|
|
23
|
+
TrueSheetFooterViewShadowNode::ConcreteState::Shared _state;
|
|
22
24
|
CGFloat _lastHeight;
|
|
23
|
-
|
|
25
|
+
CGFloat _currentKeyboardOffset;
|
|
26
|
+
CGFloat _bottomInset;
|
|
27
|
+
BOOL _keyboardVisible;
|
|
28
|
+
BOOL _didPushBottomInset;
|
|
29
|
+
CGFloat _appliedBottomInset;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
@@ -32,70 +38,216 @@ using namespace facebook::react;
|
|
|
32
38
|
static const auto defaultProps = std::make_shared<const TrueSheetFooterViewProps>();
|
|
33
39
|
_props = defaultProps;
|
|
34
40
|
|
|
35
|
-
// Set background color to clear by default
|
|
36
41
|
self.backgroundColor = [UIColor clearColor];
|
|
42
|
+
self.isAccessibilityElement = NO;
|
|
37
43
|
|
|
38
44
|
_lastHeight = 0;
|
|
39
|
-
|
|
45
|
+
_currentKeyboardOffset = 0;
|
|
46
|
+
_bottomInset = 0;
|
|
47
|
+
_keyboardVisible = NO;
|
|
48
|
+
_didPushBottomInset = NO;
|
|
49
|
+
_appliedBottomInset = 0;
|
|
40
50
|
}
|
|
41
51
|
return self;
|
|
42
52
|
}
|
|
43
53
|
|
|
44
|
-
- (void)
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
- (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState {
|
|
55
|
+
_state = std::static_pointer_cast<TrueSheetFooterViewShadowNode::ConcreteState const>(state);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Tells the shadow node to pad the footer's bottom edge with the sheet's
|
|
59
|
+
// bottom safe-area inset — the footer owns the sheet's bottom edge, so it
|
|
60
|
+
// absorbs the inset and its background fills it.
|
|
61
|
+
- (void)setBottomInset:(CGFloat)bottomInset {
|
|
62
|
+
// The first push must go through even when the value matches the ivar
|
|
63
|
+
// default (0) — it marks the state initialized so the shadow node stops
|
|
64
|
+
// seeding from the app-wide precalculated inset, which may belong to
|
|
65
|
+
// another sheet (e.g. a floating sheet whose real inset is 0).
|
|
66
|
+
if (_didPushBottomInset && _bottomInset == bottomInset) {
|
|
47
67
|
return;
|
|
48
68
|
}
|
|
69
|
+
_bottomInset = bottomInset;
|
|
70
|
+
[self pushBottomInsetState];
|
|
71
|
+
}
|
|
49
72
|
|
|
50
|
-
|
|
51
|
-
|
|
73
|
+
// Skipped while the keyboard is open — an absolute footer rises above the
|
|
74
|
+
// keyboard, so the inset would leave a gap.
|
|
75
|
+
- (void)setKeyboardVisible:(BOOL)keyboardVisible {
|
|
76
|
+
if (_keyboardVisible == keyboardVisible) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
_keyboardVisible = keyboardVisible;
|
|
80
|
+
[self pushBottomInsetState];
|
|
81
|
+
}
|
|
52
82
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
height:height];
|
|
83
|
+
- (void)pushBottomInsetState {
|
|
84
|
+
if (!_state) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
58
87
|
|
|
59
|
-
|
|
88
|
+
TrueSheetFooterViewState newState;
|
|
89
|
+
newState.bottomInset = _keyboardVisible ? 0 : _bottomInset;
|
|
90
|
+
newState.initialized = true;
|
|
91
|
+
// Immediate so the inset lands before anything reads the footer's height —
|
|
92
|
+
// the async path races the keyboard caret scroll and detent setup, leaving
|
|
93
|
+
// them an inset stale (same reason Android bridges through
|
|
94
|
+
// TrueSheetStateUpdater).
|
|
95
|
+
_state->updateState(std::move(newState), EventQueue::UpdateMode::unstable_Immediate);
|
|
96
|
+
_didPushBottomInset = YES;
|
|
60
97
|
}
|
|
61
98
|
|
|
62
|
-
|
|
63
|
-
|
|
99
|
+
// The inset baked into the current layout by the shadow node (pushed or
|
|
100
|
+
// seeded — see TrueSheetFooterViewShadowNode). Refreshed in
|
|
101
|
+
// updateLayoutMetrics so it always pairs with the measured height.
|
|
102
|
+
- (CGFloat)appliedBottomInset {
|
|
103
|
+
return _appliedBottomInset;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Height the footer occupies above the keyboard — its layout height minus the
|
|
107
|
+
// safe-area inset it drops while the keyboard is open.
|
|
108
|
+
- (CGFloat)keyboardOcclusionHeight {
|
|
109
|
+
return MAX(0, _lastHeight - (_keyboardVisible ? 0 : _bottomInset));
|
|
110
|
+
}
|
|
64
111
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
112
|
+
#pragma mark - Accessibility
|
|
113
|
+
|
|
114
|
+
- (NSArray *)accessibilityElements {
|
|
115
|
+
NSMutableArray *elements = [NSMutableArray array];
|
|
116
|
+
[self collectAccessibilityElementsFromView:self into:elements];
|
|
117
|
+
if (elements.count > 0) {
|
|
118
|
+
return elements;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return [super accessibilityElements];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
- (void)collectAccessibilityElementsFromView:(UIView *)view into:(NSMutableArray *)elements {
|
|
125
|
+
for (UIView *subview in view.subviews) {
|
|
126
|
+
if (subview.isAccessibilityElement || subview.accessibilityLabel || subview.accessibilityIdentifier) {
|
|
127
|
+
[elements addObject:subview];
|
|
128
|
+
} else if (subview.accessibilityElements.count > 0) {
|
|
129
|
+
[elements addObjectsFromArray:subview.accessibilityElements];
|
|
130
|
+
} else {
|
|
131
|
+
[self collectAccessibilityElementsFromView:subview into:elements];
|
|
132
|
+
}
|
|
69
133
|
}
|
|
70
134
|
}
|
|
71
135
|
|
|
136
|
+
#pragma mark - Layout
|
|
137
|
+
|
|
72
138
|
- (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics
|
|
73
139
|
oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
140
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
141
|
+
|
|
142
|
+
// State lands before layout metrics within the same mount transaction, so
|
|
143
|
+
// this reflects the inset the shadow node baked into this frame — seeded
|
|
144
|
+
// values are recorded back into the state at layout time (see
|
|
145
|
+
// TrueSheetFooterViewShadowNode).
|
|
146
|
+
CGFloat previousAppliedBottomInset = _appliedBottomInset;
|
|
147
|
+
if (_state) {
|
|
148
|
+
_appliedBottomInset = _state->getData().bottomInset;
|
|
81
149
|
}
|
|
82
150
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
151
|
+
CGFloat height = layoutMetrics.frame.size.height;
|
|
152
|
+
// An inset change alone (fixed-height footer: padding moves, frame doesn't)
|
|
153
|
+
// still changes what's baked in — report so the controller re-pairs.
|
|
154
|
+
if (height != _lastHeight || _appliedBottomInset != previousAppliedBottomInset) {
|
|
155
|
+
_lastHeight = height;
|
|
156
|
+
[self.delegate footerViewDidChangeSize:CGSizeMake(layoutMetrics.frame.size.width, height)];
|
|
86
157
|
}
|
|
87
158
|
}
|
|
88
159
|
|
|
89
160
|
- (void)prepareForRecycle {
|
|
90
161
|
[super prepareForRecycle];
|
|
91
162
|
|
|
92
|
-
|
|
93
|
-
|
|
163
|
+
if (@available(iOS 26.0, *)) {
|
|
164
|
+
[self cleanupEdgeInteraction];
|
|
165
|
+
}
|
|
94
166
|
|
|
167
|
+
self.transform = CGAffineTransformIdentity;
|
|
168
|
+
_state = nullptr;
|
|
95
169
|
_lastHeight = 0;
|
|
96
|
-
|
|
170
|
+
_currentKeyboardOffset = 0;
|
|
171
|
+
_bottomInset = 0;
|
|
172
|
+
_keyboardVisible = NO;
|
|
173
|
+
_didPushBottomInset = NO;
|
|
174
|
+
_appliedBottomInset = 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#pragma mark - TrueSheetKeyboardObserverDelegate
|
|
178
|
+
|
|
179
|
+
// Yoga owns the footer's frame (pinned to the container's bottom edge), so the
|
|
180
|
+
// keyboard slide is carried by a transform instead of layout. Only an absolute
|
|
181
|
+
// footer floats above the keyboard — a relative footer stays in the layout
|
|
182
|
+
// flow behind it.
|
|
183
|
+
- (void)keyboardWillShow:(CGFloat)height duration:(NSTimeInterval)duration curve:(UIViewAnimationOptions)curve {
|
|
184
|
+
if (!self.keyboardObserver.viewController.absoluteFooter) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
[self setKeyboardVisible:YES];
|
|
189
|
+
|
|
190
|
+
CGFloat keyboardOffset = self.keyboardObserver.viewController.footerKeyboardOffset;
|
|
191
|
+
CGFloat slide = MAX(0, height + keyboardOffset);
|
|
192
|
+
_currentKeyboardOffset = slide;
|
|
193
|
+
|
|
194
|
+
[UIView animateWithDuration:duration
|
|
195
|
+
delay:0
|
|
196
|
+
options:curve | UIViewAnimationOptionBeginFromCurrentState
|
|
197
|
+
animations:^{
|
|
198
|
+
self.transform = CGAffineTransformMakeTranslation(0, -slide);
|
|
199
|
+
[self syncEdgeEffect];
|
|
200
|
+
}
|
|
201
|
+
completion:nil];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
- (void)keyboardWillHide:(NSTimeInterval)duration curve:(UIViewAnimationOptions)curve {
|
|
205
|
+
[self setKeyboardVisible:NO];
|
|
206
|
+
_currentKeyboardOffset = 0;
|
|
207
|
+
|
|
208
|
+
[UIView animateWithDuration:duration
|
|
209
|
+
delay:0
|
|
210
|
+
options:curve | UIViewAnimationOptionBeginFromCurrentState
|
|
211
|
+
animations:^{
|
|
212
|
+
self.transform = CGAffineTransformIdentity;
|
|
213
|
+
[self syncEdgeEffect];
|
|
214
|
+
}
|
|
215
|
+
completion:nil];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// UIKit derives the edge effect region from model geometry at commit time,
|
|
219
|
+
// outside our animation context — the blur snaps to the footer's final
|
|
220
|
+
// position while the footer is still animating. Re-evaluating the scroll
|
|
221
|
+
// view's layout inside the animation block makes the region change inherit
|
|
222
|
+
// the keyboard curve.
|
|
223
|
+
- (void)syncEdgeEffect {
|
|
224
|
+
if (@available(iOS 26.0, *)) {
|
|
225
|
+
UIScrollView *scrollView = [self edgeInteractionScrollView];
|
|
226
|
+
if (scrollView) {
|
|
227
|
+
[scrollView setNeedsLayout];
|
|
228
|
+
[scrollView layoutIfNeeded];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
- (void)applyKeyboardOffset {
|
|
234
|
+
CGFloat height = self.keyboardObserver.currentHeight;
|
|
235
|
+
if (height <= 0 || !self.keyboardObserver.viewController.absoluteFooter) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
[self setKeyboardVisible:YES];
|
|
240
|
+
|
|
241
|
+
CGFloat keyboardOffset = self.keyboardObserver.viewController.footerKeyboardOffset;
|
|
242
|
+
CGFloat slide = MAX(0, height + keyboardOffset);
|
|
243
|
+
_currentKeyboardOffset = slide;
|
|
244
|
+
self.transform = CGAffineTransformMakeTranslation(0, -slide);
|
|
97
245
|
}
|
|
98
246
|
|
|
99
247
|
@end
|
|
100
248
|
|
|
249
|
+
Class<RCTComponentViewProtocol> TrueSheetFooterViewCls(void) {
|
|
250
|
+
return TrueSheetFooterView.class;
|
|
251
|
+
}
|
|
252
|
+
|
|
101
253
|
#endif
|
|
@@ -8,19 +8,22 @@
|
|
|
8
8
|
|
|
9
9
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
10
|
|
|
11
|
-
#import <
|
|
12
|
-
#import <
|
|
13
|
-
|
|
14
|
-
using namespace facebook::react;
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <UIKit/UIKit.h>
|
|
15
13
|
|
|
16
14
|
NS_ASSUME_NONNULL_BEGIN
|
|
17
15
|
|
|
18
|
-
@
|
|
16
|
+
@protocol TrueSheetHeaderViewDelegate <NSObject>
|
|
17
|
+
@optional
|
|
18
|
+
- (void)headerViewDidChangeSize:(CGSize)size;
|
|
19
|
+
@end
|
|
20
|
+
|
|
21
|
+
@interface TrueSheetHeaderView : RCTViewComponentView
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
@property (nonatomic, weak, nullable) id<TrueSheetHeaderViewDelegate> delegate;
|
|
21
24
|
|
|
22
25
|
@end
|
|
23
26
|
|
|
24
27
|
NS_ASSUME_NONNULL_END
|
|
25
28
|
|
|
26
|
-
#endif
|
|
29
|
+
#endif
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Jovanni Lo (@lodev09)
|
|
3
|
+
// Copyright (c) 2024-present. All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This source code is licensed under the MIT license found in the
|
|
6
|
+
// LICENSE file in the root directory of this source tree.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
|
+
|
|
11
|
+
#import "TrueSheetHeaderView.h"
|
|
12
|
+
#import <react/renderer/components/TrueSheetSpec/ComponentDescriptors.h>
|
|
13
|
+
#import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
|
|
14
|
+
#import <react/renderer/components/TrueSheetSpec/Props.h>
|
|
15
|
+
#import <react/renderer/components/TrueSheetSpec/RCTComponentViewHelpers.h>
|
|
16
|
+
#import "utils/UIView+ScrollEdgeInteraction.h"
|
|
17
|
+
|
|
18
|
+
using namespace facebook::react;
|
|
19
|
+
|
|
20
|
+
@implementation TrueSheetHeaderView {
|
|
21
|
+
CGSize _lastSize;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
25
|
+
return concreteComponentDescriptorProvider<TrueSheetHeaderViewComponentDescriptor>();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
29
|
+
if (self = [super initWithFrame:frame]) {
|
|
30
|
+
static const auto defaultProps = std::make_shared<const TrueSheetHeaderViewProps>();
|
|
31
|
+
_props = defaultProps;
|
|
32
|
+
|
|
33
|
+
_lastSize = CGSizeZero;
|
|
34
|
+
}
|
|
35
|
+
return self;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics
|
|
39
|
+
oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics {
|
|
40
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
41
|
+
|
|
42
|
+
CGSize newSize = CGSizeMake(layoutMetrics.frame.size.width, layoutMetrics.frame.size.height);
|
|
43
|
+
|
|
44
|
+
if (!CGSizeEqualToSize(newSize, _lastSize)) {
|
|
45
|
+
_lastSize = newSize;
|
|
46
|
+
[self.delegate headerViewDidChangeSize:newSize];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (void)prepareForRecycle {
|
|
51
|
+
[super prepareForRecycle];
|
|
52
|
+
_lastSize = CGSizeZero;
|
|
53
|
+
if (@available(iOS 26.0, *)) {
|
|
54
|
+
[self cleanupEdgeInteraction];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@end
|
|
59
|
+
|
|
60
|
+
Class<RCTComponentViewProtocol> TrueSheetHeaderViewCls(void) {
|
|
61
|
+
return TrueSheetHeaderView.class;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#endif
|
package/ios/TrueSheetModule.h
CHANGED
|
@@ -27,16 +27,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Register a sheet component view with its React tag
|
|
30
|
-
* Called automatically by TrueSheetView
|
|
30
|
+
* Called automatically by TrueSheetView when it attaches to a window.
|
|
31
|
+
* The registry holds views weakly, so no unregistration is needed.
|
|
31
32
|
*/
|
|
32
33
|
+ (void)registerView:(TrueSheetView *)view withTag:(NSNumber *)tag;
|
|
33
34
|
|
|
34
|
-
/**
|
|
35
|
-
* Unregister a sheet component view
|
|
36
|
-
* Called automatically by TrueSheetView during dealloc
|
|
37
|
-
*/
|
|
38
|
-
+ (void)unregisterViewWithTag:(NSNumber *)tag;
|
|
39
|
-
|
|
40
35
|
@end
|
|
41
36
|
|
|
42
37
|
NS_ASSUME_NONNULL_END
|
package/ios/TrueSheetModule.mm
CHANGED
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
#import "TrueSheetModule.h"
|
|
15
15
|
#import <React/RCTUtils.h>
|
|
16
16
|
#import "TrueSheetView.h"
|
|
17
|
+
#import "TrueSheetViewController.h"
|
|
17
18
|
|
|
18
19
|
#import <TrueSheetSpec/TrueSheetSpec.h>
|
|
19
20
|
|
|
20
|
-
// Static registry
|
|
21
|
-
|
|
21
|
+
// Static registry of live hosts by tag — weak so an unmounted host deallocates
|
|
22
|
+
// (RN zeroes the tag before teardown, so hosts can't unregister themselves)
|
|
23
|
+
static NSMapTable<NSNumber *, TrueSheetView *> *viewRegistry;
|
|
22
24
|
|
|
23
25
|
@interface TrueSheetModule () <NativeTrueSheetModuleSpec>
|
|
24
26
|
@end
|
|
@@ -29,7 +31,7 @@ RCT_EXPORT_MODULE(TrueSheetModule)
|
|
|
29
31
|
|
|
30
32
|
+ (void)initialize {
|
|
31
33
|
if (self == [TrueSheetModule class]) {
|
|
32
|
-
viewRegistry = [
|
|
34
|
+
viewRegistry = [NSMapTable strongToWeakObjectsMapTable];
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -46,6 +48,7 @@ RCT_EXPORT_MODULE(TrueSheetModule)
|
|
|
46
48
|
|
|
47
49
|
- (void)presentByRef:(double)viewTag
|
|
48
50
|
index:(double)index
|
|
51
|
+
animated:(BOOL)animated
|
|
49
52
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
50
53
|
reject:(RCTPromiseRejectBlock)reject {
|
|
51
54
|
RCTExecuteOnMainQueue(^{
|
|
@@ -57,7 +60,7 @@ RCT_EXPORT_MODULE(TrueSheetModule)
|
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
[trueSheetView presentAtIndex:(NSInteger)index
|
|
60
|
-
animated:
|
|
63
|
+
animated:animated
|
|
61
64
|
completion:^(BOOL success, NSError *_Nullable error) {
|
|
62
65
|
if (success) {
|
|
63
66
|
resolve(nil);
|
|
@@ -68,7 +71,10 @@ RCT_EXPORT_MODULE(TrueSheetModule)
|
|
|
68
71
|
});
|
|
69
72
|
}
|
|
70
73
|
|
|
71
|
-
- (void)dismissByRef:(double)viewTag
|
|
74
|
+
- (void)dismissByRef:(double)viewTag
|
|
75
|
+
animated:(BOOL)animated
|
|
76
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
77
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
72
78
|
RCTExecuteOnMainQueue(^{
|
|
73
79
|
TrueSheetView *trueSheetView = [TrueSheetModule getTrueSheetViewByTag:@((NSInteger)viewTag)];
|
|
74
80
|
|
|
@@ -77,7 +83,7 @@ RCT_EXPORT_MODULE(TrueSheetModule)
|
|
|
77
83
|
return;
|
|
78
84
|
}
|
|
79
85
|
|
|
80
|
-
[trueSheetView dismissAnimated:
|
|
86
|
+
[trueSheetView dismissAnimated:animated
|
|
81
87
|
completion:^(BOOL success, NSError *_Nullable error) {
|
|
82
88
|
if (success) {
|
|
83
89
|
resolve(nil);
|
|
@@ -88,12 +94,94 @@ RCT_EXPORT_MODULE(TrueSheetModule)
|
|
|
88
94
|
});
|
|
89
95
|
}
|
|
90
96
|
|
|
97
|
+
- (void)dismissStackByRef:(double)viewTag
|
|
98
|
+
animated:(BOOL)animated
|
|
99
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
100
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
101
|
+
RCTExecuteOnMainQueue(^{
|
|
102
|
+
TrueSheetView *trueSheetView = [TrueSheetModule getTrueSheetViewByTag:@((NSInteger)viewTag)];
|
|
103
|
+
|
|
104
|
+
if (!trueSheetView) {
|
|
105
|
+
reject(@"SHEET_NOT_FOUND", [NSString stringWithFormat:@"No sheet found with tag %d", (int)viewTag], nil);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[trueSheetView
|
|
110
|
+
dismissStackAnimated:animated
|
|
111
|
+
completion:^(BOOL success, NSError *_Nullable error) {
|
|
112
|
+
if (success) {
|
|
113
|
+
resolve(nil);
|
|
114
|
+
} else {
|
|
115
|
+
reject(@"DISMISS_FAILED", error.localizedDescription ?: @"Failed to dismiss stack", error);
|
|
116
|
+
}
|
|
117
|
+
}];
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
91
121
|
- (void)resizeByRef:(double)viewTag
|
|
92
122
|
index:(double)index
|
|
93
123
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
94
124
|
reject:(RCTPromiseRejectBlock)reject {
|
|
95
|
-
|
|
96
|
-
|
|
125
|
+
RCTExecuteOnMainQueue(^{
|
|
126
|
+
TrueSheetView *trueSheetView = [TrueSheetModule getTrueSheetViewByTag:@((NSInteger)viewTag)];
|
|
127
|
+
|
|
128
|
+
if (!trueSheetView) {
|
|
129
|
+
reject(@"SHEET_NOT_FOUND", [NSString stringWithFormat:@"No sheet found with tag %d", (int)viewTag], nil);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[trueSheetView resizeToIndex:(NSInteger)index
|
|
134
|
+
completion:^(BOOL success, NSError *_Nullable error) {
|
|
135
|
+
if (success) {
|
|
136
|
+
resolve(nil);
|
|
137
|
+
} else {
|
|
138
|
+
reject(@"RESIZE_FAILED", error.localizedDescription ?: @"Failed to resize sheet", error);
|
|
139
|
+
}
|
|
140
|
+
}];
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
- (void)handleBackPress:(double)viewTag resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
145
|
+
// No-op on iOS — no hardware back button
|
|
146
|
+
resolve(nil);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- (void)dismissAll:(BOOL)animated resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
150
|
+
RCTExecuteOnMainQueue(^{
|
|
151
|
+
@synchronized(viewRegistry) {
|
|
152
|
+
// Find the root presented sheet (one without a parent TrueSheet)
|
|
153
|
+
TrueSheetView *rootSheet = nil;
|
|
154
|
+
|
|
155
|
+
for (TrueSheetView *view in viewRegistry.objectEnumerator) {
|
|
156
|
+
if (!view.viewController.isPresented) {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
UIViewController *presenter = view.viewController.presentingViewController;
|
|
161
|
+
BOOL hasParentSheet = [presenter isKindOfClass:[TrueSheetViewController class]];
|
|
162
|
+
|
|
163
|
+
if (!hasParentSheet) {
|
|
164
|
+
rootSheet = view;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (!rootSheet) {
|
|
170
|
+
resolve(nil);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
[rootSheet emitDismissedPosition];
|
|
175
|
+
[rootSheet dismissAnimated:animated
|
|
176
|
+
completion:^(BOOL success, NSError *_Nullable error) {
|
|
177
|
+
if (success) {
|
|
178
|
+
resolve(nil);
|
|
179
|
+
} else {
|
|
180
|
+
reject(@"DISMISS_FAILED", error.localizedDescription ?: @"Failed to dismiss sheets", error);
|
|
181
|
+
}
|
|
182
|
+
}];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
97
185
|
}
|
|
98
186
|
|
|
99
187
|
#pragma mark - Helper Methods
|
|
@@ -104,7 +192,7 @@ RCT_EXPORT_MODULE(TrueSheetModule)
|
|
|
104
192
|
}
|
|
105
193
|
|
|
106
194
|
@synchronized(viewRegistry) {
|
|
107
|
-
return viewRegistry
|
|
195
|
+
return [viewRegistry objectForKey:reactTag];
|
|
108
196
|
}
|
|
109
197
|
}
|
|
110
198
|
|
|
@@ -114,17 +202,7 @@ RCT_EXPORT_MODULE(TrueSheetModule)
|
|
|
114
202
|
}
|
|
115
203
|
|
|
116
204
|
@synchronized(viewRegistry) {
|
|
117
|
-
viewRegistry
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
+ (void)unregisterViewWithTag:(NSNumber *)tag {
|
|
122
|
-
if (!tag) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@synchronized(viewRegistry) {
|
|
127
|
-
[viewRegistry removeObjectForKey:tag];
|
|
205
|
+
[viewRegistry setObject:view forKey:tag];
|
|
128
206
|
}
|
|
129
207
|
}
|
|
130
208
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Jovanni Lo (@lodev09)
|
|
3
|
+
// Copyright (c) 2024-present. All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This source code is licensed under the MIT license found in the
|
|
6
|
+
// LICENSE file in the root directory of this source tree.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
|
+
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <UIKit/UIKit.h>
|
|
13
|
+
|
|
14
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hidden host that renders its children in a container attached directly to
|
|
18
|
+
* the window, above every presented sheet.
|
|
19
|
+
*/
|
|
20
|
+
@interface TrueSheetOverlayView : RCTViewComponentView
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Re-stacks every overlay container above the window's other subviews.
|
|
24
|
+
* Called when a sheet presents, since presenting adds its transition view on top.
|
|
25
|
+
*/
|
|
26
|
+
+ (void)bringOverlaysToFrontInWindow:(nullable UIWindow *)window;
|
|
27
|
+
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
NS_ASSUME_NONNULL_END
|
|
31
|
+
|
|
32
|
+
#endif
|