I am using ".navigationTransition(ZoomNavigationTransition.zoom(sourceID: xxx, in: xxx))" to zooms the appearing view from a source view .
When the appearing view dismissed, I can only click other view after a delay .
It seems that the transition is not finished immediately when the appearing view dismissed . After a delay, the transition finished, than I can click other view.
struct ContentView: View {
@State private var path: NavigationPath = NavigationPath()
@Namespace private var namespace
var body: some View {
NavigationStack(path: $path) {
VStack(spacing: 0) {
ForEach(["aaa", "bbb"], id: \.self) { string in
Text(string)
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height / 2)
.contentShape(Rectangle())
.onTapGesture {
path.append(string)
}
.matchedTransitionSource(id: string, in: namespace)
}
}
.navigationDestination(for: String.self, destination: { route in
Text(route)
.navigationTransition(ZoomNavigationTransition.zoom(sourceID: route, in: namespace))
})
}
}
}
When using sheet on appearing view, It seems that the transition is finished immediately when the appearing view dismissed.
extension String: Identifiable {
public var id: String { return self }
}
struct ContentView: View {
@State private var path: NavigationPath = NavigationPath()
@Namespace private var namespace
@State private var stringToSheet: String?
var body: some View {
NavigationStack(path: $path) {
VStack(spacing: 0) {
ForEach(["aaa", "bbb"], id: \.self) { string in
Text(string)
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height / 2)
.contentShape(Rectangle())
.onTapGesture {
stringToSheet = string
}
.matchedTransitionSource(id: string, in: namespace)
}
}
.sheet(item: $stringToSheet) { newValue in
Text(newValue)
.navigationTransition(ZoomNavigationTransition.zoom(sourceID: newValue, in: namespace))
}
}
}
}