iOS: fix in list when not combine view model cause UI have no update (#559)

This commit is contained in:
osborn 2022-12-09 16:33:00 +08:00 committed by GitHub
parent 44d971b870
commit 9be6bb2051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 16 deletions

View File

@ -399,6 +399,11 @@ - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"]; NSString *viewId = subModel[@"id"];
DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
BOOL skipReload = NO; BOOL skipReload = NO;
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];
if (viewNode) { if (viewNode) {
CGSize originSize = viewNode.view.frame.size; CGSize originSize = viewNode.view.frame.size;
[viewNode blend:subModel[@"props"]]; [viewNode blend:subModel[@"props"]];
@ -407,11 +412,8 @@ - (void)blendSubNode:(NSDictionary *)subModel {
if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) { if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) {
skipReload = YES; skipReload = YES;
} }
} else {
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];
} }
if (skipReload) { if (skipReload) {
return; return;
} }

View File

@ -337,6 +337,11 @@ - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"]; NSString *viewId = subModel[@"id"];
DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
BOOL skipReload = NO; BOOL skipReload = NO;
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];
if (viewNode) { if (viewNode) {
CGSize originSize = viewNode.view.frame.size; CGSize originSize = viewNode.view.frame.size;
[viewNode blend:subModel[@"props"]]; [viewNode blend:subModel[@"props"]];
@ -345,11 +350,8 @@ - (void)blendSubNode:(NSDictionary *)subModel {
if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) { if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) {
skipReload = YES; skipReload = YES;
} }
} else {
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];
} }
if (skipReload) { if (skipReload) {
return; return;
} }

View File

@ -381,6 +381,11 @@ - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"]; NSString *viewId = subModel[@"id"];
DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
BOOL skipReload = NO; BOOL skipReload = NO;
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];
if (viewNode) { if (viewNode) {
CGSize originSize = viewNode.view.frame.size; CGSize originSize = viewNode.view.frame.size;
[viewNode blend:subModel[@"props"]]; [viewNode blend:subModel[@"props"]];
@ -389,11 +394,8 @@ - (void)blendSubNode:(NSDictionary *)subModel {
if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) { if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) {
skipReload = YES; skipReload = YES;
} }
} else {
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];
} }
if (skipReload) { if (skipReload) {
return; return;
} }

View File

@ -253,6 +253,11 @@ - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"]; NSString *viewId = subModel[@"id"];
DoricViewNode *viewNode = [self subNodeWithViewId:viewId]; DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
BOOL skipReload = NO; BOOL skipReload = NO;
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];
if (viewNode) { if (viewNode) {
CGSize originSize = viewNode.view.frame.size; CGSize originSize = viewNode.view.frame.size;
[viewNode blend:subModel[@"props"]]; [viewNode blend:subModel[@"props"]];
@ -261,11 +266,8 @@ - (void)blendSubNode:(NSDictionary *)subModel {
if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) { if (CGSizeEqualToSize(originSize, viewNode.view.frame.size)) {
skipReload = YES; skipReload = YES;
} }
} else {
NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];
} }
if (skipReload) { if (skipReload) {
return; return;
} }

View File

@ -83,6 +83,8 @@ - (void)recursiveMixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)target
}]; }];
if (viewModel) { if (viewModel) {
[self recursiveMixin:subview to:viewModel]; [self recursiveMixin:subview to:viewModel];
} else {
[targetOri addObject:subview];
} }
} }
} }