HeroTransitions / HeroTransitions/Hero
Over fullscreen transitions persist snapshots
- Dominant language
- Swift
- Stars
- 22.5k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
## What did you do?
When using a full screen Hero transition which scales a UIImageView to the size of the full-screen (transitioning to another view controller), the snapshot used during the transition remains in the view hierarchy post-animation. This is caused by the following code in HeroTransition+Complete:
```
if finished && isPresenting && toOverFullScreen {
// finished presenting a overFullScreen VC
context.unhide(rootView: toView)
context.removeSnapshots(rootView: toView)
context.storeViewAlpha(rootView: fromView)
fromViewController?.hero.storedSnapshot = container
container.superview?.addSubview(fromView)
**fromView.addSubview(container)
} else if !finished && !isPresenting && fromOverFullScreen {
// cancelled dismissing a overFullScreen VC
context.unhide(rootView: fromView)
context.removeSnapshots(rootView: fromView)
context.storeViewAlpha(rootView: toView)
toViewController?.hero.storedSnapshot = container
container.superview?.addSubview(toView)
**toView.addSubview(container)
}
```
Normally, this is okay; however, if the background of the presented view controller (and its subviews) are made transparent, then you can see the snapshot behind it. I believe this is the same issue outlined in https://github.com/HeroTransitions/Hero/issues/518.
## What did you expect to happen?
The snapshot should not be visible. I'm not sure for what purpose it needs to be there, but perhaps a property can added to hide it. When commenting out the asterisked lines above, the transition still works properly and the snapshot is hidden.
## General Information
* Hero Version: 1.5.0
* iOS Version(s): 13.7
* Swift Version: 5
* Devices/Simulators: 8 and 11
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.