I cannot use a ZStack to fill the color because by content inside a bottom sheet is a searchable view. Hence the header is showing the color of the sheet. Is there a way to change the color using UIKit or SwiftUI (preferably)?
.sheet(isPresented: $viewModel.isPresented) {
ZStack {
Color(.black)
.ignoresSafeArea()
NavigationStack {
SearchableView()
}
}
})
Update: -
Turns out it was the toolbarBackground
that was showing, hiding it within the navigation stack and then using @Benzy Neez's solution of using presentationBackground(.black)
sets the background of the entire sheet without using a ZStack.
.sheet(isPresented: $viewModel.isPresented) {
NavigationStack {
AllEventsView(viewModel: viewModel, isMapView: true)
.toolbarBackground(.hidden)
}
.presentationBackground(.black)
}