Skip to content

Commit

Permalink
[Reply] Close modal nav drawer on back press (#1412)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanGClifton committed Jun 26, 2024
2 parents 3bc6b7d + ba44094 commit ab7c148
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ab7c148

Please sign in to comment.