From 2e13d3984f46f196f2ec0879273e002ba04991b9 Mon Sep 17 00:00:00 2001 From: alexstyl <1665273+alexstyl@users.noreply.github.com> Date: Thu, 17 Oct 2024 02:23:08 +0700 Subject: [PATCH] Allow ModalBottomSheet to be dismissed by back press even not idle The error behavior described in the issue is no longer reproducable. This is probably due to all past improvements to Bottom Sheet and Modals. --- core/src/commonMain/kotlin/ModalBottomSheet.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/commonMain/kotlin/ModalBottomSheet.kt b/core/src/commonMain/kotlin/ModalBottomSheet.kt index 260ef8f..950099a 100644 --- a/core/src/commonMain/kotlin/ModalBottomSheet.kt +++ b/core/src/commonMain/kotlin/ModalBottomSheet.kt @@ -145,10 +145,7 @@ public fun ModalBottomSheet( if (scope.visibleState.currentState || scope.visibleState.targetState || scope.visibleState.isIdle.not()) { - val onKeyEvent: (KeyEvent) -> Boolean = if (scope.sheetState.isIdle && properties.dismissOnBackPress) { - // AnchoredDraggableState jumps to 1.0f progress as soon as we change the current value - // while moving. This causes the sheet to disappear instead of animating away nicely. - // Because of this, we only manage back presses when the sheet is idle + val onKeyEvent: (KeyEvent) -> Boolean = if (properties.dismissOnBackPress) { { event -> when (event.key) { Key.Back, Key.Escape -> {