Kefas
Kefas

Reputation: 61

Is it possible to not trigger ripple effect on scroll?

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

Upvotes: 5

Views: 573

Answers (2)

Kefas
Kefas

Reputation: 61

This issue has been fixed in Compose version 1.0.0-rc01

Upvotes: 1

Ady
Ady

Reputation: 278

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

Modifier.clickable(
    interactionSource = MutableInteractionSource(),
    indication = null, 
    onClick = {
            /* Action */
    }
)

Upvotes: 0

Related Questions