Is there a built-in Modifier
that disables any gesture detection / pointer input interaction of its children?
e.g.
@Composable
fun Foo() {
Box(modifier = Modifier.gesturesEnabled(enabled = false)) {
BasicText(text = "Hello", modifier = Modifier.clickable { // clickable is not enabled
// ...
})
}
}
I could roll my own (very simple) implementation using a CompositionLocal
:
val LocalGesturesEnabled = compositionLocalOf { mutableStateOf(true) }
fun Modifier.myClickable(onClick: () -> Unit, enabled: Boolean = true) = composed {
clickable(enabled = enabled && LocalGesturesEnabled.current.value, onClick)
}
But it won't work with third party composables or with more complex composables like LazyList
.