HeroTransitions / HeroTransitions/Hero

hero push animation is unable to turn off

Open
#759 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Swift
Stars
22.5k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Just in my case i modal present with hero from controller1 to UINavigationController with controller2. So for correct animation i should enable hero for navigationController . But that does not mean i want to make heroTransition delegate of my navigation Controller and does not mean. Its not clear. Usually u should enable hero just for dest view controller.
isEnabled should only enable animation to controller as destination, but it should not change delegate of my navigationController to make it buggy. To control if hero delegates navigation or tabs u should add another field like hero.isHandlingNavigation . For now i have the only way to fix this strange behavior - just comment these lines

ofcourse navigation handling and enabling animation to navigation controller as dest should be controlled with different flags, these behaviours should not be always turned off/on together
```
var isEnabled: Bool {
get {
return base.transitioningDelegate is HeroTransition
}
set {
guard newValue != isEnabled else { return }
if newValue {
base.transitioningDelegate = Hero.shared
// if let navi = base as? UINavigationController {
// base.previousNavigationDelegate = navi.delegate
// navi.delegate = Hero.shared
// }
// if let tab = base as? UITabBarController {
// base.previousTabBarDelegate = tab.delegate
// tab.delegate = Hero.shared
// }
} else {
base.transitioningDelegate = nil
// if let navi = base as? UINavigationController, navi.delegate is HeroTransition {
// navi.delegate = base.previousNavigationDelegate
// }
// if let tab = base as? UITabBarController, tab.delegate is HeroTransition {
// tab.delegate = base.previousTabBarDelegate
// }
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.