Close navigation drawer on back press
Some checks are pending
Build & Test / Validate (pull_request) Successful in 22s
Build & Test / Run Unit Tests (pull_request) Successful in 8m20s
Build & Test / Run UI Tests (pull_request) Successful in 12m23s
Build & Test / Validate (push) Waiting to run
Build & Test / Run Unit Tests (push) Blocked by required conditions
Build & Test / Run UI Tests (push) Blocked by required conditions
Some checks are pending
Build & Test / Validate (pull_request) Successful in 22s
Build & Test / Run Unit Tests (pull_request) Successful in 8m20s
Build & Test / Run UI Tests (pull_request) Successful in 12m23s
Build & Test / Validate (push) Waiting to run
Build & Test / Run Unit Tests (push) Blocked by required conditions
Build & Test / Run UI Tests (push) Blocked by required conditions
This commit is contained in:
parent
90ab7f9397
commit
094ac1fccf
1 changed files with 6 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.wbrawner.simplemarkdown.ui
|
||||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.size
|
||||
|
@ -29,6 +30,11 @@ fun MarkdownNavigationDrawer(
|
|||
) {
|
||||
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
BackHandler(enabled = drawerState.isOpen) {
|
||||
coroutineScope.launch {
|
||||
drawerState.close()
|
||||
}
|
||||
}
|
||||
DismissibleNavigationDrawer(
|
||||
gesturesEnabled = drawerState.isOpen,
|
||||
drawerState = drawerState,
|
||||
|
|
Loading…
Reference in a new issue