Skip to content

Commit 9854b64

Browse files
Fixed visibility of tabbar when reactions are shown (#750)
1 parent 554d52b commit 9854b64

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6-
### 🔄 Changed
6+
### 🐞 Fixed
7+
- Fix visibility of tabbar when reactions are shown [#750](https://github.com/GetStream/stream-chat-swiftui/pull/750)
78

89
# [4.72.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.72.0)
910
_February 04, 2025_

Sources/StreamChatSwiftUI/ChatChannel/ChatChannelView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ public struct ChatChannelView<Factory: ViewFactory>: View, KeyboardReadable {
8989
Divider()
9090
.navigationBarBackButtonHidden(viewModel.reactionsShown)
9191
.if(viewModel.reactionsShown, transform: { view in
92-
view.navigationBarHidden(true)
92+
view.changeBarsVisibility(shouldShow: false)
9393
})
9494
.if(!viewModel.reactionsShown, transform: { view in
95-
view.navigationBarHidden(false)
95+
view.changeBarsVisibility(shouldShow: true)
9696
})
9797
.if(viewModel.channelHeaderType == .regular) { view in
9898
view.modifier(factory.makeChannelHeaderViewModifier(for: channel))

Sources/StreamChatSwiftUI/Utils/Modifiers.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,24 @@ struct IconOverImageModifier: ViewModifier {
7979
}
8080
}
8181

82+
struct ChangeBarsVisibilityModifier: ViewModifier {
83+
84+
@Injected(\.utils) private var utils
85+
86+
var shouldShow: Bool
87+
88+
func body(content: Content) -> some View {
89+
if #available(iOS 16, *), !utils.messageListConfig.handleTabBarVisibility {
90+
content
91+
.navigationBarHidden(!shouldShow)
92+
.toolbar(shouldShow ? .visible : .hidden, for: .tabBar)
93+
} else {
94+
content
95+
.navigationBarHidden(!shouldShow)
96+
}
97+
}
98+
}
99+
82100
extension View {
83101
/// View extension that applies default padding to elements.
84102
public func standardPadding() -> some View {
@@ -92,6 +110,10 @@ extension View {
92110
public func applyDefaultIconOverlayStyle() -> some View {
93111
modifier(IconOverImageModifier())
94112
}
113+
114+
public func changeBarsVisibility(shouldShow: Bool) -> some View {
115+
modifier(ChangeBarsVisibilityModifier(shouldShow: shouldShow))
116+
}
95117
}
96118

97119
extension Image {

0 commit comments

Comments
 (0)