Search: Fix sheet and results bug for iOS 15

In iOS 15, a searchbar will become inherited if a sheet call is
within the searchable view and its children.

Migrate the sheet call outside the search results view.

Signed-off-by: kingbri <bdashore3@gmail.com>
This commit is contained in:
kingbri 2022-07-26 21:38:16 -04:00
parent 74a610c2c0
commit b88a6cf96f
2 changed files with 12 additions and 10 deletions

View file

@ -10,6 +10,7 @@ import SwiftUI
struct ContentView: View {
@EnvironmentObject var scrapingModel: ScrapingViewModel
@EnvironmentObject var debridManager: DebridManager
@EnvironmentObject var navigationModel: NavigationViewModel
@AppStorage("RealDebrid.Enabled") var realDebridEnabled = false
@ -77,9 +78,18 @@ struct ContentView: View {
}
.navigationTitle("Search")
}
.sheet(item: $navigationModel.currentChoiceSheet) { item in
Group {
switch item {
case .magnet:
MagnetChoiceView()
case .batch:
BatchChoiceView()
}
}
.tint(.primary)
}
}
func performSearch() {}
}
struct ContentView_Previews: PreviewProvider {

View file

@ -42,14 +42,6 @@ struct SearchResultsView: View {
.font(.callout)
.fixedSize(horizontal: false, vertical: true)
}
.sheet(item: $navigationModel.currentChoiceSheet) { item in
switch item {
case .magnet:
MagnetChoiceView()
case .batch:
BatchChoiceView()
}
}
.tint(.primary)
.padding(.bottom, 5)