Mounting: log more information in iOS-only REMOVE assert

Summary:
Log a little more information in the iOS-only assert checking that the REMOVE index is correct.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27632457

fbshipit-source-id: 56e668dc2f22841e3cf3d838ba605d63cc7c1bad
This commit is contained in:
Joshua Gross
2021-04-14 10:33:15 -07:00
committed by Facebook GitHub Bot
parent 88c3090066
commit ff47b0eecd
@@ -32,10 +32,11 @@ using namespace facebook::react;
{
RCTAssert(
childComponentView.superview == nil,
@"Attempt to mount already mounted component view. (parent: %@, child: %@, index: %@)",
@"Attempt to mount already mounted component view. (parent: %@, child: %@, index: %@, existing parent: %@)",
self,
childComponentView,
@(index));
@(index),
@([childComponentView.superview tag]));
[self insertSubview:childComponentView atIndex:index];
}
@@ -49,10 +50,12 @@ using namespace facebook::react;
@(index));
RCTAssert(
(self.subviews.count > index) && [self.subviews objectAtIndex:index] == childComponentView,
@"Attempt to unmount a view which has a different index. (parent: %@, child: %@, index: %@)",
@"Attempt to unmount a view which has a different index. (parent: %@, child: %@, index: %@, actual index: %@, tag at index: %@)",
self,
childComponentView,
@(index));
@(index),
@([self.subviews indexOfObject:childComponentView]),
@([[self.subviews objectAtIndex:index] tag]));
[childComponentView removeFromSuperview];
}