Hello All :wave: , Why `CombinedClickable` takes `...
# compose
s
Hello All 👋 , Why
CombinedClickable
takes
1-2 seconds
to perform action?. Is there any workaround solution for this? Code in Thread 🙇
Sample Code 👀
Copy code
fun TaskItemCard(task: Task, onClick: () -> Unit, onDoubleTap: () -> Unit, onLongClick: () -> Unit) {
    // Emoji + (title + category)
    Row(
        modifier = Modifier
            .fillMaxWidth()
            .combinedClickable(onClick = {
                onClick()
            }, onDoubleClick = {
                onDoubleTap()
            }, onLongClick = {
                onLongClick()
            }),
        verticalAlignment = Alignment.CenterVertically,
        horizontalArrangement = Arrangement.Start
    ) {
        // Emoji Text View
        EmojiTextView(emoji = task.emoji)
        Spacer(modifier = Modifier.width(12.dp))

        // Title + Content
        Column(
            modifier = Modifier
                .align(Alignment.CenterVertically),
        ) {
            Text(
                text = task.title,
                style = typography.subtitle1,
                color = colors.onPrimary,
                maxLines = 1,
                overflow = TextOverflow.Ellipsis
            )
            Spacer(modifier = Modifier.height(12.dp))
            Text(
                text = task.category,
                style = typography.caption,
                color = colors.onPrimary.copy(.7f)
            )
        }
    }
}
s
It happens to me too at the very first click after app startup
s
Also I tried to use
tap gestures
to handle multiple touch events. But with those implementation also I face the same performance issue!
c
Romain has asked for any reproducable perf issues to be reported on the issuetracker for more visibility and so they can hopefully fix by 1.0 I would file there with the code and a video?
s
Sure gimme a moment will send you the code & video
👍 1
c
Take those samples and file a bug on issue tracker. 😁 I'm not on the compose team and have no idea why the issue might be happening.
1
r
ste: There have been a few discussions of performance at app startup, like this thread from Mar 11 https://kotlinlang.slack.com/archives/CJLTWPH7S/p1615475836408100 and this one from May 10  https://kotlinlang.slack.com/archives/CJLTWPH7S/p1620669472316800
2
l
@matvei
m
With the
combinedClickable
modifier, when you have
onDoubleClick
set, onClick will fire only after
300ms
of the click event, since we need to disambiguate between click and doubleclick and we need to wait 300ms for a potential doubleckick to happen (or not). This is the same way it works in the android views. We hopefully can do better, but this is exactly the issue on why
combinedClickable
is experimental, so proceed with caution on this one. This is most probably what is causing the delay in your case. If you see other delays and if you are able to provide a sample that will help me to reproduce the issue with the >300ms delay -- please file a bug and we will take a look.
1
s
Got it. Sure will file a bug!