Hero icon indicating copy to clipboard operation
Hero copied to clipboard

Dismissing Modal with Hero disabled causes black screen

Open otymartin opened this issue 4 years ago • 2 comments

@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

  • Hero Version: 1.5.0

  • iOS Version(s): 11

  • Swift Version: 5

  • Devices/Simulators: Device

Demo Project

otymartin avatar Jan 02 '20 04:01 otymartin

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

otymartin avatar Jan 02 '20 05:01 otymartin

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

glennposadas avatar Feb 17 '21 11:02 glennposadas