MentionList

fun MentionList(viewModel: MentionListViewModel, modifier: Modifier = Modifier, currentUser: User? = ChatClient.instance().getCurrentUser(), onItemClick: (message: Message) -> Unit? = null, onEvent: (event: Any) -> Unit = {}, pullToRefreshEnabled: Boolean = true, itemContent: @Composable LazyItemScope.(MessageResult) -> Unit = { mention -> with(ChatTheme.componentFactory) { MentionListItem( mention = mention, modifier = Modifier, currentUser = currentUser, onClick = onItemClick, ) } }, loadingIndicator: @Composable BoxScope.() -> Unit = { with(ChatTheme.componentFactory) { MentionListLoadingIndicator( modifier = Modifier, ) } }, emptyContent: @Composable BoxScope.() -> Unit = { with(ChatTheme.componentFactory) { MentionListEmptyContent( modifier = Modifier, ) } }, loadingItemContent: @Composable LazyItemScope.() -> Unit = { with(ChatTheme.componentFactory) { MentionListLoadingItem( modifier = Modifier, ) } }, pullToRefreshIndicator: @Composable BoxScope.(pullToRefreshState: PullToRefreshState, isRefreshing: Boolean) -> Unit = { pullToRefreshState, isRefreshing -> if (pullToRefreshEnabled) { with(ChatTheme.componentFactory) { MentionListPullToRefreshIndicator( modifier = Modifier, pullToRefreshState = pullToRefreshState, isRefreshing = isRefreshing, ) } } })

The default stateful component that is bound to MentionListViewModel to display a list of mentions for the current user.

Parameters

viewModel

The MentionListViewModel instance to use.

modifier

The modifier to apply to this layout.

currentUser

The current user to use for the mentions.

onItemClick

The callback to be called when an item is clicked.

onEvent

The callback to be called when an MentionListEvent is received from the viewModel.

pullToRefreshEnabled

If true, the pull-to-refresh functionality is enabled. Defaults to true.

itemContent

The content displayed by a single item.

loadingIndicator

The content displayed during the initial loading.

emptyContent

The content displayed when the list is empty.

loadingItemContent

The content displayed when loading more items.

pullToRefreshIndicator

The custom indicator to be displayed during the pull-to-refresh action.

See also


fun MentionList(state: MentionListState, modifier: Modifier = Modifier, currentUser: User? = ChatClient.instance().getCurrentUser(), onItemClick: (message: Message) -> Unit? = null, onLoadMore: () -> Unit = {}, pullToRefreshEnabled: Boolean = true, onRefresh: () -> Unit = {}, itemContent: @Composable LazyItemScope.(MessageResult) -> Unit = { mention -> with(ChatTheme.componentFactory) { MentionListItem( mention = mention, modifier = Modifier, currentUser = currentUser, onClick = onItemClick, ) } }, loadingIndicator: @Composable BoxScope.() -> Unit = { with(ChatTheme.componentFactory) { MentionListLoadingIndicator( modifier = Modifier, ) } }, emptyContent: @Composable BoxScope.() -> Unit = { with(ChatTheme.componentFactory) { MentionListEmptyContent( modifier = Modifier, ) } }, loadingItemContent: @Composable LazyItemScope.() -> Unit = { with(ChatTheme.componentFactory) { MentionListLoadingItem( modifier = Modifier, ) } }, pullToRefreshIndicator: @Composable BoxScope.(pullToRefreshState: PullToRefreshState, isRefreshing: Boolean) -> Unit = { pullToRefreshState, isRefreshing -> if (pullToRefreshEnabled) { with(ChatTheme.componentFactory) { MentionListPullToRefreshIndicator( modifier = Modifier, pullToRefreshState = pullToRefreshState, isRefreshing = isRefreshing, ) } } })

The default stateless component that displays a list of mentions for the current user.

This component is useful when you want to manage the state of the list yourself.

Parameters

state

The state of the list to display.

modifier

The modifier to apply to this layout.

currentUser

The current user to use for the mentions.

onItemClick

The callback to be called when an item is clicked.

onLoadMore

The callback to be called when more items should be loaded.

pullToRefreshEnabled

If true, the pull-to-refresh functionality is enabled. Defaults to true.

onRefresh

The callback to be invoked when the user performs a pull-to-refresh action.

itemContent

The content displayed by a single item.

loadingIndicator

The content displayed during the initial loading.

emptyContent

The content displayed when the list is empty.

loadingItemContent

The content displayed when loading more items.

pullToRefreshIndicator

The custom indicator to be displayed during the pull-to-refresh action.