1
0
mirror of https://github.com/yattee/yattee.git synced 2025-04-29 00:10:34 +05:30

Fix search on tvOS

This commit is contained in:
Arkadiusz Fal 2021-12-01 12:22:19 +01:00
parent 06f7391ad9
commit 1c61ad37a9

View File

@ -53,14 +53,16 @@ struct SearchView: View {
ZStack { ZStack {
results results
if state.query.query != state.queryText, !state.queryText.isEmpty, !state.querySuggestions.collection.isEmpty { #if !os(tvOS)
HStack { if state.query.query != state.queryText, !state.queryText.isEmpty, !state.querySuggestions.collection.isEmpty {
Spacer() HStack {
SearchSuggestions() Spacer()
.borderLeading(width: 1, color: Color("ControlsBorderColor")) SearchSuggestions()
.frame(maxWidth: 280) .borderLeading(width: 1, color: Color("ControlsBorderColor"))
.frame(maxWidth: 280)
}
} }
} #endif
} }
#endif #endif
} }
@ -173,9 +175,16 @@ struct SearchView: View {
updateFavoriteItem() updateFavoriteItem()
} }
} }
#if !os(tvOS) #if os(tvOS)
.ignoresSafeArea(.keyboard, edges: .bottom) .searchable(text: $state.queryText) {
.navigationTitle("Search") ForEach(state.querySuggestions.collection, id: \.self) { suggestion in
Text(suggestion)
.searchCompletion(suggestion)
}
}
#else
.ignoresSafeArea(.keyboard, edges: .bottom)
.navigationTitle("Search")
#endif #endif
#if os(iOS) #if os(iOS)
.navigationBarHidden(!Defaults[.visibleSections].isEmpty || navigationStyle == .sidebar) .navigationBarHidden(!Defaults[.visibleSections].isEmpty || navigationStyle == .sidebar)