iOS: fix when init NSAttributedString cause it runs blocks on main queue immediately

This commit is contained in:
pengfei.zhou 2021-10-22 16:08:15 +08:00 committed by osborn
parent 72a4562885
commit 7637a820e5

View File

@ -57,17 +57,18 @@ - (void)mixinSubNode:(NSMutableDictionary *)dictionary {
- (void)mixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)targetModel { - (void)mixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)targetModel {
NSDictionary *srcProp = srcModel[@"props"]; NSDictionary *srcProp = srcModel[@"props"];
NSMutableDictionary *targetProp = targetModel[@"props"]; NSMutableDictionary *targetProp = [targetModel[@"props"] mutableCopy];
[srcProp enumerateKeysAndObjectsUsingBlock:^(NSString *key, id obj, BOOL *stop) { [srcProp enumerateKeysAndObjectsUsingBlock:^(NSString *key, id obj, BOOL *stop) {
if (![@"subviews" isEqualToString:key]) { if (![@"subviews" isEqualToString:key]) {
targetProp[key] = obj; targetProp[key] = obj;
} }
}]; }];
targetModel[@"props"] = targetProp;
} }
- (void)recursiveMixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)targetModel { - (void)recursiveMixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)targetModel {
NSDictionary *srcProp = srcModel[@"props"]; NSDictionary *srcProp = srcModel[@"props"];
NSMutableDictionary *targetProp = targetModel[@"props"]; NSMutableDictionary *targetProp = [targetModel[@"props"] mutableCopy];
NSMutableArray *targetOri = targetProp[@"subviews"]; NSMutableArray *targetOri = targetProp[@"subviews"];
NSArray *srcSubviews = srcProp[@"subviews"]; NSArray *srcSubviews = srcProp[@"subviews"];
if (srcSubviews && srcSubviews.count > 0) { if (srcSubviews && srcSubviews.count > 0) {
@ -90,6 +91,7 @@ - (void)recursiveMixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)target
targetProp[key] = obj; targetProp[key] = obj;
} }
}]; }];
targetModel[@"props"] = targetProp;
} }
- (void)blendSubNode:(DoricViewNode *)subNode layoutConfig:(NSDictionary *)layoutConfig { - (void)blendSubNode:(DoricViewNode *)subNode layoutConfig:(NSDictionary *)layoutConfig {