From a7c8b1bdcecd83888cc736dedc2c6ee88f7ced97 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 2 Mar 2026 10:35:37 +0200 Subject: [PATCH] fix cancelling dialogs with preventDismiss --- .../java/expo/modules/bottomsheet/BottomSheetView.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt b/modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt index 42bd411509..bb4587995a 100644 --- a/modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt +++ b/modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt @@ -66,6 +66,11 @@ class BottomSheetView( set(value) { field = value this.dialog?.setCancelable(!value) + // Full-height sheets have no half-expanded snap point, so any drag + // would dismiss. Disable dragging when dismiss is prevented. + if (fullHeight) { + this.setDraggable(!value && !disableDrag) + } } var fullHeight = false @@ -318,7 +323,11 @@ class BottomSheetView( } fun dismiss() { - this.dialog?.cancel() + val dialog = this.dialog ?: return + // Temporarily make cancelable so cancel() works — cancel() gives the + // slide-out animation, while dismiss() does a plain fade. + dialog.setCancelable(true) + dialog.cancel() } // Observe each direct child of innerView via OnLayoutChangeListener so that