Skip to content

Commit 7545e74

Browse files
Exposed way to specify number of trailing items in a channel list item
1 parent 6c77678 commit 7545e74

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelSwipeableListItem.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem
1616

1717
@Binding var swipedChannelId: String?
1818

19+
private let numberOfTrailingItems: Int
20+
1921
private let itemWidth: CGFloat = 60
2022
private var menuWidth: CGFloat {
21-
itemWidth * 2 + 8
23+
itemWidth * CGFloat(numberOfTrailingItems) + 8
2224
}
2325

2426
private var buttonWidth: CGFloat {
@@ -44,13 +46,15 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem
4446
channelListItem: ChannelListItem,
4547
swipedChannelId: Binding<String?>,
4648
channel: ChatChannel,
49+
numberOfTrailingItems: Int = 2,
4750
trailingRightButtonTapped: @escaping (ChatChannel) -> Void,
4851
trailingLeftButtonTapped: @escaping (ChatChannel) -> Void,
4952
leadingSwipeButtonTapped: @escaping (ChatChannel) -> Void
5053
) {
5154
self.factory = factory
5255
self.channelListItem = channelListItem
5356
self.channel = channel
57+
self.numberOfTrailingItems = numberOfTrailingItems
5458
self.trailingRightButtonTapped = trailingRightButtonTapped
5559
self.trailingLeftButtonTapped = trailingLeftButtonTapped
5660
leadingButtonTapped = leadingSwipeButtonTapped

0 commit comments

Comments
 (0)