upodate flexnode settings

This commit is contained in:
pengfei.zhou
2020-04-10 20:41:43 +08:00
committed by osborn
parent b266fdaa20
commit c70e1cb20c
10 changed files with 59 additions and 38 deletions

View File

@@ -34,6 +34,7 @@ - (CGSize)sizeThatFits:(CGSize)size {
@implementation DoricFlexNode
- (UIView *)build {
return [[DoricFlexView new] also:^(DoricFlexView *it) {
it.clipsToBounds = YES;
[it configureLayoutWithBlock:^(YGLayout *_Nonnull layout) {
layout.isEnabled = YES;
}];

View File

@@ -38,9 +38,11 @@ - (void)setContentView:(UIView *)contentView {
- (CGSize)sizeThatFits:(CGSize)size {
if (self.contentView) {
if (!self.contentView.doricLayout.resolved) {
[self.contentView.doricLayout apply:self.frame.size];
[self.contentView.doricLayout apply:size];
}
return self.contentView.frame.size;
return CGSizeMake(
MIN(size.width, self.contentView.doricLayout.measuredWidth),
MIN(size.height, self.contentView.doricLayout.measuredHeight));
}
return CGSizeZero;
}