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:

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
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Jan 24, 2024
1 parent b8778ab commit 8e048c4
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 8e048c4

Please sign in to comment.