diff --git a/Reply/app/src/main/java/com/example/reply/ui/navigation/ReplyNavigationComponents.kt b/Reply/app/src/main/java/com/example/reply/ui/navigation/ReplyNavigationComponents.kt index 3c3911f8f9..368ce8a9be 100644 --- a/Reply/app/src/main/java/com/example/reply/ui/navigation/ReplyNavigationComponents.kt +++ b/Reply/app/src/main/java/com/example/reply/ui/navigation/ReplyNavigationComponents.kt @@ -16,6 +16,7 @@ package com.example.reply.ui.navigation +import androidx.activity.compose.BackHandler import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -117,6 +118,12 @@ fun ReplyNavigationWrapper( val gesturesEnabled = drawerState.isOpen || navLayoutType == NavigationSuiteType.NavigationRail + BackHandler(enabled = drawerState.isOpen) { + coroutineScope.launch { + drawerState.close() + } + } + ModalNavigationDrawer( drawerState = drawerState, gesturesEnabled = gesturesEnabled,