After I upgraded to Xcode 12, my List view have a different shade of white or black (depending on Light mode or Dark mode) compared to its background. But my other List view in the same app is alright. Why? Below are the screenshots and accompanying code. Please advise, thank you.
List
{
VStack
{
Picker("Numbers", selection: self.$selectorIndex)
{
ForEach(0..<self.numbers.count)
{
index in Text(self.numbers[index]).tag(index)
}
}
.pickerStyle(SegmentedPickerStyle())
if numbers[selectorIndex]=="Alphabetically"
{
ForEach(appointments_title)
{
order in
HStack
{
Text("\(order.title)").font(.headline)
Spacer()
Text("\(order.date, formatter: ContentView.self.taskDateFormat)").font(.headline)
}.padding(.bottom).contentShape(Rectangle())
.onTapGesture { order.isExpanded.toggle() }//.animation(.linear(duration: 0.3))
if order.isExpanded { Text("\(order.descript)").frame(maxWidth: .infinity, alignment: .topLeading).padding(.bottom) }
else { EmptyView() }
}
}
}
This is default behavior and will have something to do with the formatting of the list. I would compare both sets of code and check:
They may have different parent view structures (ie. placed differently within NavigationViews),
You may be using Sections or Groups in your code,
You can also add one of the ListStyle modifiers on the List to override their default style: