Skip to content

Commit 305705c

Browse files
authored
Fix channel view tab bar not hidden on iOS 16.0 (#870)
* Fix channel view tab bar not hidden on iOS 16.0 * Make sure both Channel View and Thread View use the messageListConfig.handleTabBarVisibility * Update CHANGELOG.md * Apply tab bar fix only for iOS 16.0 - 16.3
1 parent 7dad1d4 commit 305705c

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
88

99
### 🐞 Fixed
1010
- Fix tapping on invisible areas on iOS 26 [#868](https://github.com/GetStream/stream-chat-swiftui/pull/868)
11+
- Fix channel view tab bar not hidden on iOS 16.0 [#870](https://github.com/GetStream/stream-chat-swiftui/pull/870)
1112

1213
# [4.80.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.80.0)
1314
_June 17, 2025_

DemoAppSwiftUI/ChannelHeader/NewChatView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct TabBarVisibilityModifier: ViewModifier {
109109

110110
func body(content: Content) -> some View {
111111
if #available(iOS 16.0, *) {
112-
content.toolbar(.hidden, for: .bottomBar)
112+
content.toolbar(.hidden, for: .tabBar)
113113
} else {
114114
content
115115
}

DemoAppSwiftUI/PinChannelHelpers.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ struct DemoAppChatChannelNavigatableListItem<ChannelDestination: View>: View {
165165
tag: channel.channelSelectionInfo,
166166
selection: $selectedChannel
167167
) {
168-
LazyView(channelDestination(channel.channelSelectionInfo))
168+
LazyView(
169+
channelDestination(channel.channelSelectionInfo)
170+
.modifier(TabBarVisibilityModifier())
171+
)
169172
} label: {
170173
EmptyView()
171174
}

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelNavigatableListItem.swift

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public struct ChatChannelNavigatableListItem<Factory: ViewFactory, ChannelDestin
1414
private var avatar: UIImage
1515
private var disabled: Bool
1616
private var onlineIndicatorShown: Bool
17+
private var handleTabBarVisibility: Bool
1718
@Binding private var selectedChannel: ChannelSelectionInfo?
1819
private var channelDestination: (ChannelSelectionInfo) -> ChannelDestination
1920
private var onItemTap: (ChatChannel) -> Void
@@ -25,6 +26,7 @@ public struct ChatChannelNavigatableListItem<Factory: ViewFactory, ChannelDestin
2526
avatar: UIImage,
2627
onlineIndicatorShown: Bool,
2728
disabled: Bool = false,
29+
handleTabBarVisibility: Bool = true,
2830
selectedChannel: Binding<ChannelSelectionInfo?>,
2931
channelDestination: @escaping (ChannelSelectionInfo) -> ChannelDestination,
3032
onItemTap: @escaping (ChatChannel) -> Void
@@ -38,6 +40,7 @@ public struct ChatChannelNavigatableListItem<Factory: ViewFactory, ChannelDestin
3840
self.onlineIndicatorShown = onlineIndicatorShown
3941
self.disabled = disabled
4042
_selectedChannel = selectedChannel
43+
self.handleTabBarVisibility = true
4144
}
4245

4346
public var body: some View {
@@ -57,7 +60,14 @@ public struct ChatChannelNavigatableListItem<Factory: ViewFactory, ChannelDestin
5760
tag: channel.channelSelectionInfo,
5861
selection: $selectedChannel
5962
) {
60-
LazyView(channelDestination(channel.channelSelectionInfo))
63+
LazyView(
64+
channelDestination(channel.channelSelectionInfo)
65+
.modifier(
66+
HideTabBarModifierForiOS16(
67+
handleTabBarVisibility: handleTabBarVisibility
68+
)
69+
)
70+
)
6171
} label: {
6272
EmptyView()
6373
}
@@ -113,3 +123,23 @@ extension ChatChannel {
113123
ChannelSelectionInfo(channel: self, message: nil)
114124
}
115125
}
126+
127+
/// Modifier to fix tab bar visibility issue on iOS 16.0, 16.1, 16.2.
128+
struct HideTabBarModifierForiOS16: ViewModifier {
129+
var handleTabBarVisibility: Bool
130+
131+
func body(content: Content) -> some View {
132+
if #available(iOS 16.0, *) {
133+
if #unavailable(iOS 16.3) {
134+
content
135+
.modifier(HideTabBarModifier(
136+
handleTabBarVisibility: handleTabBarVisibility
137+
))
138+
} else {
139+
content
140+
}
141+
} else {
142+
content
143+
}
144+
}
145+
}

Sources/StreamChatSwiftUI/DefaultViewFactory.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ extension ViewFactory {
7373
trailingSwipeLeftButtonTapped: @escaping (ChatChannel) -> Void,
7474
leadingSwipeButtonTapped: @escaping (ChatChannel) -> Void
7575
) -> some View {
76+
let utils = InjectedValues[\.utils]
7677
let listItem = ChatChannelNavigatableListItem(
7778
factory: self,
7879
channel: channel,
7980
channelName: channelName,
8081
avatar: avatar,
8182
onlineIndicatorShown: onlineIndicatorShown,
8283
disabled: disabled,
84+
handleTabBarVisibility: utils.messageListConfig.handleTabBarVisibility,
8385
selectedChannel: selectedChannel,
8486
channelDestination: channelDestination,
8587
onItemTap: onItemTap
@@ -1071,14 +1073,15 @@ extension ViewFactory {
10711073
threadDestination: @escaping (ChatThread) -> ThreadDestination,
10721074
selectedThread: Binding<ThreadSelectionInfo?>
10731075
) -> some View {
1074-
ChatThreadListNavigatableItem(
1076+
let utils = InjectedValues[\.utils]
1077+
return ChatThreadListNavigatableItem(
10751078
thread: thread,
10761079
threadListItem: ChatThreadListItem(
10771080
viewModel: .init(thread: thread)
10781081
),
10791082
threadDestination: threadDestination,
10801083
selectedThread: selectedThread,
1081-
handleTabBarVisibility: true
1084+
handleTabBarVisibility: utils.messageListConfig.handleTabBarVisibility
10821085
)
10831086
}
10841087

0 commit comments

Comments
 (0)