fix: smooth ios search exit

This commit is contained in:
Tienson Qin
2026-05-19 04:07:27 +08:00
parent 4885e9a922
commit 66711b471e
2 changed files with 23 additions and 10 deletions

View File

@@ -426,20 +426,33 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
return
}
// Fast-path: cancel search -> home root.
// Fast-path: leave SwiftUI search for the Home tab. During this
// transition SwiftUI is already moving the shared nav controller
// back into the Home tab, so rebuilding it here causes UIKit
// transition conflicts.
if previousStackId == "search",
stackId == "home",
path == self.rootPath(for: "home") {
stackId == "home" {
self.setPaths(["/__stack__/search"], for: "search")
self.activeStackId = "home"
self.setPaths(["/"], for: "home")
let vc = NativePageViewController(path: "/")
nav.setViewControllers([vc], animated: false)
self.setViewControllers([vc], for: "home")
SharedWebViewController.instance.clearPlaceholder()
SharedWebViewController.instance.attach(to: vc)
var newPaths = self.paths(for: "home")
if path == self.rootPath(for: "home") {
newPaths = [path]
} else if navigationType == "reset" {
newPaths = [path]
} else if newPaths.isEmpty {
newPaths = [path]
} else if navigationType == "push",
let last = newPaths.last,
last != path {
newPaths.append(path)
} else if let last = newPaths.last, last != path {
newPaths[newPaths.count - 1] = path
}
self.pathStack = newPaths
self.setPaths(newPaths, for: "home")
return
}

View File

@@ -63,7 +63,7 @@ public class NativeTopBarPlugin: CAPPlugin, CAPBridgedPlugin {
return
}
nav.setNavigationBarHidden(hidden, animated: true)
nav.setNavigationBarHidden(hidden, animated: false)
guard !hidden else {
call.resolve()
return