I am trying to present a sheet from an item in a VStack. The following code works on iOS 13.7 but not on iOS 14:
I works when I change he view from a VStack to a List, however that is not possible in my current actual application due to other features.
Is the fact that this doesn't work on iOS 14 (even without a recompile) just a bug? Or is it intentional behaviour?
Thank you
Tobias Timpe
Code Block swift import SwiftUI struct ListRow: View { @State var showingSheet: Bool = false var body: some View { Button(action: { self.showingSheet = true }) { Text("Tap me") }.sheet(isPresented: self.$showingSheet, content: { NavigationView { Text("Hello") } }) } } struct ListRow_Previews: PreviewProvider { static var previews: some View { ListRow() } } struct ContentView: View { @State private var showingModal: Bool = false var body: some View { NavigationView{ VStack { ForEach (0..<10) {_ in ListRow().padding() } }.navigationBarItems(leading: Button(action: { self.showingModal = true }, label: { Text("TAP") })).sheet(isPresented: self.$showingModal, content: { Text("Testing main modal") }) } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
I works when I change he view from a VStack to a List, however that is not possible in my current actual application due to other features.
Is the fact that this doesn't work on iOS 14 (even without a recompile) just a bug? Or is it intentional behaviour?
Thank you
Tobias Timpe