@Composablepublic fun ReactionOptions(ownReactions: List<Reaction>,onReactionOptionSelected: (ReactionOptionItemState) -> Unit,onShowMoreReactionsSelected: () -> Unit,modifier: Modifier = Modifier,numberOfReactionsShown: Int = DefaultNumberOfReactionsShown,horizontalArrangement: Arrangement.Horizontal =Arrangement.SpaceBetween,reactionTypes: Map<String, ReactionIcon> = ChatTheme.reactionIconFactory.createReactionIcons(),@DrawableReshowMoreReactionsIcon: Int = R.drawable.stream_compose_ic_more, itemContent: @Composable RowScope.(ReactionOptionItemState) -> Unit = { option -> DefaultReactionOptionItem( option = option, onReactionOptionSelected = onReactionOptionSelected ) }, ) { val options = reactionTypes.entries.map { (type, reactionIcon) -> val isSelected = ownReactions.any { ownReaction -> ownReaction.type == type } val painter = reactionIcon.getPainter(isSelected) ReactionOptionItemState( painter = painter, type = type ) }Row( modifier = modifier, horizontalArrangement = horizontalArrangement ) { options.take(numberOfReactionsShown).forEach { option -> key(option.type) { itemContent(option) } } if(options.size > numberOfReactionsShown) { Icon( modifier = Modifier.clickable( interactionSource = remember { MutableInteractionSource() }, indication = rememberRipple(bounded = false), onClick = { onShowMoreReactionsSelected() } ), painter = painterResource(id = showMoreReactionsIcon), contentDescription = LocalContext.current.getString(R.string.stream_compose_show_more_reactions), tint = ChatTheme.colors.textLowEmphasis, ) } } }
Displays all available reactions.