にNavigationView
を設定した場所があり.navigationBarHidden(true)
ますSplashScreen
。ここでは正しく表示されませんが、次の画面に移動するとNavigationView
バーが表示されます。ナビゲーションバーを適切に非表示にするにはどうすればよいですか? 背景も正しく表示されません。
意見
struct EventsScreen: View {
var eventsRepository: EventsRepository
@State
var currentPage: Int = 0
@State
private var searchTerm : String = ""
func getEventSections() -> [EventSection] {
eventsRepository.fetchEventSections()
}
func getViewControllers() -> [UIHostingController<EventFeatureView>] {
return eventsRepository.fetchFeaturedEvents().map({ event in
UIHostingController(rootView: EventFeatureView(event: event))
})
}
var body: some View {
NavigationView {
List {
ZStack(alignment: .top) {
EventViewController(controllers: self.getViewControllers(), currentPage: self.$currentPage)
VStack {
SearchBar(text: $searchTerm)
.padding(EdgeInsets.init(top: 16, leading: 16, bottom: 0, trailing: 16))
HStack {
Spacer()
Chip(text: "Dates", action: {
//TODO filter on dates
})
Chip(text:"Type", action: {
//TODO filter event type
})
Chip(text: "Points", action: {
//TODO filter points
})
Spacer()
}
}
}.listRowInsets(EdgeInsets())
.frame(height: 600)
ForEach(self.getEventSections()) { section in
EventSectionView(eventSection: section)
}
}
}
.background(LinearGradient(gradient: Gradient(colors: [.black, ColorTheme.brandPurple.color]), startPoint: .top, endPoint: .bottom))
.navigationBarTitle(Text("Events"), displayMode: .inline)
.navigationBarHidden(true)
}
}