ThreadList

fun ThreadList(viewModel: ThreadListViewModel, modifier: Modifier = Modifier, currentUser: User? = ChatClient.instance().getCurrentUser(), onBannerClick: () -> Unit = { viewModel.load() }, onThreadClick: (Thread) -> Unit = {}, onLoadMore: () -> Unit = { viewModel.loadNextPage() })

Composable rendering a paginated list of threads. Optionally, it renders a banner informing about new threads/thread messages outside of the loaded pages of threads.

Parameters

viewModel

The ThreadListViewModel handling the loading of the threads.

modifier

Modifier instance for general styling.

currentUser

The currently logged User, used for formatting the message in the thread preview.

onBannerClick

Action invoked when the user clicks on the banner. By default, it calls ThreadListViewModel.load to force reload the list of threads, loading the newly created/updated threads.

onThreadClick

Action invoked when the usr clicks on a thread item in the list. No-op by default.

onLoadMore

Action invoked when the current thread page was scrolled to the end, and a next page should be loaded. By default, it calls ThreadListViewModel.loadNextPage to load the next page of threads.


fun ThreadList(state: ThreadListState, modifier: Modifier = Modifier, currentUser: User? = ChatClient.instance().getCurrentUser(), onBannerClick: () -> Unit, onThreadClick: (Thread) -> Unit, onLoadMore: () -> Unit)

Composable rendering a paginated list of threads. Optionally, it renders a banner informing about new threads/thread messages outside of the loaded pages of threads.

Parameters

state

The ThreadListState holding the current thread list state.

modifier

Modifier instance for general styling.

currentUser

The currently logged User, used for formatting the message in the thread preview.

onBannerClick

Action invoked when the user clicks on the banner.

onThreadClick

Action invoked when the usr clicks on a thread item in the list.

onLoadMore

Action invoked when the current thread page was scrolled to the end, and a next page should be loaded.