Is there a way to lock DrawerState open in compose...
# compose
s
Is there a way to lock DrawerState open in compose?
m
s
Thanks!
m
Also take a look at the
gesturesEnabled
and it's documentation 🙂
s
I tried
Copy code
val drawerState = rememberDrawerState(
    initialValue = DrawerValue.Open,
    confirmStateChange = { false }
)
and
Copy code
drawerGesturesEnabled = false
And the drawer is still closing when I touch outside of it
m
I see. Please, file a bug
s
Before I file it. This is my minimal code example that fails:
Copy code
val drawerState = rememberDrawerState(
    initialValue = DrawerValue.Open,
    confirmStateChange = { false }
)

val scaffoldState = rememberScaffoldState(
    drawerState = drawerState
)

Scaffold(
    scaffoldState = scaffoldState,
    bottomBar = {  },
    drawerGesturesEnabled = false,
    drawerScrimColor = Color.Black,
    drawerContent = {  },
    content = { },
)
Do you see anything that I might have done wrong that can cause this issue?
m
No, you are doing all correctly, it's the problem that we either 1. Should either respect confirmStateChange/gesuturesEnabled when user clicks the scrim 2. do not provide the right api (like
forceState: DrawerState
or
closeOnScrimClick
) to achieve this
a
https://issuetracker.google.com/issues/178631059 you can star this, that callback has been broken for a long time