From 895b1abdc2b3cff796d5c0b2cf5dc63976f416f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernesto=20Carri=C3=B3n?= Date: Wed, 24 May 2023 16:12:39 -0500 Subject: [PATCH] Allow BottomSheetViewController to work as a modal By allowing the `BottomSheetViewController` to forward the `allowsTapToDismiss` and `allowsDragToDismiss` properties to its child, we allow consumers to gain extra functionality, for example, to make the bottom sheet non-dismissable. --- .../BottomSheet/BottomSheetViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/WordPressUI/BottomSheet/BottomSheetViewController.swift b/Sources/WordPressUI/BottomSheet/BottomSheetViewController.swift index 613e90b..ffde0e1 100644 --- a/Sources/WordPressUI/BottomSheet/BottomSheetViewController.swift +++ b/Sources/WordPressUI/BottomSheet/BottomSheetViewController.swift @@ -241,6 +241,14 @@ extension BottomSheetViewController: DrawerPresentable { return childViewController?.allowsUserTransition ?? true } + public var allowsTapToDismiss: Bool { + childViewController?.allowsTapToDismiss ?? true + } + + public var allowsDragToDismiss: Bool { + childViewController?.allowsDragToDismiss ?? true + } + public var compactWidth: DrawerWidth { childViewController?.compactWidth ?? .percentage(0.66) }