diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index bff1e93189ce91..0d82ac2a890db9 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -156,13 +156,11 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT], - (CGRect)measureLayoutRelativeToAncestor:(RCTShadowView *)ancestor { CGPoint offset = CGPointZero; - NSInteger depth = 30; // max depth to search RCTShadowView *shadowView = self; - while (depth && shadowView && shadowView != ancestor) { + while (shadowView && shadowView != ancestor) { offset.x += shadowView.layoutMetrics.frame.origin.x; offset.y += shadowView.layoutMetrics.frame.origin.y; shadowView = shadowView->_superview; - depth--; } if (ancestor != shadowView) { return CGRectNull; @@ -172,11 +170,9 @@ - (CGRect)measureLayoutRelativeToAncestor:(RCTShadowView *)ancestor - (BOOL)viewIsDescendantOf:(RCTShadowView *)ancestor { - NSInteger depth = 30; // max depth to search RCTShadowView *shadowView = self; - while (depth && shadowView && shadowView != ancestor) { + while (shadowView && shadowView != ancestor) { shadowView = shadowView->_superview; - depth--; } return ancestor == shadowView; }