@@ -7,22 +7,27 @@ final class NavigationTransitionDelegate: NSObject, UINavigationControllerDelega
77 var transition : AnyNavigationTransition
88 private weak var baseDelegate : UINavigationControllerDelegate ?
99 var interactionController : UIPercentDrivenInteractiveTransition ?
10- private var initialAreAnimationsEnabled = UIView . areAnimationsEnabled
10+ private var initialAreAnimationsEnabled : Bool ?
1111
1212 init ( transition: AnyNavigationTransition , baseDelegate: UINavigationControllerDelegate ? ) {
1313 self . transition = transition
1414 self . baseDelegate = baseDelegate
1515 }
1616
1717 func navigationController( _ navigationController: UINavigationController , willShow viewController: UIViewController , animated: Bool ) {
18- initialAreAnimationsEnabled = UIView . areAnimationsEnabled
19- UIView . setAnimationsEnabled ( transition. animation != nil )
18+ if navigationController. transitionCoordinator != nil {
19+ self . initialAreAnimationsEnabled = UIView . areAnimationsEnabled
20+ UIView . setAnimationsEnabled ( transition. animation != nil )
21+ }
2022 baseDelegate? . navigationController ? ( navigationController, willShow: viewController, animated: animated)
2123 }
2224
2325 func navigationController( _ navigationController: UINavigationController , didShow viewController: UIViewController , animated: Bool ) {
2426 baseDelegate? . navigationController ? ( navigationController, didShow: viewController, animated: animated)
25- UIView . setAnimationsEnabled ( initialAreAnimationsEnabled)
27+ if let initialAreAnimationsEnabled {
28+ UIView . setAnimationsEnabled ( initialAreAnimationsEnabled)
29+ self . initialAreAnimationsEnabled = nil
30+ }
2631 }
2732
2833 func navigationController( _ navigationController: UINavigationController , interactionControllerFor animationController: UIViewControllerAnimatedTransitioning ) -> UIViewControllerInteractiveTransitioning ? {
0 commit comments