@lodev09/react-native-true-sheet 4.0.0-beta.0 → 4.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +62 -30
- package/RNTrueSheet.podspec +10 -2
- package/android/build.gradle +24 -2
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +189 -47
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerViewManager.kt +7 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +401 -19
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +18 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +145 -21
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterViewManager.kt +14 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetHeaderView.kt +38 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetHeaderViewManager.kt +28 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetModule.kt +84 -24
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +106 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayViewManager.kt +45 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +6 -4
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPeekView.kt +72 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPeekViewManager.kt +33 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +63 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +564 -226
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +1399 -598
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +161 -29
- package/android/src/main/java/com/lodev09/truesheet/core/RNScreensEventObserver.kt +63 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetBehavior.kt +36 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetView.kt +255 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +375 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +299 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDimView.kt +162 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetGrabberView.kt +180 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetKeyboardObserver.kt +207 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +137 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetStackManager.kt +220 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetDragEvents.kt +71 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetFocusEvents.kt +65 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetLifecycleEvents.kt +127 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetStateEvents.kt +56 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/KeyboardUtils.kt +84 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/ScreenUtils.kt +93 -67
- package/android/src/main/java/com/lodev09/truesheet/utils/TouchEventDeduper.kt +31 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/ViewUtils.kt +42 -0
- package/android/src/main/jni/CMakeLists.txt +63 -0
- package/android/src/main/jni/TrueSheetSpec.h +20 -0
- package/android/src/main/jni/TrueSheetStateUpdater.cpp +96 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +16 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +68 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +33 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +11 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +39 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h +24 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +63 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h +28 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.cpp +11 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h +41 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.cpp +18 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.h +16 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +46 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h +21 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.cpp +17 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h +36 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewComponentDescriptor.h +28 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +30 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.h +45 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.cpp +23 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.h +52 -0
- package/ios/TrueSheetContainerView.h +88 -6
- package/ios/TrueSheetContainerView.mm +278 -21
- package/ios/TrueSheetContentView.h +54 -1
- package/ios/TrueSheetContentView.mm +371 -47
- package/ios/TrueSheetFooterView.h +33 -2
- package/ios/TrueSheetFooterView.mm +187 -35
- package/ios/{events/OnWillDismissEvent.h → TrueSheetHeaderView.h} +10 -7
- package/ios/TrueSheetHeaderView.mm +64 -0
- package/ios/TrueSheetModule.h +2 -7
- package/ios/TrueSheetModule.mm +98 -20
- package/ios/TrueSheetOverlayView.h +32 -0
- package/ios/TrueSheetOverlayView.mm +161 -0
- package/ios/TrueSheetPeekView.h +32 -0
- package/ios/TrueSheetPeekView.mm +99 -0
- package/ios/TrueSheetView.h +7 -15
- package/ios/TrueSheetView.mm +775 -215
- package/ios/TrueSheetViewController.h +94 -16
- package/ios/TrueSheetViewController.mm +1316 -331
- package/ios/core/RNScreensEventObserver.h +46 -0
- package/ios/core/RNScreensEventObserver.mm +280 -0
- package/ios/core/TrueSheetBlurView.h +27 -0
- package/ios/core/TrueSheetBlurView.mm +82 -0
- package/ios/core/TrueSheetDetentCalculator.h +107 -0
- package/ios/core/TrueSheetDetentCalculator.mm +197 -0
- package/ios/core/TrueSheetGrabberView.h +72 -0
- package/ios/core/TrueSheetGrabberView.mm +188 -0
- package/ios/core/TrueSheetKeyboardObserver.h +39 -0
- package/ios/core/TrueSheetKeyboardObserver.mm +112 -0
- package/ios/core/TrueSheetOverlayContainerView.h +31 -0
- package/ios/core/TrueSheetOverlayContainerView.mm +35 -0
- package/ios/events/TrueSheetDragEvents.h +39 -0
- package/ios/events/TrueSheetDragEvents.mm +62 -0
- package/ios/events/{OnPositionChangeEvent.h → TrueSheetFocusEvents.h} +8 -5
- package/ios/events/TrueSheetFocusEvents.mm +49 -0
- package/ios/events/TrueSheetLifecycleEvents.h +42 -0
- package/ios/events/TrueSheetLifecycleEvents.mm +79 -0
- package/ios/events/TrueSheetStateEvents.h +35 -0
- package/ios/events/TrueSheetStateEvents.mm +49 -0
- package/ios/tvos/TrueSheetStubs.mm +166 -0
- package/ios/{events/OnMountEvent.h → utils/BlurUtil.h} +5 -7
- package/ios/utils/BlurUtil.mm +69 -0
- package/ios/utils/GestureUtil.h +7 -0
- package/ios/utils/GestureUtil.mm +12 -0
- package/ios/utils/PlatformUtil.h +15 -0
- package/ios/utils/UIView+FirstResponder.h +15 -0
- package/ios/utils/UIView+FirstResponder.mm +26 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.h +26 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.mm +84 -0
- package/ios/utils/WindowUtil.mm +17 -1
- package/lib/module/TrueSheet.js +349 -74
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +1270 -0
- package/lib/module/TrueSheet.web.js.map +1 -0
- package/lib/module/TrueSheetOverlay.js +30 -0
- package/lib/module/TrueSheetOverlay.js.map +1 -0
- package/lib/module/TrueSheetOverlay.web.js +35 -0
- package/lib/module/TrueSheetOverlay.web.js.map +1 -0
- package/lib/module/TrueSheetPeek.js +15 -0
- package/lib/module/TrueSheetPeek.js.map +1 -0
- package/lib/module/TrueSheetPeek.web.js +55 -0
- package/lib/module/TrueSheetPeek.web.js.map +1 -0
- package/lib/module/TrueSheetProvider.js +28 -0
- package/lib/module/TrueSheetProvider.js.map +1 -0
- package/lib/module/TrueSheetProvider.web.js +157 -0
- package/lib/module/TrueSheetProvider.web.js.map +1 -0
- package/lib/module/fabric/TrueSheetContainerViewNativeComponent.ts +1 -1
- package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +5 -1
- package/lib/module/fabric/TrueSheetFooterViewNativeComponent.ts +10 -2
- package/lib/module/fabric/TrueSheetHeaderViewNativeComponent.ts +8 -0
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/fabric/TrueSheetPeekViewNativeComponent.ts +8 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +110 -18
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +103 -0
- package/lib/module/mocks/index.js.map +1 -0
- package/lib/module/mocks/navigation.js +95 -0
- package/lib/module/mocks/navigation.js.map +1 -0
- package/lib/module/mocks/navigationExpoRouter.js +21 -0
- package/lib/module/mocks/navigationExpoRouter.js.map +1 -0
- package/lib/module/mocks/reanimated.js +91 -0
- package/lib/module/mocks/reanimated.js.map +1 -0
- package/lib/module/navigation/TrueSheetNavigatorContent.js +73 -0
- package/lib/module/navigation/TrueSheetNavigatorContent.js.map +1 -0
- package/lib/module/navigation/actions.js +50 -0
- package/lib/module/navigation/actions.js.map +1 -0
- package/lib/module/navigation/base-types.js +2 -0
- package/lib/module/navigation/base-types.js.map +1 -0
- package/lib/module/navigation/createTrueSheetRouter.js +157 -0
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -0
- package/lib/module/navigation/expo-router/base-types.js +2 -0
- package/lib/module/navigation/expo-router/base-types.js.map +1 -0
- package/lib/module/navigation/expo-router/index.js +50 -0
- package/lib/module/navigation/expo-router/index.js.map +1 -0
- package/lib/module/navigation/expo-router/types.js +4 -0
- package/lib/module/navigation/expo-router/types.js.map +1 -0
- package/lib/module/navigation/index.js +47 -0
- package/lib/module/navigation/index.js.map +1 -0
- package/lib/module/navigation/navigator.js +10 -0
- package/lib/module/navigation/navigator.js.map +1 -0
- package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js +56 -0
- package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js.map +1 -0
- package/lib/module/navigation/screen/TrueSheetScreen.js +49 -0
- package/lib/module/navigation/screen/TrueSheetScreen.js.map +1 -0
- package/lib/module/navigation/screen/index.js +5 -0
- package/lib/module/navigation/screen/index.js.map +1 -0
- package/lib/module/navigation/screen/types.js +4 -0
- package/lib/module/navigation/screen/types.js.map +1 -0
- package/lib/module/navigation/screen/useSheetScreenState.js +69 -0
- package/lib/module/navigation/screen/useSheetScreenState.js.map +1 -0
- package/lib/module/navigation/types.js +4 -0
- package/lib/module/navigation/types.js.map +1 -0
- package/lib/module/navigation/useTrueSheetNavigation.js +24 -0
- package/lib/module/navigation/useTrueSheetNavigation.js.map +1 -0
- package/lib/module/reanimated/ReanimatedTrueSheet.js +15 -9
- package/lib/module/reanimated/ReanimatedTrueSheet.js.map +1 -1
- package/lib/module/reanimated/ReanimatedTrueSheet.web.js +81 -0
- package/lib/module/reanimated/ReanimatedTrueSheet.web.js.map +1 -0
- package/lib/module/reanimated/ReanimatedTrueSheetProvider.js +4 -2
- package/lib/module/reanimated/ReanimatedTrueSheetProvider.js.map +1 -1
- package/lib/module/reanimated/index.js +2 -2
- package/lib/module/reanimated/index.js.map +1 -1
- package/lib/module/reanimated/useReanimatedPositionChangeHandler.web.js +20 -0
- package/lib/module/reanimated/useReanimatedPositionChangeHandler.web.js.map +1 -0
- package/lib/module/specs/NativeTrueSheetModule.js.map +1 -1
- package/lib/module/web/constants.js +16 -0
- package/lib/module/web/constants.js.map +1 -0
- package/lib/module/web/dom.js +10 -0
- package/lib/module/web/dom.js.map +1 -0
- package/lib/module/web/vaul/README.md +9 -0
- package/lib/module/web/vaul/browser.js +30 -0
- package/lib/module/web/vaul/browser.js.map +1 -0
- package/lib/module/web/vaul/constants.js +19 -0
- package/lib/module/web/vaul/constants.js.map +1 -0
- package/lib/module/web/vaul/context.js +59 -0
- package/lib/module/web/vaul/context.js.map +1 -0
- package/lib/module/web/vaul/helpers.js +99 -0
- package/lib/module/web/vaul/helpers.js.map +1 -0
- package/lib/module/web/vaul/index.js +1342 -0
- package/lib/module/web/vaul/index.js.map +1 -0
- package/lib/module/web/vaul/style.css +287 -0
- package/lib/module/web/vaul/style.css.d.js +2 -0
- package/lib/module/web/vaul/style.css.d.js.map +1 -0
- package/lib/module/web/vaul/types.js +2 -0
- package/lib/module/web/vaul/types.js.map +1 -0
- package/lib/module/web/vaul/use-composed-refs.js +34 -0
- package/lib/module/web/vaul/use-composed-refs.js.map +1 -0
- package/lib/module/web/vaul/use-controllable-state.js +54 -0
- package/lib/module/web/vaul/use-controllable-state.js.map +1 -0
- package/lib/module/web/vaul/use-position-fixed.js +123 -0
- package/lib/module/web/vaul/use-position-fixed.js.map +1 -0
- package/lib/module/web/vaul/use-prevent-scroll.js +258 -0
- package/lib/module/web/vaul/use-prevent-scroll.js.map +1 -0
- package/lib/module/web/vaul/use-scale-background.js +57 -0
- package/lib/module/web/vaul/use-scale-background.js.map +1 -0
- package/lib/module/web/vaul/use-snap-points.js +305 -0
- package/lib/module/web/vaul/use-snap-points.js.map +1 -0
- package/lib/typescript/src/TrueSheet.d.ts +57 -14
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +535 -55
- package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.web.d.ts +5 -0
- package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetPeek.d.ts +9 -0
- package/lib/typescript/src/TrueSheetPeek.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetPeek.web.d.ts +28 -0
- package/lib/typescript/src/TrueSheetPeek.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetProvider.d.ts +18 -0
- package/lib/typescript/src/TrueSheetProvider.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetProvider.web.d.ts +27 -0
- package/lib/typescript/src/TrueSheetProvider.web.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetContainerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetContentViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts +2 -0
- package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetHeaderViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetHeaderViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetPeekViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetPeekViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +71 -16
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/index.d.ts +47 -0
- package/lib/typescript/src/mocks/index.d.ts.map +1 -0
- package/lib/typescript/src/mocks/navigation.d.ts +70 -0
- package/lib/typescript/src/mocks/navigation.d.ts.map +1 -0
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts +22 -0
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -0
- package/lib/typescript/src/mocks/reanimated.d.ts +48 -0
- package/lib/typescript/src/mocks/reanimated.d.ts.map +1 -0
- package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts +5 -0
- package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts.map +1 -0
- package/lib/typescript/src/navigation/actions.d.ts +71 -0
- package/lib/typescript/src/navigation/actions.d.ts.map +1 -0
- package/lib/typescript/src/navigation/base-types.d.ts +9 -0
- package/lib/typescript/src/navigation/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +3 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts +8 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts +37 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts +44 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/index.d.ts +45 -0
- package/lib/typescript/src/navigation/index.d.ts.map +1 -0
- package/lib/typescript/src/navigation/navigator.d.ts +7 -0
- package/lib/typescript/src/navigation/navigator.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts +3 -0
- package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts +3 -0
- package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/index.d.ts +4 -0
- package/lib/typescript/src/navigation/screen/index.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/types.d.ts +14 -0
- package/lib/typescript/src/navigation/screen/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +34 -0
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -0
- package/lib/typescript/src/navigation/types.d.ts +213 -0
- package/lib/typescript/src/navigation/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts +23 -0
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/ReanimatedTrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/ReanimatedTrueSheet.web.d.ts +41 -0
- package/lib/typescript/src/reanimated/ReanimatedTrueSheet.web.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/ReanimatedTrueSheetProvider.d.ts +8 -2
- package/lib/typescript/src/reanimated/ReanimatedTrueSheetProvider.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/useReanimatedPositionChangeHandler.web.d.ts +15 -0
- package/lib/typescript/src/reanimated/useReanimatedPositionChangeHandler.web.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeTrueSheetModule.d.ts +25 -3
- package/lib/typescript/src/specs/NativeTrueSheetModule.d.ts.map +1 -1
- package/lib/typescript/src/web/constants.d.ts +14 -0
- package/lib/typescript/src/web/constants.d.ts.map +1 -0
- package/lib/typescript/src/web/dom.d.ts +7 -0
- package/lib/typescript/src/web/dom.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/browser.d.ts +8 -0
- package/lib/typescript/src/web/vaul/browser.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts +14 -0
- package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/context.d.ts +54 -0
- package/lib/typescript/src/web/vaul/context.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/helpers.d.ts +17 -0
- package/lib/typescript/src/web/vaul/helpers.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/index.d.ts +234 -0
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/types.d.ts +7 -0
- package/lib/typescript/src/web/vaul/types.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-composed-refs.d.ts +14 -0
- package/lib/typescript/src/web/vaul/use-composed-refs.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-controllable-state.d.ts +9 -0
- package/lib/typescript/src/web/vaul/use-controllable-state.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-position-fixed.d.ts +19 -0
- package/lib/typescript/src/web/vaul/use-position-fixed.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-prevent-scroll.d.ts +18 -0
- package/lib/typescript/src/web/vaul/use-prevent-scroll.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-scale-background.d.ts +2 -0
- package/lib/typescript/src/web/vaul/use-scale-background.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts +38 -0
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts.map +1 -0
- package/package.json +104 -37
- package/react-native.config.js +10 -2
- package/src/TrueSheet.tsx +424 -70
- package/src/TrueSheet.types.ts +602 -72
- package/src/TrueSheet.web.tsx +1437 -0
- package/src/TrueSheetOverlay.tsx +24 -0
- package/src/TrueSheetOverlay.web.tsx +33 -0
- package/src/TrueSheetPeek.tsx +11 -0
- package/src/TrueSheetPeek.web.tsx +64 -0
- package/src/TrueSheetProvider.tsx +33 -0
- package/src/TrueSheetProvider.web.tsx +220 -0
- package/src/fabric/TrueSheetContainerViewNativeComponent.ts +1 -1
- package/src/fabric/TrueSheetContentViewNativeComponent.ts +5 -1
- package/src/fabric/TrueSheetFooterViewNativeComponent.ts +10 -2
- package/src/fabric/TrueSheetHeaderViewNativeComponent.ts +8 -0
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/fabric/TrueSheetPeekViewNativeComponent.ts +8 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +110 -18
- package/src/index.ts +3 -2
- package/src/mocks/index.ts +96 -0
- package/src/mocks/navigation.ts +79 -0
- package/src/mocks/navigationExpoRouter.ts +41 -0
- package/src/mocks/reanimated.ts +100 -0
- package/src/navigation/TrueSheetNavigatorContent.tsx +106 -0
- package/src/navigation/actions.ts +78 -0
- package/src/navigation/base-types.ts +20 -0
- package/src/navigation/createTrueSheetRouter.ts +194 -0
- package/src/navigation/expo-router/base-types.ts +18 -0
- package/src/navigation/expo-router/index.ts +90 -0
- package/src/navigation/expo-router/types.ts +116 -0
- package/src/navigation/index.ts +80 -0
- package/src/navigation/navigator.ts +18 -0
- package/src/navigation/screen/ReanimatedTrueSheetScreen.tsx +61 -0
- package/src/navigation/screen/TrueSheetScreen.tsx +54 -0
- package/src/navigation/screen/index.ts +3 -0
- package/src/navigation/screen/types.ts +19 -0
- package/src/navigation/screen/useSheetScreenState.ts +102 -0
- package/src/navigation/types.ts +302 -0
- package/src/navigation/useTrueSheetNavigation.ts +26 -0
- package/src/reanimated/ReanimatedTrueSheet.tsx +12 -7
- package/src/reanimated/ReanimatedTrueSheet.web.tsx +75 -0
- package/src/reanimated/ReanimatedTrueSheetProvider.tsx +12 -8
- package/src/reanimated/useReanimatedPositionChangeHandler.web.ts +31 -0
- package/src/specs/NativeTrueSheetModule.ts +28 -3
- package/src/web/constants.ts +13 -0
- package/src/web/dom.ts +9 -0
- package/src/web/vaul/README.md +9 -0
- package/src/web/vaul/browser.ts +38 -0
- package/src/web/vaul/constants.ts +24 -0
- package/src/web/vaul/context.ts +102 -0
- package/src/web/vaul/helpers.ts +131 -0
- package/src/web/vaul/index.tsx +1785 -0
- package/src/web/vaul/style.css +287 -0
- package/src/web/vaul/style.css.d.ts +1 -0
- package/src/web/vaul/types.ts +7 -0
- package/src/web/vaul/use-composed-refs.ts +35 -0
- package/src/web/vaul/use-controllable-state.ts +66 -0
- package/src/web/vaul/use-position-fixed.ts +147 -0
- package/src/web/vaul/use-prevent-scroll.ts +309 -0
- package/src/web/vaul/use-scale-background.ts +64 -0
- package/src/web/vaul/use-snap-points.ts +455 -0
- package/android/src/main/java/com/lodev09/truesheet/events/DetentChangeEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/DidDismissEvent.kt +0 -20
- package/android/src/main/java/com/lodev09/truesheet/events/DidPresentEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/DragBeginEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/DragChangeEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/DragEndEvent.kt +0 -26
- package/android/src/main/java/com/lodev09/truesheet/events/MountEvent.kt +0 -20
- package/android/src/main/java/com/lodev09/truesheet/events/PositionChangeEvent.kt +0 -32
- package/android/src/main/java/com/lodev09/truesheet/events/SizeChangeEvent.kt +0 -27
- package/android/src/main/java/com/lodev09/truesheet/events/WillDismissEvent.kt +0 -20
- package/android/src/main/java/com/lodev09/truesheet/events/WillPresentEvent.kt +0 -26
- package/android/src/main/res/values/styles.xml +0 -8
- package/ios/events/OnDetentChangeEvent.h +0 -28
- package/ios/events/OnDetentChangeEvent.mm +0 -30
- package/ios/events/OnDidDismissEvent.h +0 -26
- package/ios/events/OnDidDismissEvent.mm +0 -25
- package/ios/events/OnDidPresentEvent.h +0 -28
- package/ios/events/OnDidPresentEvent.mm +0 -30
- package/ios/events/OnDragBeginEvent.h +0 -28
- package/ios/events/OnDragBeginEvent.mm +0 -30
- package/ios/events/OnDragChangeEvent.h +0 -28
- package/ios/events/OnDragChangeEvent.mm +0 -30
- package/ios/events/OnDragEndEvent.h +0 -28
- package/ios/events/OnDragEndEvent.mm +0 -30
- package/ios/events/OnMountEvent.mm +0 -25
- package/ios/events/OnPositionChangeEvent.mm +0 -32
- package/ios/events/OnSizeChangeEvent.h +0 -28
- package/ios/events/OnSizeChangeEvent.mm +0 -30
- package/ios/events/OnWillDismissEvent.mm +0 -25
- package/ios/events/OnWillPresentEvent.h +0 -28
- package/ios/events/OnWillPresentEvent.mm +0 -30
- package/ios/utils/LayoutUtil.h +0 -44
- package/ios/utils/LayoutUtil.mm +0 -50
- package/lib/module/TrueSheetGrabber.js +0 -51
- package/lib/module/TrueSheetGrabber.js.map +0 -1
- package/lib/typescript/src/TrueSheetGrabber.d.ts +0 -39
- package/lib/typescript/src/TrueSheetGrabber.d.ts.map +0 -1
- package/src/TrueSheetGrabber.tsx +0 -82
- package/src/__mocks__/index.js +0 -67
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#include "TrueSheetFooterViewShadowNode.h"
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/view/conversions.h>
|
|
4
|
+
|
|
5
|
+
#include "TrueSheetInsets.h"
|
|
6
|
+
|
|
7
|
+
namespace facebook::react {
|
|
8
|
+
|
|
9
|
+
using namespace yoga;
|
|
10
|
+
|
|
11
|
+
extern const char TrueSheetFooterViewComponentName[] = "TrueSheetFooterView";
|
|
12
|
+
|
|
13
|
+
void TrueSheetFooterViewShadowNode::adjustLayoutWithState() {
|
|
14
|
+
ensureUnsealed();
|
|
15
|
+
|
|
16
|
+
auto state = std::static_pointer_cast<
|
|
17
|
+
const TrueSheetFooterViewShadowNode::ConcreteState>(getState());
|
|
18
|
+
auto stateData = state->getData();
|
|
19
|
+
|
|
20
|
+
auto &props = getConcreteProps();
|
|
21
|
+
|
|
22
|
+
// Until native pushes the real inset (which requires this node to already
|
|
23
|
+
// exist), seed a late-mounted footer's first layout with the precalculated
|
|
24
|
+
// inset — otherwise it lays out unpadded and forces a second sheet resize.
|
|
25
|
+
float bottomInset = stateData.bottomInset;
|
|
26
|
+
if (!stateData.initialized && props.autoBottomInset) {
|
|
27
|
+
bottomInset = TrueSheetInsets::bottomSafeArea();
|
|
28
|
+
if (bottomInset != stateData.bottomInset) {
|
|
29
|
+
// Record the seeded value so the mounted view reads exactly the inset
|
|
30
|
+
// baked into this layout — the global may change before mount.
|
|
31
|
+
auto seededData = stateData;
|
|
32
|
+
seededData.bottomInset = bottomInset;
|
|
33
|
+
setStateData(std::move(seededData));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// A footer pinned to the sheet's bottom edge owns the bottom safe-area
|
|
38
|
+
// inset — pad it on top of any style padding so its content clears the
|
|
39
|
+
// home indicator while the background fills the inset.
|
|
40
|
+
auto padding = props.yogaStyle.padding(Edge::Bottom);
|
|
41
|
+
if (bottomInset > 0) {
|
|
42
|
+
// Base bottom padding from the style — Edge::Bottom wins over
|
|
43
|
+
// Vertical/All, mirroring Yoga's own resolution. Points only.
|
|
44
|
+
float base = 0;
|
|
45
|
+
for (auto edge : {Edge::Bottom, Edge::Vertical, Edge::All}) {
|
|
46
|
+
auto length = props.yogaStyle.padding(edge);
|
|
47
|
+
if (length.isDefined()) {
|
|
48
|
+
base = length.isPoints() ? length.value().unwrap() : 0;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
padding = StyleLength::points(base + bottomInset);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (yogaNode_.style().padding(Edge::Bottom) != padding) {
|
|
56
|
+
yoga::Style adjustedStyle = props.yogaStyle;
|
|
57
|
+
adjustedStyle.setPadding(Edge::Bottom, padding);
|
|
58
|
+
yogaNode_.setStyle(adjustedStyle);
|
|
59
|
+
yogaNode_.setDirty(true);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <react/renderer/components/TrueSheetSpec/EventEmitters.h>
|
|
5
|
+
#include <react/renderer/components/TrueSheetSpec/Props.h>
|
|
6
|
+
#include <react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h>
|
|
7
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
8
|
+
|
|
9
|
+
namespace facebook::react {
|
|
10
|
+
|
|
11
|
+
JSI_EXPORT extern const char TrueSheetFooterViewComponentName[];
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* `ShadowNode` for <TrueSheetFooterView> component.
|
|
15
|
+
*/
|
|
16
|
+
class JSI_EXPORT TrueSheetFooterViewShadowNode final
|
|
17
|
+
: public ConcreteViewShadowNode<
|
|
18
|
+
TrueSheetFooterViewComponentName,
|
|
19
|
+
TrueSheetFooterViewProps,
|
|
20
|
+
TrueSheetFooterViewEventEmitter,
|
|
21
|
+
TrueSheetFooterViewState> {
|
|
22
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
void adjustLayoutWithState();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#include "TrueSheetFooterViewState.h"
|
|
2
|
+
|
|
3
|
+
namespace facebook::react {
|
|
4
|
+
|
|
5
|
+
#ifdef ANDROID
|
|
6
|
+
folly::dynamic TrueSheetFooterViewState::getDynamic() const {
|
|
7
|
+
return folly::dynamic::object("bottomInset", bottomInset);
|
|
8
|
+
}
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#ifdef ANDROID
|
|
4
|
+
#include <folly/dynamic.h>
|
|
5
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
6
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
namespace facebook::react {
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* State for <TrueSheetFooterView> component.
|
|
13
|
+
* Set from native with the sheet's bottom safe-area inset so the shadow node
|
|
14
|
+
* pads the footer's bottom edge (see TrueSheetFooterViewShadowNode).
|
|
15
|
+
*/
|
|
16
|
+
class TrueSheetFooterViewState final {
|
|
17
|
+
public:
|
|
18
|
+
TrueSheetFooterViewState() = default;
|
|
19
|
+
|
|
20
|
+
#ifdef ANDROID
|
|
21
|
+
TrueSheetFooterViewState(
|
|
22
|
+
TrueSheetFooterViewState const &previousState,
|
|
23
|
+
folly::dynamic data)
|
|
24
|
+
: bottomInset(static_cast<float>(data["bottomInset"].getDouble())),
|
|
25
|
+
initialized(true) {}
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
float bottomInset{0};
|
|
29
|
+
// True once native has pushed a real inset — until then the shadow node
|
|
30
|
+
// seeds the layout from TrueSheetInsets (see TrueSheetFooterViewShadowNode)
|
|
31
|
+
bool initialized{false};
|
|
32
|
+
|
|
33
|
+
#ifdef ANDROID
|
|
34
|
+
folly::dynamic getDynamic() const;
|
|
35
|
+
MapBuffer getMapBuffer() const {
|
|
36
|
+
return MapBufferBuilder::EMPTY();
|
|
37
|
+
}
|
|
38
|
+
#endif
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#include "TrueSheetInsets.h"
|
|
2
|
+
|
|
3
|
+
#include <atomic>
|
|
4
|
+
|
|
5
|
+
namespace facebook::react {
|
|
6
|
+
|
|
7
|
+
// Written from the UI thread, read from the layout thread
|
|
8
|
+
static std::atomic<float> gBottomSafeArea{0};
|
|
9
|
+
|
|
10
|
+
void TrueSheetInsets::setBottomSafeArea(float inset) {
|
|
11
|
+
gBottomSafeArea.store(inset, std::memory_order_relaxed);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
float TrueSheetInsets::bottomSafeArea() {
|
|
15
|
+
return gBottomSafeArea.load(std::memory_order_relaxed);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
namespace facebook::react {
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Bottom safe-area inset published by the host platform (points/dp) so a
|
|
7
|
+
* late-mounted footer's first layout can be padded before any Fabric state
|
|
8
|
+
* lands (see TrueSheetFooterViewShadowNode).
|
|
9
|
+
*/
|
|
10
|
+
class TrueSheetInsets {
|
|
11
|
+
public:
|
|
12
|
+
static void setBottomSafeArea(float inset);
|
|
13
|
+
static float bottomSafeArea();
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/view/conversions.h>
|
|
4
|
+
#include <yoga/node/Node.h>
|
|
5
|
+
#include <yoga/style/Style.h>
|
|
6
|
+
|
|
7
|
+
namespace facebook::react {
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Overrides a node's Yoga dimensions with the container size reported from
|
|
11
|
+
* native. A zero dimension leaves that axis to Yoga.
|
|
12
|
+
*/
|
|
13
|
+
inline void applyContainerSizeToYogaNode(
|
|
14
|
+
yoga::Node &node,
|
|
15
|
+
const yoga::Style &baseStyle,
|
|
16
|
+
float containerWidth,
|
|
17
|
+
float containerHeight) {
|
|
18
|
+
if (containerWidth <= 0 && containerHeight <= 0) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
yoga::Style adjustedStyle = baseStyle;
|
|
23
|
+
const auto ¤tStyle = node.style();
|
|
24
|
+
bool needsUpdate = false;
|
|
25
|
+
|
|
26
|
+
if (containerWidth > 0) {
|
|
27
|
+
adjustedStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(containerWidth));
|
|
28
|
+
if (adjustedStyle.dimension(yoga::Dimension::Width) != currentStyle.dimension(yoga::Dimension::Width)) {
|
|
29
|
+
needsUpdate = true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (containerHeight > 0) {
|
|
34
|
+
adjustedStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(containerHeight));
|
|
35
|
+
if (adjustedStyle.dimension(yoga::Dimension::Height) != currentStyle.dimension(yoga::Dimension::Height)) {
|
|
36
|
+
needsUpdate = true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (needsUpdate) {
|
|
41
|
+
node.setStyle(adjustedStyle);
|
|
42
|
+
node.setDirty(true);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
} // namespace facebook::react
|
package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h>
|
|
4
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
5
|
+
|
|
6
|
+
namespace facebook::react {
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Descriptor for <TrueSheetOverlayView> component.
|
|
10
|
+
*/
|
|
11
|
+
class TrueSheetOverlayViewComponentDescriptor final
|
|
12
|
+
: public ConcreteComponentDescriptor<TrueSheetOverlayViewShadowNode> {
|
|
13
|
+
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
|
|
14
|
+
|
|
15
|
+
void adopt(ShadowNode &shadowNode) const override {
|
|
16
|
+
static_cast<TrueSheetOverlayViewShadowNode &>(shadowNode).adjustLayoutWithState();
|
|
17
|
+
ConcreteComponentDescriptor::adopt(shadowNode);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#include "TrueSheetOverlayViewShadowNode.h"
|
|
2
|
+
|
|
3
|
+
#include "TrueSheetLayoutUtils.h"
|
|
4
|
+
|
|
5
|
+
namespace facebook::react {
|
|
6
|
+
|
|
7
|
+
extern const char TrueSheetOverlayViewComponentName[] = "TrueSheetOverlayView";
|
|
8
|
+
|
|
9
|
+
void TrueSheetOverlayViewShadowNode::adjustLayoutWithState() {
|
|
10
|
+
ensureUnsealed();
|
|
11
|
+
|
|
12
|
+
const auto &stateData = getStateData();
|
|
13
|
+
applyContainerSizeToYogaNode(
|
|
14
|
+
yogaNode_, getConcreteProps().yogaStyle, stateData.containerWidth, stateData.containerHeight);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <react/renderer/components/TrueSheetSpec/EventEmitters.h>
|
|
5
|
+
#include <react/renderer/components/TrueSheetSpec/Props.h>
|
|
6
|
+
#include <react/renderer/components/TrueSheetSpec/TrueSheetViewState.h>
|
|
7
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
8
|
+
|
|
9
|
+
namespace facebook::react {
|
|
10
|
+
|
|
11
|
+
JSI_EXPORT extern const char TrueSheetOverlayViewComponentName[];
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* `ShadowNode` for <TrueSheetOverlayView> component.
|
|
15
|
+
* Sized to the window from native (via TrueSheetViewState) so its children
|
|
16
|
+
* lay out against the full window like the sheet's container.
|
|
17
|
+
*/
|
|
18
|
+
class JSI_EXPORT TrueSheetOverlayViewShadowNode final
|
|
19
|
+
: public ConcreteViewShadowNode<
|
|
20
|
+
TrueSheetOverlayViewComponentName,
|
|
21
|
+
TrueSheetOverlayViewProps,
|
|
22
|
+
TrueSheetOverlayViewEventEmitter,
|
|
23
|
+
TrueSheetViewState> {
|
|
24
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
static ShadowNodeTraits BaseTraits() {
|
|
28
|
+
auto traits = ConcreteViewShadowNode::BaseTraits();
|
|
29
|
+
traits.set(ShadowNodeTraits::Trait::RootNodeKind);
|
|
30
|
+
return traits;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
void adjustLayoutWithState();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.h>
|
|
4
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
5
|
+
|
|
6
|
+
namespace facebook::react {
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Descriptor for <TrueSheetView> component.
|
|
10
|
+
*/
|
|
11
|
+
class TrueSheetViewComponentDescriptor final
|
|
12
|
+
: public ConcreteComponentDescriptor<TrueSheetViewShadowNode> {
|
|
13
|
+
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
|
|
14
|
+
|
|
15
|
+
void adopt(ShadowNode &shadowNode) const override {
|
|
16
|
+
auto &concreteShadowNode =
|
|
17
|
+
static_cast<TrueSheetViewShadowNode &>(shadowNode);
|
|
18
|
+
concreteShadowNode.adjustLayoutWithState();
|
|
19
|
+
|
|
20
|
+
ConcreteComponentDescriptor::adopt(shadowNode);
|
|
21
|
+
|
|
22
|
+
#if !defined(ANDROID)
|
|
23
|
+
concreteShadowNode.setEventDispatcher(eventDispatcher_);
|
|
24
|
+
#endif
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#include "TrueSheetViewShadowNode.h"
|
|
2
|
+
|
|
3
|
+
#include "TrueSheetLayoutUtils.h"
|
|
4
|
+
|
|
5
|
+
namespace facebook::react {
|
|
6
|
+
|
|
7
|
+
extern const char TrueSheetViewComponentName[] = "TrueSheetView";
|
|
8
|
+
|
|
9
|
+
void TrueSheetViewShadowNode::adjustLayoutWithState() {
|
|
10
|
+
ensureUnsealed();
|
|
11
|
+
|
|
12
|
+
const auto &stateData = getStateData();
|
|
13
|
+
applyContainerSizeToYogaNode(
|
|
14
|
+
yogaNode_, getConcreteProps().yogaStyle, stateData.containerWidth, stateData.containerHeight);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#if !defined(ANDROID)
|
|
18
|
+
void TrueSheetViewShadowNode::setEventDispatcher(
|
|
19
|
+
std::weak_ptr<const EventDispatcher> dispatcher) {
|
|
20
|
+
getStateDataMutable().setEventDispatcher(dispatcher);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
TrueSheetViewShadowNode::StateData &
|
|
24
|
+
TrueSheetViewShadowNode::getStateDataMutable() {
|
|
25
|
+
ensureUnsealed();
|
|
26
|
+
return const_cast<TrueSheetViewShadowNode::StateData &>(getStateData());
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <react/renderer/components/TrueSheetSpec/EventEmitters.h>
|
|
5
|
+
#include <react/renderer/components/TrueSheetSpec/Props.h>
|
|
6
|
+
#include <react/renderer/components/TrueSheetSpec/TrueSheetViewState.h>
|
|
7
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
8
|
+
|
|
9
|
+
namespace facebook::react {
|
|
10
|
+
|
|
11
|
+
class EventDispatcher;
|
|
12
|
+
|
|
13
|
+
JSI_EXPORT extern const char TrueSheetViewComponentName[];
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* `ShadowNode` for <TrueSheetView> component.
|
|
17
|
+
*/
|
|
18
|
+
class JSI_EXPORT TrueSheetViewShadowNode final
|
|
19
|
+
: public ConcreteViewShadowNode<
|
|
20
|
+
TrueSheetViewComponentName,
|
|
21
|
+
TrueSheetViewProps,
|
|
22
|
+
TrueSheetViewEventEmitter,
|
|
23
|
+
TrueSheetViewState> {
|
|
24
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
using StateData = ConcreteViewShadowNode::ConcreteStateData;
|
|
28
|
+
|
|
29
|
+
static ShadowNodeTraits BaseTraits() {
|
|
30
|
+
auto traits = ConcreteViewShadowNode::BaseTraits();
|
|
31
|
+
traits.set(ShadowNodeTraits::Trait::RootNodeKind);
|
|
32
|
+
return traits;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void adjustLayoutWithState();
|
|
36
|
+
|
|
37
|
+
#if !defined(ANDROID)
|
|
38
|
+
void setEventDispatcher(std::weak_ptr<const EventDispatcher> dispatcher);
|
|
39
|
+
|
|
40
|
+
private:
|
|
41
|
+
StateData &getStateDataMutable();
|
|
42
|
+
#endif
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#include "TrueSheetViewState.h"
|
|
2
|
+
|
|
3
|
+
namespace facebook::react {
|
|
4
|
+
|
|
5
|
+
#ifdef ANDROID
|
|
6
|
+
folly::dynamic TrueSheetViewState::getDynamic() const {
|
|
7
|
+
return folly::dynamic::object("containerWidth", containerWidth)("containerHeight", containerHeight);
|
|
8
|
+
}
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
#if !defined(ANDROID)
|
|
12
|
+
void TrueSheetViewState::setEventDispatcher(
|
|
13
|
+
std::weak_ptr<const EventDispatcher> dispatcher) {
|
|
14
|
+
eventDispatcher_ = dispatcher;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
std::weak_ptr<const EventDispatcher> TrueSheetViewState::getEventDispatcher()
|
|
18
|
+
const noexcept {
|
|
19
|
+
return eventDispatcher_;
|
|
20
|
+
}
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
|
|
5
|
+
#ifdef ANDROID
|
|
6
|
+
#include <folly/dynamic.h>
|
|
7
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
8
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
namespace facebook::react {
|
|
12
|
+
|
|
13
|
+
class EventDispatcher;
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* State for <TrueSheetView> component.
|
|
17
|
+
* Contains the container dimensions from native.
|
|
18
|
+
*/
|
|
19
|
+
class TrueSheetViewState final {
|
|
20
|
+
public:
|
|
21
|
+
using Shared = std::shared_ptr<const TrueSheetViewState>;
|
|
22
|
+
|
|
23
|
+
TrueSheetViewState() = default;
|
|
24
|
+
|
|
25
|
+
#ifdef ANDROID
|
|
26
|
+
TrueSheetViewState(
|
|
27
|
+
TrueSheetViewState const &previousState,
|
|
28
|
+
folly::dynamic data)
|
|
29
|
+
: containerWidth(static_cast<float>(data["containerWidth"].getDouble())),
|
|
30
|
+
containerHeight(static_cast<float>(data["containerHeight"].getDouble())) {}
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
float containerWidth{0};
|
|
34
|
+
float containerHeight{0};
|
|
35
|
+
|
|
36
|
+
#ifdef ANDROID
|
|
37
|
+
folly::dynamic getDynamic() const;
|
|
38
|
+
MapBuffer getMapBuffer() const {
|
|
39
|
+
return MapBufferBuilder::EMPTY();
|
|
40
|
+
}
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#if !defined(ANDROID)
|
|
44
|
+
void setEventDispatcher(std::weak_ptr<const EventDispatcher> dispatcher);
|
|
45
|
+
std::weak_ptr<const EventDispatcher> getEventDispatcher() const noexcept;
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
std::weak_ptr<const EventDispatcher> eventDispatcher_;
|
|
49
|
+
#endif
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
} // namespace facebook::react
|
|
@@ -10,16 +10,33 @@
|
|
|
10
10
|
|
|
11
11
|
#import <React/RCTViewComponentView.h>
|
|
12
12
|
#import <UIKit/UIKit.h>
|
|
13
|
+
#import <react/renderer/components/TrueSheetSpec/Props.h>
|
|
13
14
|
|
|
14
15
|
NS_ASSUME_NONNULL_BEGIN
|
|
15
16
|
|
|
17
|
+
@interface ScrollableOptions : NSObject
|
|
18
|
+
|
|
19
|
+
@property (nonatomic, assign) BOOL contentInsetAdjustment;
|
|
20
|
+
@property (nonatomic, assign) CGFloat keyboardScrollOffset;
|
|
21
|
+
@property (nonatomic, assign) CGFloat keyboardOffset;
|
|
22
|
+
@property (nonatomic, assign) BOOL scrollingExpandsSheet;
|
|
23
|
+
@property (nonatomic, assign) facebook::react::TrueSheetViewTopScrollEdgeEffect topScrollEdgeEffect;
|
|
24
|
+
@property (nonatomic, assign) facebook::react::TrueSheetViewBottomScrollEdgeEffect bottomScrollEdgeEffect;
|
|
25
|
+
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
@class TrueSheetPeekView;
|
|
29
|
+
|
|
16
30
|
@protocol TrueSheetContainerViewDelegate <NSObject>
|
|
17
31
|
|
|
18
|
-
/**
|
|
19
|
-
* Called when the container's content size changes
|
|
20
|
-
* @param newSize The new size of the content
|
|
21
|
-
*/
|
|
22
32
|
- (void)containerViewContentDidChangeSize:(CGSize)newSize;
|
|
33
|
+
- (void)containerViewScrollViewDidChange;
|
|
34
|
+
|
|
35
|
+
@optional
|
|
36
|
+
|
|
37
|
+
- (void)containerViewHeaderDidChangeSize:(CGSize)newSize;
|
|
38
|
+
- (void)containerViewFooterDidChangeSize:(CGSize)newSize;
|
|
39
|
+
- (void)containerViewPeekDidChangeSize:(CGSize)newSize;
|
|
23
40
|
|
|
24
41
|
@end
|
|
25
42
|
|
|
@@ -30,15 +47,80 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
30
47
|
*/
|
|
31
48
|
@property (nonatomic, weak, nullable) id<TrueSheetContainerViewDelegate> delegate;
|
|
32
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Options for scrollable behavior
|
|
52
|
+
*/
|
|
53
|
+
@property (nonatomic, strong, nullable) ScrollableOptions *scrollableOptions;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* React tag of the user-provided scrollable within the content (see the `scrollableRef` prop)
|
|
57
|
+
*/
|
|
58
|
+
@property (nonatomic, assign) NSInteger scrollableHandle;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Whether the resolved scrollable's `contentInsetAdjustmentBehavior` is set to
|
|
62
|
+
* `automatic` — already gated by the sheet's `insetAdjustment`
|
|
63
|
+
*/
|
|
64
|
+
@property (nonatomic, assign) BOOL contentInsetAdjustment;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Bottom safe-area inset the footer absorbs as padding — the footer
|
|
68
|
+
* owns the sheet's bottom edge, so its background fills the inset
|
|
69
|
+
*/
|
|
70
|
+
@property (nonatomic, assign) CGFloat footerBottomInset;
|
|
71
|
+
|
|
33
72
|
/**
|
|
34
73
|
* Returns the current content height
|
|
35
74
|
*/
|
|
36
75
|
- (CGFloat)contentHeight;
|
|
37
76
|
|
|
38
77
|
/**
|
|
39
|
-
*
|
|
78
|
+
* Returns the current header height
|
|
79
|
+
*/
|
|
80
|
+
- (CGFloat)headerHeight;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns the current footer height
|
|
84
|
+
*/
|
|
85
|
+
- (CGFloat)footerHeight;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Returns the bottom inset currently baked into the footer's height
|
|
89
|
+
*/
|
|
90
|
+
- (CGFloat)footerAppliedBottomInset;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Returns the current height of the peek view within the content
|
|
94
|
+
*/
|
|
95
|
+
- (CGFloat)peekContentHeight;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Registers a peek view found within the content subtree
|
|
99
|
+
*/
|
|
100
|
+
- (void)attachPeekView:(TrueSheetPeekView *)peekView;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Re-applies the footer's keyboard slide to reflect a live `keyboardOffset` change.
|
|
104
|
+
*/
|
|
105
|
+
- (void)updateFooterKeyboardOffset;
|
|
106
|
+
|
|
107
|
+
- (BOOL)hasAccessibilityFooterElements;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Setup scrollable content
|
|
111
|
+
*/
|
|
112
|
+
- (void)setupScrollable;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Setup keyboard observer for content and footer
|
|
116
|
+
* @param viewController The sheet view controller to observe keyboard events for
|
|
117
|
+
*/
|
|
118
|
+
- (void)setupKeyboardObserverWithViewController:(UIViewController *)viewController;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Cleanup keyboard observer
|
|
40
122
|
*/
|
|
41
|
-
- (void)
|
|
123
|
+
- (void)cleanupKeyboardObserver;
|
|
42
124
|
|
|
43
125
|
@end
|
|
44
126
|
|