When using LazyVGrid within a ScrollView with the .searchable modifier, scrolling is impossible on iPhone 15 (I’m assuming other older devices are affected too). This behavior does not occur on iPhone 16 and newer.
This also only happens, when the search bar is placed at the top, for example if the ScrollView is within a TabView.
Here's a short screen recording of the issue:
And this is a minimal example causing the issue:
import SwiftUI
struct ContentView: View {
var body: some View {
TabView {
Tab("Text", systemImage: "gear") {
ExampleTab()
}
}
}
}
struct ExampleTab: View {
@State private var searchText: String = ""
var body: some View {
NavigationStack {
ScrollView {
LazyVGrid(
columns: [GridItem(
.adaptive(minimum: 120)
)],
spacing: 20
) {
ForEach(1..<100) { index in
Text("Test \(index)")
}
}
}
.searchable(text: self.$searchText)
}
}
}