@Composable public fun rememberMessageListState(initialFirstVisibleItemIndex: Int = 0,initialFirstVisibleItemScrollOffset: Int = 0,parentMessageId: String? = null,): LazyListState {val baseListState = rememberLazyListState(initialFirstVisibleItemIndex, initialFirstVisibleItemScrollOffset) return if (parentMessageId != null) { rememberLazyListState() } else { baseListState } }
Provides a [LazyListState] that's tied to a given message list. This is the default behavior, where we keep the base scroll position of the list persisted at all times, while the thread scroll state is always new, whenever we enter a thread. In case you want to customize the behavior, provide the [LazyListState] based on your logic and conditions.