When using the drawer in a Jetpack Compose scaffold, gestures can be used to open and close it. If the scaffold content contains a MapView, the map cannot be dragged around horizontally. Instead, the drawer is opened.
When scrollable rows are dragged (scrolled) through horizontally this does not happen, the drawer is not opened then.
How can I prevent the drawer from opening when the map is dragged by the user? When the rest of the scaffold content is dragged, the gesture should still work.
Unfortunately, wrapping the AndroidView with a Row does not solve the problem, as well as using the ModalDrawer instead of the scaffold.
Code to reproduce with Compose rc02 and kotlin 1.5.10 (EDIT: verified with Compose 1.0.3 and Kotlin 1.5.30):
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Scaffold(
drawerContent = {
Text("Drawer Content")
},
content = {
Column {
Text("Dragging here should open the drawer")
val mapView = rememberMapViewWithLifecycle()
AndroidView({ mapView }, Modifier.fillMaxSize())
}
}
)
}
}
}
}
The function rememberMapViewWithLifecycle() is taken from the Crane sample app.