Skip to content

Commit 2741e48

Browse files
Improved tabbar animation
1 parent 181e4b4 commit 2741e48

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ public struct ChatChannelListView<Factory: ViewFactory>: View {
103103
}
104104
}
105105
}
106+
.onDisappear(perform: {
107+
if viewModel.selectedChannel != nil {
108+
viewModel.hideTabBar = true
109+
}
110+
})
106111
.background(
107112
viewFactory.makeChannelListBackground(colors: colors)
108113
)

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListViewModel.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
123123
///
124124
/// - Parameter index: the currently displayed index.
125125
public func checkForChannels(index: Int) {
126+
checkTabBarVisibilty()
127+
126128
if index < (controller?.channels.count ?? 0) - 15 {
127129
return
128130
}
@@ -330,6 +332,13 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
330332
selectedChannel = channels.first?.channelSelectionInfo
331333
}
332334
}
335+
336+
private func checkTabBarVisibilty() {
337+
guard #available(iOS 15, *) else { return }
338+
if hideTabBar == true {
339+
hideTabBar = false
340+
}
341+
}
333342
}
334343

335344
/// Enum for the type of alert presented in the channel list view.

0 commit comments

Comments
 (0)