Problem: If the navigated view has searchable
modifier and when you select the searchable field (so keyboard is open) and if you pop this view back by selecting an item, first view is freezes (not respond any user input). This issue only occurs with the searchable field and not with any other text fields. Additionally, the problem only exists in iOS 16, as there are no issues in iOS 15.
Xcode: 14.3
Project Target Version: iOS 15
Simulator & Device Version: iOS 16
Code for reproducing problem:
struct ContentView: View {
private let options: [String] = ["ABC", "DEF", "GHI", "JKL", "MNO"]
@State private var selection: String?
var body: some View {
NavigationView {
NavigationLink {
CustomPicker(selection: $selection, options: options)
} label: {
HStack {
Text("Picked value")
Spacer()
Text(selection ?? "Pick >")
}
.accentColor(.black)
}
.padding()
}
.navigationViewStyle(.stack)
}
}
struct CustomPicker: View {
@Environment(\.dismiss) private var dismiss
@Binding var selection: String?
let options: [String]
var body: some View {
List(options, id: \.self) { option in
Button {
selection = option
dismiss()
} label: {
Text(option)
}
}
.searchable(text: .constant(""))
}
}
I tried dismiss view using isActive in NavigationLink(isActive: )
and it does not work.