@ExperimentalFoundationApi @Composable public fun ExtendedReactionsOptions( ownReactions: List<Reaction>, onReactionOptionSelected: (ReactionOptionItemState) -> Unit, modifier: Modifier = Modifier, cells: GridCells = GridCells.Fixed(DefaultNumberOfColumns), reactionTypes: Map<String, ReactionIcon> = ChatTheme.reactionIconFactory.createReactionIcons(), itemContent: @Composable LazyGridScope.(ReactionOptionItemState) -> Unit = { option -> DefaultExtendedReactionsItemContent( option = option, onReactionOptionSelected = onReactionOptionSelected ) }, ) { val options = reactionTypes.entries.map { (type, reactionIcon) - val isSelected = ownReactions.any { ownReaction -> ownReaction.type == type } ReactionOptionItemState( painter = reactionIcon.getPainter(isSelected), type = type ) } LazyVerticalGrid(modifier = modifier, columns = cells) { items(options) { item -> key(item.type) { this@LazyVerticalGrid.itemContent(item) } } } }
Displays all available reactions a user can set on a message.