diff --git a/yobble/Views/Chat/PrivateChatView.swift b/yobble/Views/Chat/PrivateChatView.swift index cb3a2e2..d6b61f1 100644 --- a/yobble/Views/Chat/PrivateChatView.swift +++ b/yobble/Views/Chat/PrivateChatView.swift @@ -24,6 +24,10 @@ struct PrivateChatView: View { @EnvironmentObject private var messageCenter: IncomingMessageCenter @Environment(\.dismiss) private var dismiss + @State private var previousStandardAppearance: UINavigationBarAppearance? + @State private var previousScrollEdgeAppearance: UINavigationBarAppearance? + @State private var previousCompactAppearance: UINavigationBarAppearance? + init(chat: PrivateChatListItem, currentUserId: String?) { self.chat = chat self.currentUserId = currentUserId @@ -94,6 +98,18 @@ struct PrivateChatView: View { } .onAppear { messageCenter.activeChatId = chat.chatId + + previousStandardAppearance = UINavigationBar.appearance().standardAppearance + previousScrollEdgeAppearance = UINavigationBar.appearance().scrollEdgeAppearance + previousCompactAppearance = UINavigationBar.appearance().compactAppearance + + let appearance = UINavigationBarAppearance() + appearance.configureWithDefaultBackground() +// appearance.shadowColor = .clear + + UINavigationBar.appearance().standardAppearance = appearance + UINavigationBar.appearance().scrollEdgeAppearance = appearance + UINavigationBar.appearance().compactAppearance = appearance } .onChange(of: viewModel.isInitialLoading) { isLoading in if isLoading { @@ -109,6 +125,12 @@ struct PrivateChatView: View { if messageCenter.activeChatId == chat.chatId { messageCenter.activeChatId = nil } + + if let standard = previousStandardAppearance { + UINavigationBar.appearance().standardAppearance = standard + } + UINavigationBar.appearance().scrollEdgeAppearance = previousScrollEdgeAppearance + UINavigationBar.appearance().compactAppearance = previousCompactAppearance } }