Skip to content

Commit

Permalink
Fixed visibility of tabbar when reactions are shown (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmitrevski authored Feb 10, 2025
1 parent 554d52b commit 9854b64
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

# Upcoming

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

# [4.72.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.72.0)
_February 04, 2025_
Expand Down
4 changes: 2 additions & 2 deletions Sources/StreamChatSwiftUI/ChatChannel/ChatChannelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public struct ChatChannelView<Factory: ViewFactory>: View, KeyboardReadable {
Divider()
.navigationBarBackButtonHidden(viewModel.reactionsShown)
.if(viewModel.reactionsShown, transform: { view in
view.navigationBarHidden(true)
view.changeBarsVisibility(shouldShow: false)
})
.if(!viewModel.reactionsShown, transform: { view in
view.navigationBarHidden(false)
view.changeBarsVisibility(shouldShow: true)
})
.if(viewModel.channelHeaderType == .regular) { view in
view.modifier(factory.makeChannelHeaderViewModifier(for: channel))
Expand Down
22 changes: 22 additions & 0 deletions Sources/StreamChatSwiftUI/Utils/Modifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ struct IconOverImageModifier: ViewModifier {
}
}

struct ChangeBarsVisibilityModifier: ViewModifier {

@Injected(\.utils) private var utils

var shouldShow: Bool

func body(content: Content) -> some View {
if #available(iOS 16, *), !utils.messageListConfig.handleTabBarVisibility {
content
.navigationBarHidden(!shouldShow)
.toolbar(shouldShow ? .visible : .hidden, for: .tabBar)
} else {
content
.navigationBarHidden(!shouldShow)
}
}
}

extension View {
/// View extension that applies default padding to elements.
public func standardPadding() -> some View {
Expand All @@ -92,6 +110,10 @@ extension View {
public func applyDefaultIconOverlayStyle() -> some View {
modifier(IconOverImageModifier())
}

public func changeBarsVisibility(shouldShow: Bool) -> some View {
modifier(ChangeBarsVisibilityModifier(shouldShow: shouldShow))
}
}

extension Image {
Expand Down

0 comments on commit 9854b64

Please sign in to comment.