Skip to content

Commit c9c260f

Browse files
Config to turn off tab bar visibility handling
1 parent 07b400c commit c9c260f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
### ✅ Added
77
- Support for custom message receipt states
88
- Scrolling of instant commands
9+
- Config to turn off tab bar visibility handling
910

1011
### 🔄 Changed
1112
- Updated Nuke dependency to 11.3.0 for SPM

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ public struct ChatChannelListView<Factory: ViewFactory>: View {
1717
private let viewFactory: Factory
1818
private let title: String
1919
private var onItemTap: (ChatChannel) -> Void
20+
private var handleTabBarVisibility: Bool
2021

2122
public init(
2223
viewFactory: Factory,
2324
viewModel: ChatChannelListViewModel? = nil,
2425
channelListController: ChatChannelListController? = nil,
2526
title: String = "Stream Chat",
2627
onItemTap: ((ChatChannel) -> Void)? = nil,
27-
selectedChannelId: String? = nil
28+
selectedChannelId: String? = nil,
29+
handleTabBarVisibility: Bool = true
2830
) {
2931
let channelListVM = viewModel ?? ViewModelsFactory.makeChannelListViewModel(
3032
channelListController: channelListController,
@@ -35,6 +37,7 @@ public struct ChatChannelListView<Factory: ViewFactory>: View {
3537
)
3638
self.viewFactory = viewFactory
3739
self.title = title
40+
self.handleTabBarVisibility = handleTabBarVisibility
3841
if let onItemTap = onItemTap {
3942
self.onItemTap = onItemTap
4043
} else {
@@ -95,7 +98,7 @@ public struct ChatChannelListView<Factory: ViewFactory>: View {
9598
view.navigationViewStyle(.stack)
9699
})
97100
.background(
98-
isIphone ?
101+
isIphone && handleTabBarVisibility ?
99102
Color.clear.background(
100103
TabBarAccessor { tabBar in
101104
self.tabBar = tabBar
@@ -105,7 +108,7 @@ public struct ChatChannelListView<Factory: ViewFactory>: View {
105108
: nil
106109
)
107110
.onReceive(viewModel.$hideTabBar) { newValue in
108-
if isIphone {
111+
if isIphone && handleTabBarVisibility {
109112
self.setupTabBarAppeareance()
110113
self.tabBar?.isHidden = newValue
111114
}

0 commit comments

Comments
 (0)