From 7b962397b6ffe075931ec3a07c9961875a04aa2b Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Wed, 6 Sep 2017 23:40:19 -0700 Subject: [PATCH] Fixed clowntoun related to `-[RCTShadowView canHaveSubviews]` Summary: Shame on me. Naming can be hard. We have to use positive logic to avoid this kind of bugs. :( In the bright future we also have to rename `isYogaLeafNode` to something with positive logic, like `canHaveYogaChildNodes`. But before we can do this, we have to have solid plan how to unify it with Android. Reviewed By: mmmulani Differential Revision: D5780917 fbshipit-source-id: 1ddaaea06f5618b91528cc87f1433a55b5fae4ac --- React/Views/RCTShadowView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index 67b954da2..fddbef815 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -374,7 +374,7 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT], - (BOOL)canHaveSubviews { - return NO; + return YES; } - (BOOL)isYogaLeafNode @@ -415,7 +415,7 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT], - (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex { - RCTAssert(!self.canHaveSubviews, @"Attempt to insert subview inside leaf view."); + RCTAssert(self.canHaveSubviews, @"Attempt to insert subview inside leaf view."); [_reactSubviews insertObject:subview atIndex:atIndex]; if (![self isYogaLeafNode]) {