I have two tabs: one is a map inside a List and the other is a simple setting view. This is the code for both:
LocationView.swift
import SwiftUI
import MapKit
struct Locations: View {
var body: some View {
NavigationStack{
List{
Section{
Map(){
}
}
}
.navigationTitle("Locations")
.navigationBarTitleDisplayMode(.automatic)
}
}
}
SettingsView.swift
import SwiftUI
struct SettingsView: View {
var body: some View {
NavigationStack{
List{
Section{
....
}
}
}
}
}
Now, problem is that I don't understand why with the same very code, the navigation (and tab bar) background looks like this:
while my SettingView navigation bar looks like this:
I would like to have both with a solid gray color like the one in the SettingView. Is it the map that makes the navigation and tab bar look like blurred?
Thanks.
UPDATE:
I'd love both views to have the default color scheme for a List like this one:
Hiding the navigation bar won't do the trick. On scroll makes it disappear and it's not what I'm looking for.
Changing the background color works but makes me lose the "translucent" effect when the navbar collapses to inline mode.
UPDATE 2
The problem is definitely the map. Removing it makes the two view look the same. Looks like the map is stretching behind all the view in the background, even if it's inside a List -> Section
The iOS 17 Map view has a similar impact on tab bar appearance. I was able to force my own appearance by using Introspect to set the per item override property. Perhaps a similar approach would work for navigation bar as well.
.introspect(.tabView, on: .iOS(.v17), scope: .ancestor) { tabController in
tabController.tabBar.selectedItem?.scrollEdgeAppearance = AppTheme.tabBarAppearance()
}