diff --git a/Packages/GalleryVC/Sources/GalleryVC/GalleryDismissAnimationController.swift b/Packages/GalleryVC/Sources/GalleryVC/GalleryDismissAnimationController.swift index 7eeb0cc6..3925ddbf 100644 --- a/Packages/GalleryVC/Sources/GalleryVC/GalleryDismissAnimationController.swift +++ b/Packages/GalleryVC/Sources/GalleryVC/GalleryDismissAnimationController.swift @@ -168,10 +168,17 @@ class GalleryDismissAnimationController: NSObject, UIViewControllerAnimatedTrans return } + let container = transitionContext.containerView + + // See comment above. + if toVC.view.superview == nil { + toVC.view.frame = container.bounds + container.addSubview(toVC.view) + } + toVC.view.frame = transitionContext.containerView.bounds fromVC.view.frame = transitionContext.containerView.bounds - transitionContext.containerView.addSubview(toVC.view) - transitionContext.containerView.addSubview(fromVC.view) + container.addSubview(fromVC.view) let duration = transitionDuration(using: transitionContext) let animator = UIViewPropertyAnimator(duration: duration, curve: .easeInOut)