diff --git a/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm b/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm index 82bfa1a5515..c0de92d8c21 100644 --- a/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +++ b/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm @@ -30,16 +30,29 @@ using namespace facebook::react; - (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index { - RCTAssert(childComponentView.superview == nil, @"Attempt to mount already mounted component view."); + RCTAssert( + childComponentView.superview == nil, + @"Attempt to mount already mounted component view. (parent: %@, child: %@, index: %@)", + self, + childComponentView, + @(index)); [self insertSubview:childComponentView atIndex:index]; } - (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index { - RCTAssert(childComponentView.superview == self, @"Attempt to unmount improperly mounted component view."); RCTAssert( - [self.subviews objectAtIndex:index] == childComponentView, - @"Attempt to unmount improperly mounted component view."); + childComponentView.superview == self, + @"Attempt to unmount a view which is mounted inside different view. (parent: %@, child: %@, index: %@)", + self, + childComponentView, + @(index)); + RCTAssert( + (self.subviews.count > index) && [self.subviews objectAtIndex:index] == childComponentView, + @"Attempt to unmount a view which has a different index. (parent: %@, child: %@, index: %@)", + self, + childComponentView, + @(index)); [childComponentView removeFromSuperview]; }