In SwiftUI, I have a .searchable
searchbar with a TabView in the .page
style as the content. When the user taps the cancel button, the searchbar disappears.
import SwiftUI
struct ContentView: View {
@State var searchText = ""
var body: some View {
NavigationView {
TabView {
Text("Tab Content")
}
.tabViewStyle(.page)
}
.searchable(text: $searchText)
}
}
That's what happens:
Removing the .tabViewStyle(.page)
fixes the problem (but then I cannot use the .page
style of TabView):
Am I doing something wrong? Or is this a SwiftUI bug?