[:white_check_mark: Resolved]. Hello all, When I ...
# compose
s
[ Resolved]. Hello all, When I pass these unit functions for
TapGestures
I really see a
performance issue
. Why is it happening? Is there any way optimise performance? For ex - When I tap
LazyColumn Item
it will goto
details screen
. But now it takes
1s to navigate to details screen
. When remove those functions & use clickable to goto details screen it’s working fine!
Code 👇
@Composable
fun TaskItemCard(task: Task, onTap: () -> Unit, onDoubleTap: () -> Unit, onLongPress: () -> Unit) {
// Emoji + (title + category)
Row(
modifier = Modifier
.fillMaxWidth()
.pointerInput(Unit) {
detectTapGestures(
onDoubleTap = { onDoubleTap() }, // complete the task
onLongPress = { onLongPress() }, // show bottom sheet
onTap = { onTap() } // it will goto details screen
)
},
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Start
) {
// Emoji Text View
EmojiTextView(emoji = task.emoji)
}}
Resolved I wrapped tap gesture inside coroutine scope. Now it works fine!
z
I’m surprised that has a noticeable effect - it doesn’t introduce any more concurrency. I think all it does is maybe defer the initialization of the gesture logic a frame? And if that has such a noticeable performance impact it’s probably something that should be addressed in compose. Would you consider filing a bug?
s
@Zach Klippenstein (he/him) [MOD] Again when I wrap
multiple tap gestures
inside coroutine scope it’s not working. It works only for
single tap gesture
. Filing a bug on this 👍