HeroTransitions / Hero

Elegant transition library for iOS & tvOS
https://HeroTransitions.github.io/Hero/
MIT License
22.06k stars 1.73k forks source link

When presenting another ViewController, the transition source disappears. #641

Closed hanawat closed 4 years ago

hanawat commented 4 years ago

Hero is very useful. Thanks.

What did you do?

The problem I'm encountering occurs when I present another ViewControllerB on ViewControllerA. (Hero is enabled for both ViewControllers)

As soon as ViewControllerB is presented, ViewControllerA disappears with the reversed animation.

RootViewController
  └ ViewControllerA (disappear)
      └ ViewControllerB

What did you expect to happen?

I want ViewControllerA to be displayed as it is while ViewControllerB of OverCurrentContext is displayed.

When HeroModifiers is specified, it seems to automatically reverse animation when presenting another ViewController.

Can this be disabled only for present? (I don't want to disable it when appear or dismiss of ViewControllerA itself)

Demo Project

The operation is as follows. https://gfycat.com/meanilliteratebinturong

zishanj commented 4 years ago

hero should be enabled only on target viewcontroller.

hanawat commented 4 years ago

@zishanj Thank you for answering!

I found that preventing heroModifiers by making them empty or nil. It was not possible with hero.isEnabled = false. The sample is below. https://github.com/hanawat/hero-playground/blob/master/HeroPlayground/ViewController.swift

GitHub
hanawat/hero-playground
https://github.com/HeroTransitions/Hero/issues/641 - hanawat/hero-playground
hanawat commented 4 years ago

I found one more thing. It was impossible if isEnabled was set to true for ViewController on Storyboard. Must be specified in code.

スクリーンショット 2019-11-14 22 45 28

One more thing ... Don't clear the color of the parent view.

スクリーンショット 2019-11-14 23 03 35

Maybe here https://github.com/HeroTransitions/Hero/blob/develop/Sources/Preprocessors/DefaultAnimationPreprocessor.swift#L361