Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ios/RNSScreenStack.mm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
namespace react = facebook::react;
#endif // RCT_NEW_ARCH_ENABLED

static BOOL _rnsModalPresentationInProgress = NO;

@interface RNSScreenStackView () <
UINavigationControllerDelegate,
UIAdaptivePresentationControllerDelegate,
Expand Down Expand Up @@ -573,9 +575,11 @@ - (void)setModalViewControllers:(NSArray<UIViewController *> *)controllers
return;
}

_rnsModalPresentationInProgress = YES;
[previous presentViewController:next
animated:shouldAnimate
completion:^{
_rnsModalPresentationInProgress = NO;
[weakSelf.presentedModals addObject:next];
if (lastModal) {
afterTransitions();
Expand Down Expand Up @@ -1445,6 +1449,11 @@ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompo
- (void)mountingTransactionWillMount:(const facebook::react::MountingTransaction &)transaction
withSurfaceTelemetry:(const facebook::react::SurfaceTelemetry &)surfaceTelemetry
{
if (_rnsModalPresentationInProgress) {
[CATransaction begin];
[CATransaction setDisableActions:YES];
}

for (const auto &mutation : transaction.getMutations()) {
if (mutation.type == react::ShadowViewMutation::Delete) {
RNSScreenView *_Nullable toBeRemovedChild = [self childScreenForTag:mutation.oldChildShadowView.tag];
Expand Down Expand Up @@ -1494,6 +1503,9 @@ - (void)mountingTransactionDidMount:(const facebook::react::MountingTransaction
strongSelf->_toBeDeletedScreens.clear();
});
}
if (_rnsModalPresentationInProgress) {
[CATransaction commit];
}
}

- (void)prepareForRecycle
Expand Down