When using the new .navigationTransition feature, when using .searchable at the same time result in the search bar disappearing when dismissing the view you've trasition to, has anyone else experienced this or found any workarounds? Here is an example that make the issue always occur.
@State private var searchText: String = ""
@Namespace private var namespace
let things: [String] = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirdteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty"]
var body: some View {
NavigationStack {
ScrollView {
LazyVStack(spacing: 20) {
ForEach(things, id: \.self) { thing in
NavigationLink(){
SwiftUIView(thing: thing, name: namespace)
}label: {
Text(thing)
}
.matchedTransitionSource(id: thing, in: namespace)
}
}
}
.searchable(text: $searchText)
.navigationTitle("My List")
.navigationBarTitleDisplayMode(.inline)
}
}
}
struct SwiftUIView: View {
var thing: String
var name: Namespace.ID
var body: some View {
Text(thing)
.navigationTransition(.zoom(sourceID: thing, in: name))
}
}
After running the code you end up with this:
And after clicking an element and dismissing it your get this: