mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-05 06:45:49 +00:00
another try
This commit is contained in:
@@ -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
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -65,12 +65,21 @@ extension View {
|
||||
}
|
||||
}
|
||||
|
||||
struct NavStackWorkaround<T: View>: View {
|
||||
let content: ()->T
|
||||
struct NavStackWorkaround <C: View, D: View>: View {
|
||||
let isPresented: Binding<Bool>
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user