Skip to content

Commit a84d65e

Browse files
Made the message list public (#22)
1 parent 4def393 commit a84d65e

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import StreamChat
66
import SwiftUI
77

8-
struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
8+
public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
9+
910
@Injected(\.utils) private var utils
1011
@Injected(\.chatClient) private var chatClient
1112

@@ -45,7 +46,37 @@ struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
4546

4647
private let scrollAreaId = "scrollArea"
4748

48-
var body: some View {
49+
public init(
50+
factory: Factory,
51+
channel: ChatChannel,
52+
messages: LazyCachedMapCollection<ChatMessage>,
53+
messagesGroupingInfo: [String: [String]],
54+
scrolledId: Binding<String?>,
55+
showScrollToLatestButton: Binding<Bool>,
56+
quotedMessage: Binding<ChatMessage?>,
57+
currentDateString: String? = nil,
58+
listId: String,
59+
isMessageThread: Bool,
60+
onMessageAppear: @escaping (Int) -> Void,
61+
onScrollToBottom: @escaping () -> Void,
62+
onLongPress: @escaping (MessageDisplayInfo) -> Void
63+
) {
64+
self.factory = factory
65+
self.channel = channel
66+
self.messages = messages
67+
self.messagesGroupingInfo = messagesGroupingInfo
68+
self.currentDateString = currentDateString
69+
self.listId = listId
70+
self.isMessageThread = isMessageThread
71+
self.onMessageAppear = onMessageAppear
72+
self.onScrollToBottom = onScrollToBottom
73+
self.onLongPress = onLongPress
74+
_scrolledId = scrolledId
75+
_showScrollToLatestButton = showScrollToLatestButton
76+
_quotedMessage = quotedMessage
77+
}
78+
79+
public var body: some View {
4980
ZStack {
5081
ScrollViewReader { scrollView in
5182
ScrollView {

0 commit comments

Comments
 (0)