feat:flowlayout async blend sub node

This commit is contained in:
pengfei.zhou 2019-12-10 19:57:46 +08:00
parent 0889a57a68
commit 24fb291ba8

View File

@ -249,24 +249,26 @@ - (DoricViewNode *)subNodeWithViewId:(NSString *)viewId {
} }
- (void)blendSubNode:(NSDictionary *)subModel { - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"]; dispatch_async(dispatch_get_main_queue(), ^{
DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; NSString *viewId = subModel[@"id"];
if (viewNode) { DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
[viewNode blend:subModel[@"props"]]; if (viewNode) {
} else { [viewNode blend:subModel[@"props"]];
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy]; } else {
[self recursiveMixin:subModel to:model]; NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self setSubModel:model in:viewId]; [self recursiveMixin:subModel to:model];
} [self setSubModel:model in:viewId];
[self.itemViewIds enumerateKeysAndObjectsUsingBlock:^(NSNumber *_Nonnull key, NSString *_Nonnull obj, BOOL *_Nonnull stop) {
if ([viewId isEqualToString:obj]) {
*stop = YES;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[key integerValue] inSection:0];
[UIView performWithoutAnimation:^{
[self.view reloadItemsAtIndexPaths:@[indexPath]];
}];
} }
}]; [self.itemViewIds enumerateKeysAndObjectsUsingBlock:^(NSNumber *_Nonnull key, NSString *_Nonnull obj, BOOL *_Nonnull stop) {
if ([viewId isEqualToString:obj]) {
*stop = YES;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[key integerValue] inSection:0];
[UIView performWithoutAnimation:^{
[self.view reloadItemsAtIndexPaths:@[indexPath]];
}];
}
}];
});
} }
- (void)callItem:(NSUInteger)position size:(CGSize)size { - (void)callItem:(NSUInteger)position size:(CGSize)size {