Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hero push animation is unable to turn off #759

Open
DenisOvchar457 opened this issue Jun 6, 2023 · 0 comments
Open

hero push animation is unable to turn off #759

DenisOvchar457 opened this issue Jun 6, 2023 · 0 comments

Comments

@DenisOvchar457
Copy link

DenisOvchar457 commented Jun 6, 2023

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
//        }
      }
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant