Expose calculateLayoutWithSize in YogaKit
Summary: calculateLayoutWithSize: can be useful when calculating table/collection view sizes before the views are fully laid out by UIKit. Closes https://github.com/facebook/yoga/pull/558 Differential Revision: D5104863 Pulled By: emilsjolander fbshipit-source-id: e0e0c6d502f6745be8d84de8c1b6e24cc25a0352
This commit is contained in:
committed by
Facebook Github Bot
parent
e9e1e084da
commit
2fb01daf70
@@ -120,6 +120,12 @@ typedef NS_OPTIONS(NSInteger, YGDimensionFlexibility) {
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) CGSize intrinsicSize;
|
||||
|
||||
/**
|
||||
Returns the size of the view based on provided constraints. Pass NaN for an unconstrained dimension.
|
||||
*/
|
||||
- (CGSize)calculateLayoutWithSize:(CGSize)size
|
||||
NS_SWIFT_NAME(calculateLayout(with:));
|
||||
|
||||
/**
|
||||
Returns the number of children that are using Flexbox.
|
||||
*/
|
||||
|
@@ -271,8 +271,6 @@ YG_PROPERTY(CGFloat, aspectRatio, AspectRatio)
|
||||
return [self calculateLayoutWithSize:constrainedSize];
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (CGSize)calculateLayoutWithSize:(CGSize)size
|
||||
{
|
||||
NSAssert([NSThread isMainThread], @"Yoga calculation must be done on main.");
|
||||
@@ -293,6 +291,8 @@ YG_PROPERTY(CGFloat, aspectRatio, AspectRatio)
|
||||
};
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
static YGSize YGMeasureView(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
|
Reference in New Issue
Block a user