Post

Replies

Boosts

Views

Activity

Reply to Unexpected behavior of NavigationStack with List inside sheets
This is a bit of a hack, but works for me. The issue is caused by a scroll view being drawn at the same time as the rest of the view, if you delay the drawing of the list until after the view has appeared, then the layout will be correct. struct ContentView: View { @State private var showSheet: Bool = false @State private var showList: Bool = false @Environment(\.dismiss) private var dismiss var body: some View { NavigationStack { Button("Show me", action: { showSheet = true }) } .padding() .sheet(isPresented: $showSheet) { NavigationStack { VStack { if showList { List { Button("Go away", action: { showSheet = false }) } } } .navigationBarTitleDisplayMode(.large) .navigationTitle("Test") .onAppear { DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { showList = true } } } } } }
Oct ’23