Skip to content

Commit 8e17c96

Browse files
Exposed modififer for channel list content
1 parent 84112ab commit 8e17c96

File tree

8 files changed

+23
-3
lines changed

8 files changed

+23
-3
lines changed

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public struct ChatChannelListContentView<Factory: ViewFactory>: View {
179179
}
180180

181181
public var body: some View {
182-
VStack {
182+
VStack(spacing: 0) {
183183
viewFactory.makeChannelListTopView(
184184
searchText: $viewModel.searchText
185185
)
@@ -221,5 +221,6 @@ public struct ChatChannelListContentView<Factory: ViewFactory>: View {
221221

222222
viewFactory.makeChannelListStickyFooterView()
223223
}
224+
.modifier(viewFactory.makeChannelListContentModifier())
224225
}
225226
}

Sources/StreamChatSwiftUI/CommonViews/LoadingView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public struct RedactedLoadingView<Factory: ViewFactory>: View {
2323

2424
public var body: some View {
2525
ScrollView {
26-
VStack {
26+
VStack(spacing: 0) {
2727
factory.makeChannelListTopView(
2828
searchText: .constant("")
2929
)

Sources/StreamChatSwiftUI/CommonViews/SearchBar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct SearchBar: View, KeyboardReadable {
6565
.animation(.easeInOut)
6666
}
6767
}
68-
.padding(.top, 8)
68+
.padding(.vertical, 8)
6969
.onReceive(keyboardWillChangePublisher) { shown in
7070
if shown {
7171
self.isEditing = true

Sources/StreamChatSwiftUI/DefaultViewFactory.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ extension ViewFactory {
162162
)
163163
}
164164

165+
public func makeChannelListContentModifier() -> some ViewModifier {
166+
EmptyViewModifier()
167+
}
168+
165169
public func makeChannelListModifier() -> some ViewModifier {
166170
EmptyViewModifier()
167171
}

Sources/StreamChatSwiftUI/ViewFactory.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ public protocol ViewFactory: AnyObject {
168168
channelDestination: @escaping (ChannelSelectionInfo) -> ChannelDestination
169169
) -> ChannelListSearchResultItem
170170

171+
associatedtype ChannelListContentModifier: ViewModifier
172+
/// Returns a view modifier applied to the channel list content (including both header and footer views).
173+
func makeChannelListContentModifier() -> ChannelListContentModifier
174+
171175
associatedtype ChannelListModifier: ViewModifier
172176
/// Returns a view modifier applied to the channel list.
173177
func makeChannelListModifier() -> ChannelListModifier
Loading
Loading

StreamChatSwiftUITests/Tests/Utils/ViewFactory_Tests.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,17 @@ class ViewFactory_Tests: StreamChatTestCase {
667667
// Then
668668
XCTAssert(view is MessageAuthorAndDateView)
669669
}
670+
671+
func test_viewFactory_makeChannelListContentModifier() {
672+
// Given
673+
let viewFactory = DefaultViewFactory.shared
674+
675+
// When
676+
let viewModifier = viewFactory.makeChannelListContentModifier()
677+
678+
// Then
679+
XCTAssert(viewModifier is EmptyViewModifier)
680+
}
670681
}
671682

672683
extension ChannelAction: Equatable {

0 commit comments

Comments
 (0)