diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index b7c1db2fa..805b7da42 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -784,11 +784,10 @@ RCT_EXPORT_METHOD(removeSubviewsFromContainerWithID:(nonnull NSNumber *)containe UIView *originalSuperview = removedChild.superview; NSUInteger originalIndex = [originalSuperview.subviews indexOfObjectIdenticalTo:removedChild]; [container removeReactSubview:removedChild]; - [originalSuperview insertSubview:removedChild atIndex:originalIndex]; - // Disable user interaction while the view is animating // since the view is (conseptually) deleted and not supposed to be interactive. removedChild.userInteractionEnabled = NO; + [originalSuperview insertSubview:removedChild atIndex:originalIndex]; NSString *property = deletingLayoutAnimation.property; [deletingLayoutAnimation performAnimations:^{ diff --git a/React/Views/RCTModalHostView.m b/React/Views/RCTModalHostView.m index d488f0f98..a42c23a43 100644 --- a/React/Views/RCTModalHostView.m +++ b/React/Views/RCTModalHostView.m @@ -160,6 +160,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:coder) { [super didMoveToWindow]; + // In the case where there is a LayoutAnimation, we will be reinserted into the view hierarchy but only for aesthetic purposes. + // In such a case, we should NOT represent the . + if (!self.userInteractionEnabled && ![self.superview.reactSubviews containsObject:self]) { + return; + } + if (!_isPresented && self.window) { RCTAssert(self.reactViewController, @"Can't present modal view controller without a presenting view controller");