I want to show a list in fullscreenCover and navigate another View from there but unfortunately when I click Items in list nothing happens. If anyone can help, I would be happy... here is example code
Button("New Message"){
shownFCover.toggle()
}.fullScreenCover(isPresented: $shownFCover) {
VStack {
Button("Close"){
shownFCover.toggle()
}
List {
ForEach(0..<16) { index in
NavigationLink {
Text("Hello")
} label: {
HStack{
Image(systemName: "\(index).circle.fill").font(.title).foregroundColor(.red)
Text("\(index). Item")
}
}
}
}
}
}
The .sheet
and .fullScreenCover
introduce new presentations, so we need new NavigationView
inside
Button("New Message"){
shownFCover.toggle()
}.fullScreenCover(isPresented: $shownFCover) {
VStack {
Button("Close"){
shownFCover.toggle()
}
NavigationView { // << here !!
List {
ForEach(0..<16) { index in
NavigationLink {
Text("Hello")
} label: {
HStack{
Image(systemName: "\(index).circle.fill").font(.title).foregroundColor(.red)
Text("\(index). Item")
}
}
}
}
}
}
}
*Note: I recommend to separate full screen content into standalone view instead of having all right there.
So it would look like
Button("New Message"){
shownFCover.toggle()
}.fullScreenCover(isPresented: $shownFCover) {
FCoverView(shownCover: $shownFCover)
}