Othman El Jazouli
06/22/2023, 12:22 PM@Composable
private fun QuickActionsScreen(
quickActionItems: ImmutableList<QuickActionItem>,
onActionClicked: (QuickActionItem) -> Unit
) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxWidth()
) {
quickActionItems.forEach { quickAction ->
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.clickable { onActionClicked(quickAction) }
) {
// Content of the Column
}
}
}
}
data class QuickActionItem(
val title: String,
val enabled: Boolean,
val action: QuickAction // enum
)
Im checking layout inspector and seeing that QuickActionsScreen
is recomposed about 15 times,
but if I remove modifier = Modifier.clickable { onActionClicked(quickAction) }
then all recompositions are skipped,
is this expected? and is there a way to fix it because I have a lot of composable shown in a dashboard and they all suffer the same thing, and I suspect that’s why it causes the screen to lag a littlemyanmarking
06/22/2023, 5:20 PM