Skip to content

Commit

Permalink
iOS: fix in list when not combine view model cause UI have no update (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
penfeizhou authored Dec 9, 2022
1 parent 44d971b commit 9be6bb2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
10 changes: 6 additions & 4 deletions doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"];
DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
BOOL skipReload = NO;

NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];

if (viewNode) {
CGSize originSize = viewNode.view.frame.size;
[viewNode blend:subModel[@"props"]];
Expand All @@ -407,11 +412,8 @@ - (void)blendSubNode:(NSDictionary *)subModel {
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;
}
Expand Down
10 changes: 6 additions & 4 deletions doric-iOS/Pod/Classes/Shader/DoricHorizontalListNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"];
DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
BOOL skipReload = NO;

NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];

if (viewNode) {
CGSize originSize = viewNode.view.frame.size;
[viewNode blend:subModel[@"props"]];
Expand All @@ -345,11 +350,8 @@ - (void)blendSubNode:(NSDictionary *)subModel {
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;
}
Expand Down
10 changes: 6 additions & 4 deletions doric-iOS/Pod/Classes/Shader/DoricListNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"];
DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
BOOL skipReload = NO;

NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];

if (viewNode) {
CGSize originSize = viewNode.view.frame.size;
[viewNode blend:subModel[@"props"]];
Expand All @@ -389,11 +394,8 @@ - (void)blendSubNode:(NSDictionary *)subModel {
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;
}
Expand Down
10 changes: 6 additions & 4 deletions doric-iOS/Pod/Classes/Shader/DoricSliderNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ - (void)blendSubNode:(NSDictionary *)subModel {
NSString *viewId = subModel[@"id"];
DoricViewNode *viewNode = [self subNodeWithViewId:viewId];
BOOL skipReload = NO;

NSMutableDictionary *model = [[self subModelOf:viewId] mutableCopy];
[self recursiveMixin:subModel to:model];
[self setSubModel:model in:viewId];

if (viewNode) {
CGSize originSize = viewNode.view.frame.size;
[viewNode blend:subModel[@"props"]];
Expand All @@ -261,11 +266,8 @@ - (void)blendSubNode:(NSDictionary *)subModel {
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;
}
Expand Down
2 changes: 2 additions & 0 deletions doric-iOS/Pod/Classes/Shader/DoricSuperNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ - (void)recursiveMixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)target
}];
if (viewModel) {
[self recursiveMixin:subview to:viewModel];
} else {
[targetOri addObject:subview];
}
}
}
Expand Down

0 comments on commit 9be6bb2

Please sign in to comment.