Basically what I have so far are NavigationViews inside of a TabView. The problem that I am currently dealing with is the following: I applied colors to the TabView and the NavigationView via initializers. Now, when I add any View like e.g. Text() to the HomeView everything is perfectly fine, but now I would like to add a List which is somehow automatically changing the background color and everything to a system default one (dark / light). I had the idea to change the listRowBackground to a specific color, but when dragging the List down a bit, you would see the default system background behind it again...
TabView:
struct MainView: View {
init() {
UITabBar.appearance().barTintColor = Theme.current.background
UITabBar.appearance().unselectedItemTintColor = Theme.current.backgroundSecondary
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().tintColor = Theme.current.backgroundPrimary
}
var body: some View {
TabView {
HomeNavigationView().tabItem {
Image("HomeIcon")
}.tag(0)
//Left out the other tabs
...
}.edgesIgnoringSafeArea(.top)
.accentColor(Color(Theme.current.brand))
}
}
HomeNavigationView:
struct HomeNavigationView: View {
var body: some View {
NavigationView {
HomeView()
}
}
}
HomeView when adding a simple Text():
struct HomeView: View {
var body: some View {
ZStack {
Color.red.edgesIgnoringSafeArea(.all)
Text("Test Text")
}
//Left out the NavigationBar icons
...
}
}
HomeView when adding a List:
struct HomeView: View {
var body: some View {
ZStack {
Color.red.edgesIgnoringSafeArea(.all)
List {
Text("first row")
Text("second row")
Text("third row")
}
}
//Left out the NavigationBar icons
...
}
}
Screenshot of when everything is ok ; Screenshot of the problem