Summary: Fixes #606. If there are no subviews in `UIView`, yoga assumes that `sizeThatFits:` returns `CGSizeZero`. However, according to [the documentation](https://developer.apple.com/documentation/uikit/uiview/1622625-sizethatfits), `UIView` returns current size if there are no subviews. This diff adds a check - if there are no subviews, `sizeThatFits:` doesn't get called, and CGSizeZero is returned. Pull Request resolved: https://github.com/facebook/yoga/pull/610 Reviewed By: davidaurelio Differential Revision: D6807406 Pulled By: priteshrnandgaonkar fbshipit-source-id: 9189cf14c393f840122bc365d3827881bf03548c
This commit is contained in:
committed by
Facebook Github Bot
parent
786ccddd7b
commit
838ef47847
@@ -127,6 +127,15 @@
|
||||
XCTAssertEqual(longTextLabelSize.width + textBadgeView.yoga.intrinsicSize.width, containerSize.width);
|
||||
}
|
||||
|
||||
- (void)testSizeThatFitsEmptyView {
|
||||
UIView* view = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];
|
||||
view.yoga.isEnabled = YES;
|
||||
|
||||
const CGSize viewSize = view.yoga.intrinsicSize;
|
||||
XCTAssertEqual(viewSize.height, 0);
|
||||
XCTAssertEqual(viewSize.width, 0);
|
||||
}
|
||||
|
||||
- (void)testPreservingOrigin
|
||||
{
|
||||
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0,0,50,75)];
|
||||
|
Reference in New Issue
Block a user