Jetpack compose modal drawer opening gesture

Viewed 431

Something I notice on the modal drawer layout was that the gesture does not have to start from the edge of the screen. You can just gesture on half of the width of the screen and it will still open. Is this the intended behavior now? Or this is an issue? If it is an issue, anyone knows what could be a good work around? Thanks

1 Answers

Since this issue will going to take a while to be fix. My solution is to use a view binding system like this

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

       <androidx.compose.ui.platform.ComposeView
            android:id="@+id/composeNavContent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>


</androidx.drawerlayout.widget.DrawerLayout>

Then on my compose

AndroidViewBinding(ActivityMainBinding::inflate) {
            // other content here

        composeNavContent.setContent {
            NavContent(navController = navController, drawerLayout)
        }
    }

This workaround fix my issue on drawer having the correct gesture (from edge). Until this

Related