1

Is there a possibility to prohibit clickability? Not implementing the onClick interface might be one step. I also want to prevent the colored highlighting when tapping on it.

I've already tried Modifier.clickable(enabled = false, onClick = {}), but it still flashes when tapping on it.

Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
  • check out [this answer](https://stackoverflow.com/a/69146178/3585796). Note that it'll disable all the gestures, not only clicks – Phil Dukhov Feb 24 '22 at 09:09

1 Answers1

3

You need to set indication to null:

inline fun Modifier.disableClickAndRipple(): Modifier = composed {
    clickable(
        enabled = false,
        indication = null,
        interactionSource = remember { MutableInteractionSource() },
        onClick = { },
    )
}
ditn
  • 1,386
  • 1
  • 10
  • 23
  • This isn't working for me. I'm applying it to a `Chip` modifier and it doesn't seem to have any effect. – Mark May 04 '23 at 15:08