Is this an OK approach for blocking click through ...
# compose
e
Is this an OK approach for blocking click through on a
Box
?
Copy code
private val noopOnClick: () -> Unit = {}
private val noopInteractionSource = object : MutableInteractionSource {
  override val interactions = emptyFlow<Interaction>()
  override suspend fun emit(interaction: Interaction) {}
  override fun tryEmit(interaction: Interaction) = true
}

public fun Modifier.blockClickThrough(): Modifier = clickable(
  interactionSource = noopInteractionSource,
  indication = null,
  onClick = noopOnClick
)
c
e
Yes, good to know about
pointerInput
, thanks
v
You can block touch events from passing through with
.pointerInput(Unit) {}
(
Surface
has the same internal implementation)
a
Was just about to say!