Add isLeaf flag to Views.
Summary: While building some views with YogaKit, I found an interesting problem. If you are apply `yg_` properties to a view which is constructed of subclassed views (that don't use Yoga.) we still treat view (and it's subviews) like they are using YogaKit. This fixes that behavior. Reviewed By: emilsjolander Differential Revision: D4348344 fbshipit-source-id: 37b8648918529f55afea1d1883a03af398aac849
This commit is contained in:
committed by
Facebook Github Bot
parent
9d35dce63e
commit
835bb1cd9c
@@ -268,4 +268,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)testyg_isLeafFlag
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
XCTAssertTrue(view.yg_isLeaf);
|
||||
|
||||
for (int i=0; i<10; i++) {
|
||||
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
[view addSubview:subview];
|
||||
}
|
||||
XCTAssertTrue(view.yg_isLeaf);
|
||||
|
||||
[view yg_setUsesYoga:YES];
|
||||
[view yg_setWidth:50.0];
|
||||
XCTAssertTrue(view.yg_isLeaf);
|
||||
|
||||
UIView *const subview = view.subviews[0];
|
||||
[subview yg_setUsesYoga:YES];
|
||||
[subview yg_setWidth:50.0];
|
||||
XCTAssertFalse(view.yg_isLeaf);
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user