Sometimes (well most of the time) presented sheet gets dismissed first time it is opened. This is happening only on a device and only the first time the app is launched. This is the code:
I was able to fix this problem by removing line .navigationViewStyle(StackNavigationViewStyle()), but I need StackNavigationViewStyle in my project. Any help will be appreciated.
Code Block struct ContentView: View { var body: some View { NavigationView { NavigationLink(destination: DetailsView()) { Text("Open Details View") } } .navigationViewStyle(StackNavigationViewStyle()) } } struct DetailsView: View { @State var sheetIsPresented: Bool = false var body: some View { VStack { Button("Open") { sheetIsPresented.toggle() } }.sheet(isPresented: $sheetIsPresented, content: { SheetView() }) } } struct SheetView: View { var body: some View { Color.red } }
I was able to fix this problem by removing line .navigationViewStyle(StackNavigationViewStyle()), but I need StackNavigationViewStyle in my project. Any help will be appreciated.