Skip to content

Commit

Permalink
[iOS] Fabric: Fixes Modal snapshot when closing it
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwuzw committed Dec 13, 2024
1 parent 06751aa commit a11b9a2
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ @implementation RCTModalHostViewComponentView {
BOOL _shouldAnimatePresentation;
BOOL _shouldPresent;
BOOL _isPresented;
UIView *_modalContentsSnapshot;
}

- (instancetype)initWithFrame:(CGRect)frame
Expand Down Expand Up @@ -141,7 +140,6 @@ - (void)dismissViewController:(UIViewController *)modalViewController
animated:(BOOL)animated
completion:(void (^)(void))completion
{
_modalContentsSnapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO];
[modalViewController dismissViewControllerAnimated:animated completion:completion];
}

Expand All @@ -167,8 +165,7 @@ - (void)ensurePresentedOnlyIfNeeded
_isPresented = NO;
// To animate dismissal of view controller, snapshot of
// view hierarchy needs to be added to the UIViewController.
UIView *snapshot = _modalContentsSnapshot;

UIView *snapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO];
if (_shouldPresent) {
[self.viewController.view addSubview:snapshot];
}
Expand Down

0 comments on commit a11b9a2

Please sign in to comment.