diff --git a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m index 69941375..197e75e0 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m @@ -293,26 +293,26 @@ - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId { } - (void)blendSubNode:(NSDictionary *)subModel { + NSString *viewId = subModel[@"id"]; + DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; + BOOL skipReload = NO; + if (viewNode) { + CGSize originSize = viewNode.view.frame.size; + [viewNode blend:subModel[@"props"]]; + [viewNode.view.doricLayout apply]; + [viewNode requestLayout]; + if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) { + skipReload = YES; + } + } else { + NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy]; + [self recursiveMixin:subModel to:model]; + [self setSubModel:model in:viewId]; + } + if (skipReload) { + return; + } dispatch_async(dispatch_get_main_queue(), ^{ - NSString *viewId = subModel[@"id"]; - DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; - BOOL skipReload = NO; - if (viewNode) { - CGSize originSize = viewNode.view.frame.size; - [viewNode blend:subModel[@"props"]]; - [viewNode.view.doricLayout apply]; - [viewNode requestLayout]; - if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) { - skipReload = YES; - } - } else { - NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy]; - [self recursiveMixin:subModel to:model]; - [self setSubModel:model in:viewId]; - } - if (skipReload) { - return; - } [self.itemViewIds enumerateKeysAndObjectsUsingBlock:^(NSNumber *_Nonnull key, NSString *_Nonnull obj, BOOL *_Nonnull stop) { if ([viewId isEqualToString:obj]) { *stop = YES; diff --git a/doric-iOS/Pod/Classes/Shader/DoricListNode.m b/doric-iOS/Pod/Classes/Shader/DoricListNode.m index 0c31fe3a..a0d79315 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricListNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricListNode.m @@ -280,26 +280,26 @@ - (NSDictionary *)itemModelAt:(NSUInteger)position { - (void)blendSubNode:(NSDictionary *)subModel { ///Here async blend sub node because the item count need to be applied first. NSUInteger currentCount = self.itemCount + (self.loadMore ? 1 : 0); + NSString *viewId = subModel[@"id"]; + DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; + BOOL skipReload = NO; + if (viewNode) { + CGSize originSize = viewNode.view.frame.size; + [viewNode blend:subModel[@"props"]]; + [viewNode.view.doricLayout apply:CGSizeMake(self.view.width, self.view.height)]; + [viewNode requestLayout]; + if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) { + skipReload = YES; + } + } else { + NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy]; + [self recursiveMixin:subModel to:model]; + [self setSubModel:model in:viewId]; + } + if (skipReload) { + return; + } dispatch_async(dispatch_get_main_queue(), ^{ - NSString *viewId = subModel[@"id"]; - DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; - BOOL skipReload = NO; - if (viewNode) { - CGSize originSize = viewNode.view.frame.size; - [viewNode blend:subModel[@"props"]]; - [viewNode.view.doricLayout apply:CGSizeMake(self.view.width, self.view.height)]; - [viewNode requestLayout]; - if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) { - skipReload = YES; - } - } else { - NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy]; - [self recursiveMixin:subModel to:model]; - [self setSubModel:model in:viewId]; - } - if (skipReload) { - return; - } [self.itemViewIds enumerateKeysAndObjectsUsingBlock:^(NSNumber *_Nonnull key, NSString *_Nonnull obj, BOOL *_Nonnull stop) { if ([viewId isEqualToString:obj]) { *stop = YES;