Reputation: 43
I wanted to limit the items to 3 in LazyColumn
in the below code,
@Composable
fun MessageList(messages: List<Message>) {
LazyColumn {
items(
items = messages,
key = { message ->
// Return a stable + unique key for the item
message.id
}
) { message ->
MessageRow(message)
}
}
}
Upvotes: 3
Views: 2461
Reputation: 29320
If you just want 3 items, then replace
items = messages
with
items = messages.take(3)
Upvotes: 7