5

Actual Result: Ripple effect triggered on scroll (Video)

Expected Result: Ripple effect is only triggered on click just like in Android Views

Code:

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MyApp {
                Content()
            }
        }
    }
}

@Preview
@Composable
fun Content() {
    val items = List(100) { "Item number $it" }
    LazyColumn {
        items(items = items) { item ->
            Text(
                text = item,
                modifier = Modifier
                    .fillMaxWidth()
                    .clickable { }
                    .padding(16.dp)
            )
        }
    }
}

Related issue tracker:

  1. https://issuetracker.google.com/issues/182551482
  2. https://issuetracker.google.com/issues/168524931
Kefas
  • 61
  • 1
  • 5

2 Answers2

1

This issue has been fixed in Compose version 1.0.0-rc01

Kefas
  • 61
  • 1
  • 5
  • This `1.0.0-rc01` works, however, has some complications with compose @Preview. As an alternative, you can use compose version `1.0.0-beta09`. – Sreekant Shenoy Jul 16 '21 at 06:53
0

You need to set options in your Modifier.clickable like that :

Modifier.clickable(
    interactionSource = MutableInteractionSource(),
    indication = null, 
    onClick = {
            /* Action */
    }
)
Ady
  • 230
  • 3
  • 16