Skip to content

Commit

Permalink
chore: add hack to disable iOS 18's tab crossfade
Browse files Browse the repository at this point in the history
  • Loading branch information
rinsuki committed Feb 1, 2025
1 parent d66f541 commit 298cf86
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/iOS/App/MainTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class MainTabBarController: UITabBarController, Instantiatable {

let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(onLongPressed))
self.tabBar.addGestureRecognizer(longPressRecognizer)
delegate = self
}

var firstAppear = true
Expand Down Expand Up @@ -140,3 +141,14 @@ class MainTabBarController: UITabBarController, Instantiatable {
}
}
}

extension MainTabBarController: UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
// HACK: We want to disable iOS 18's cross fade while switching tabs, since navigation bar's background is weird while fading.
if let fromVC = selectedViewController, fromVC != viewController {
UIView.transition(from: fromVC.view, to: viewController.view, duration: 0, options: [], completion: nil)
}

return true
}
}

0 comments on commit 298cf86

Please sign in to comment.