HeroTransitions / Hero

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

Dismissing Modal with Hero disabled causes black screen #656

Open otymartin opened 4 years ago

otymartin commented 4 years ago

@JoeMatt

What did you do?

I present a modal with vc.modalPresentationStyle = .overCurrentContext The presentingVC is a chat app VC with a list of chats. The chatCell's have a titleLabel who's heroId is the same as the Modal VC's navigationBar titleLabel.

The presentation animation works beautifully there's no problem here.

What did you expect to happen?

When I dismiss, I don't want the same match animation that was used to present the modal. Instead I want it to dismiss normally with the default iOS modal dismiss animation.

To achieve this, I set hero.isEnabled = false in my modal VC right before calling dismiss(animated: true..)

What happened instead?

Instead what happens is the modal will dismiss, I briefly see the my presenting VC with the cell that was tapped having it's subviews out of position. Then the view goes black. I debug the view hierarchy and it appears as if even my root viewController is dismissed so there's literally no rootVC in my viewhierachy.

How do I fix this to have a normal dismiss without Hero match animation?

General Information

Demo Project

otymartin commented 4 years ago

I temporary fixed this issue by renabling hero when dismissing and setting hero.modalAnimationType = .uncover(direction: .down) It actually works better than if I used the normal dismiss animation.

My only issue now is the hero dismiss animation adds a dark shadow on the modal when dismissing which looks like a black line when the VC is dismissing.

I want to get rid of it entirely so it stays white. How do I do that?

FullSizeRender

glennposadas commented 3 years ago

This is happening as of 2/17/21. :D