iOS: fix when RootNode shrink its size, it cannot be layout properly

This commit is contained in:
pengfei.zhou 2023-03-07 16:33:29 +08:00 committed by jingpeng
parent f67f0ce75a
commit 4103704162
2 changed files with 15 additions and 1 deletions

View File

@ -28,6 +28,8 @@
@interface DoricRootNode : DoricStackNode
@property(nonatomic, assign) CGSize mostFrameSize;
- (void)setupRootView:(UIView *)view;
@end

View File

@ -54,13 +54,25 @@ - (void)setY:(CGFloat)y {
@end
@implementation DoricRootNode
- (instancetype)initWithContext:(DoricContext *)doricContext {
if (self = [super initWithContext:doricContext]) {
_mostFrameSize = CGSizeZero;
}
return self;
}
- (void)setupRootView:(UIView *)view {
view.doricLayout.layoutType = DoricStack;
self.view = view;
}
- (void)requestLayout {
[self.view.doricLayout apply];
if (CGSizeEqualToSize(self.mostFrameSize, CGSizeZero)) {
[self.view.doricLayout apply];
} else {
[self.view.doricLayout apply:self.mostFrameSize];
}
[super requestLayout];
}
@end