Anyone know how I can debug the onClick event? Som...
# compose
a
Anyone know how I can debug the onClick event? Somehow I couldn't get the button click event triggered
Copy code
@Composable
fun TestClick() {
    Box(modifier = Modifier
        .background(Color.Red)
        .padding(40.dp)
    ) {
        Column(
            modifier = Modifier
                .background(Color.Green)
                .clickable { Log.d("Test", "Column onClick") }
                .padding(40.dp)
        ) {
            Button(onClick = { Log.d("Test", "Button onClick") }) {
                Text(text = "Click", fontSize = 24.sp)
            }
        }
    }
}
k
What if you remove the clickable modifier from its parent column?
a
Same result. I was trying different scenarios hence the Column clickable. What I'm having is if I click the area of a parent layout which has no clickable modifier(the Box) first, then click the child clickable components, the onclick event of the child will not be triggered. Which is very weird I copied the same compsable code in a brand new project, it works. But the same code in my existing project doesn't work.
After many test I finally find that if I add animation-graphic dependency in build.gradle, this bug will appear. Removing this dependency fixes this issue. @Doris Liu could you help?
d
Could you file a bug including the minimal repro code? We'll investigate.
a
Yes sure. Could you send me a link?
d
You can find this link (https://issuetracker.google.com/issues?q=componentid:612128) in the project page of this slack channel. 🙂
a
Cool thank you!