.sheet(item: ...)
if the view you are presenting is wrap inside another view which only add a navigation view
let's say I have a view called ViewB with a dismiss button which called the presentation mode dismiss, that works
let' say I have another view called ViewBWithNavigationView
where it's calling ViewB inside the NavigationView and it also calling dismiss on the cancel button
the result of this is that the presentation mode dismiss will only works for the first view B the cancel button, it will no close the view if you click the button inside the view
Code Block struct ViewBInsideNavigationView: View { @Environment(\.presentationMode) var presentationMode var body: some View { NavigationView { ViewB() .navigationBarTitle("View B", displayMode: .inline) .navigationBarItems(leading: Button("Cancel") { self.presentationMode.wrappedValue.dismiss() }) } } }
the call to self.presentationMode.wrappedValue.dismiss() inside ViewB is not trigger and the view is not dismiss
thanks