Skip to content

Commit

Permalink
Add a snapshot only if the Modal is visible (#42619)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #42619

This is a workaround to prepare for the next diff in the stack and make sure that the modal works correctly

## Changelog
[iOS][Changed] - Add the for the dismissal snapshot only when we need it.

Reviewed By: sammy-SC

Differential Revision: D53003657

fbshipit-source-id: 6d6cc85946b1beb8e784e08a650d1247cf780228
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Jan 24, 2024
1 parent be441f8 commit 7c4afa1
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ - (void)ensurePresentedOnlyIfNeeded
// To animate dismissal of view controller, snapshot of
// view hierarchy needs to be added to the UIViewController.
UIView *snapshot = _modalContentsSnapshot;
[self.viewController.view addSubview:snapshot];

if (_shouldPresent) {
[self.viewController.view addSubview:snapshot];
}

[self dismissViewController:self.viewController
animated:_shouldAnimatePresentation
Expand Down Expand Up @@ -194,7 +197,7 @@ - (void)ensurePresentedOnlyIfNeeded
- (void)mountingTransactionWillMount:(const MountingTransaction &)transaction
withSurfaceTelemetry:(const facebook::react::SurfaceTelemetry &)surfaceTelemetry
{
_modalContentsSnapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO];
_modalContentsSnapshot = [self.viewController.view snapshotViewAfterScreenUpdates:YES];
}

#pragma mark - UIView methods
Expand Down

0 comments on commit 7c4afa1

Please sign in to comment.