Hello,
I need to create a NavigationView with a List inside a DisclosureGroup but the list is not visible. Actually I did see one time a grey area of a list background.
This is the code what I use.
Any suggestions, or could it be a beta SwiftUI 2 bug?
Thank you
I need to create a NavigationView with a List inside a DisclosureGroup but the list is not visible. Actually I did see one time a grey area of a list background.
This is the code what I use.
Code Block struct SideBarView: View { @State private var revealDetails = false var body: some View { VStack { DisclosureGroup("Show some Text", isExpanded: $revealDetails) { VStack{ Text("Some Text...") .padding() .lineLimit(5) Divider() List(){ Text("Hello, world!").padding() Text("Hello, world!").padding() Text("Hello, world!").padding() }.listStyle(SidebarListStyle()) Divider() } .padding() } Spacer() } } }
Any suggestions, or could it be a beta SwiftUI 2 bug?
Thank you
Try this code and see if it's what you're looking for. The gray area of the list background you saw is from the .listStyle(SidebarListStyle()) modifier you have in there. If you remove that the gray area goes away.
I hope this helps.
I hope this helps.
Dan
Code Block struct ContentView: View { @State private var revealDetails = false var body: some View { VStack { List { DisclosureGroup("Show some Text", isExpanded: $revealDetails) { Text("Some Text...") .padding() Text("Hello, world!").padding() Text("Hello, world!").padding() Text("Hello, world!").padding() } }.listStyle(SidebarListStyle()) .padding() Spacer() } } }