From f69cdb84bcb8de11ec035680dc384e10d4b43b7f Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Fri, 20 Jan 2023 23:49:59 +0300 Subject: [PATCH] another try --- apps/ios/Shared/Views/ChatList/ChatListView.swift | 7 ++++--- apps/ios/Shared/Views/Helpers/AppSheet.swift | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index c122a46434..01e1f4f05b 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -17,7 +17,7 @@ struct ChatListView: View { @State private var showAddChat = false var body: some View { - NavStackWorkaround { + NavStackWorkaround(isPresented: Binding(get: { chatModel.chatId != nil }, set: { _ in }), destination: chatView) { VStack { if chatModel.chats.isEmpty { onboardingButtons() @@ -29,7 +29,6 @@ struct ChatListView: View { } } } - .navigationViewStyle(.stack) } var chatList: some View { @@ -76,13 +75,15 @@ struct ChatListView: View { } } .background( - NavigationLink( + ProcessInfo().operatingSystemVersion.majorVersion < 16 + ? NavigationLink( destination: chatView(), isActive: Binding( get: { chatModel.chatId != nil }, set: { _ in } ) ) { EmptyView() } + : nil ) } diff --git a/apps/ios/Shared/Views/Helpers/AppSheet.swift b/apps/ios/Shared/Views/Helpers/AppSheet.swift index 13166a210f..4b95018e71 100644 --- a/apps/ios/Shared/Views/Helpers/AppSheet.swift +++ b/apps/ios/Shared/Views/Helpers/AppSheet.swift @@ -65,12 +65,21 @@ extension View { } } -struct NavStackWorkaround: View { - let content: ()->T +struct NavStackWorkaround : View { + let isPresented: Binding + let destination: () -> D + let content: () -> C var body: some View { if #available(iOS 16, *) { - NavigationStack(root: content) + NavigationStack { + content() + .navigationDestination(isPresented: isPresented) { + destination() + .navigationBarTitleDisplayMode(.inline) + .navigationBarBackButtonHidden(true) + } + } } else { NavigationView(content: content) .navigationViewStyle(.stack)