Skip to content

Commit d745725

Browse files
committed
Add the possibility to customise the background of Thread List
1 parent d45d28c commit d745725

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public struct ChatThreadListView<Factory: ViewFactory>: View {
7272
)
7373
}
7474
}
75+
.accentColor(colors.tintColor)
76+
.background(
77+
viewFactory.makeThreadListBackground(colors: colors)
78+
)
7579
.modifier(viewFactory.makeThreadListHeaderViewModifier(title: title))
7680
.onAppear {
7781
if !viewModel.hasLoadedThreads {

Sources/StreamChatSwiftUI/DefaultViewFactory.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,11 @@ extension ViewFactory {
10031003
ChatThreadListHeaderViewModifier(title: title)
10041004
}
10051005

1006+
public func makeThreadListBackground(colors: ColorPalette) -> some View {
1007+
Color(colors.background)
1008+
.edgesIgnoringSafeArea(.bottom)
1009+
}
1010+
10061011
public func makeThreadListModifier() -> some ViewModifier {
10071012
EmptyViewModifier()
10081013
}

Sources/StreamChatSwiftUI/ViewFactory.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,12 @@ public protocol ViewFactory: AnyObject {
10191019
/// Returns a view modifier applied to the thread list.
10201020
func makeThreadListModifier() -> ThreadListModifier
10211021

1022+
associatedtype ThreadListBackground: View
1023+
/// Creates the background for the thread list.
1024+
/// - Parameter colors: The colors palette used in the SDK.
1025+
/// - Returns: The view shown as a background of the thread list.
1026+
func makeThreadListBackground(colors: ColorPalette) -> ThreadListBackground
1027+
10221028
associatedtype ThreadListDividerItem: View
10231029
/// Creates the thread list divider item.
10241030
func makeThreadListDividerItem() -> ThreadListDividerItem

0 commit comments

Comments
 (0)