mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
fix: blank until navigation push transition ends
This commit is contained in:
@@ -195,9 +195,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func navigationController(
|
||||
_ navigationController: UINavigationController,
|
||||
willShow viewController: UIViewController,
|
||||
animated: Bool
|
||||
_ navigationController: UINavigationController,
|
||||
willShow viewController: UIViewController,
|
||||
animated: Bool
|
||||
) {
|
||||
guard let toVC = viewController as? NativePageViewController else { return }
|
||||
guard let coordinator = navigationController.transitionCoordinator else { return }
|
||||
@@ -214,6 +214,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
|
||||
}
|
||||
|
||||
if isPop {
|
||||
// -----------------------------
|
||||
// POP — keep your existing logic
|
||||
// -----------------------------
|
||||
let previousStack = pathStack
|
||||
if pathStack.count > 1 { _ = pathStack.popLast() }
|
||||
if let last = pathStack.last, last != toVC.targetPath {
|
||||
@@ -250,8 +253,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
|
||||
}
|
||||
|
||||
SharedWebViewController.instance.attach(
|
||||
to: toVC,
|
||||
leavePlaceholderInPreviousParent: fromVC != nil
|
||||
to: toVC,
|
||||
leavePlaceholderInPreviousParent: fromVC != nil
|
||||
)
|
||||
|
||||
if let snapshot = self.popSnapshotView {
|
||||
@@ -264,6 +267,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDel
|
||||
self.popSnapshotView = nil
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// -----------------------------
|
||||
// PUSH / RESET
|
||||
// -----------------------------
|
||||
// Attach the shared webview to the *destination* page
|
||||
// before/during the animation so it can start rendering immediately.
|
||||
SharedWebViewController.instance.attach(
|
||||
to: toVC,
|
||||
leavePlaceholderInPreviousParent: fromVC != nil
|
||||
)
|
||||
|
||||
coordinator.animate(alongsideTransition: nil) { ctx in
|
||||
if ctx.isCancelled, let fromVC {
|
||||
// If the push is cancelled (interactive back), put the webview back.
|
||||
SharedWebViewController.instance.attach(to: fromVC)
|
||||
} else {
|
||||
// Transition completed → clear any placeholders.
|
||||
SharedWebViewController.instance.clearPlaceholder()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user