iOS: fix when Image async load cause super node requestLayout
This commit is contained in:
parent
af77a0e98e
commit
4c80e5aa60
@ -540,4 +540,9 @@ - (void)reset {
|
|||||||
self.onScrollEndFuncId = nil;
|
self.onScrollEndFuncId = nil;
|
||||||
self.loadMore = NO;
|
self.loadMore = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)subNodeContentChanged:(DoricViewNode *)subNode {
|
||||||
|
[subNode.view.doricLayout apply];
|
||||||
|
[super subNodeContentChanged:subNode];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -252,11 +252,9 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
|
|||||||
UIImage *image = [UIImage imageWithData:imageData scale:self.imageScale];
|
UIImage *image = [UIImage imageWithData:imageData scale:self.imageScale];
|
||||||
#endif
|
#endif
|
||||||
view.image = image;
|
view.image = image;
|
||||||
DoricSuperNode *node = self.superNode;
|
if (self.needReload) {
|
||||||
while (node.superNode != nil) {
|
[self.superNode subNodeContentChanged:self];
|
||||||
node = node.superNode;
|
|
||||||
}
|
}
|
||||||
[node requestLayout];
|
|
||||||
if (self.loadCallbackId.length > 0) {
|
if (self.loadCallbackId.length > 0) {
|
||||||
if (image) {
|
if (image) {
|
||||||
[self callJSResponse:self.loadCallbackId,
|
[self callJSResponse:self.loadCallbackId,
|
||||||
@ -326,12 +324,8 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
|
|||||||
},
|
},
|
||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
if (async) {
|
if (async && self.needReload) {
|
||||||
DoricSuperNode *node = self.superNode;
|
[self.superNode subNodeContentChanged:self];
|
||||||
while (node.superNode != nil) {
|
|
||||||
node = node.superNode;
|
|
||||||
}
|
|
||||||
[node requestLayout];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
@ -368,12 +362,8 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
|
|||||||
},
|
},
|
||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
if (async) {
|
if (async && self.needReload) {
|
||||||
DoricSuperNode *node = self.superNode;
|
[self.superNode subNodeContentChanged:self];
|
||||||
while (node.superNode != nil) {
|
|
||||||
node = node.superNode;
|
|
||||||
}
|
|
||||||
[node requestLayout];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
@ -644,4 +634,15 @@ - (void)reset {
|
|||||||
self.blurEffectView = nil;
|
self.blurEffectView = nil;
|
||||||
self.view.contentMode = UIViewContentModeScaleAspectFill;
|
self.view.contentMode = UIViewContentModeScaleAspectFill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)needReload {
|
||||||
|
if (self.view.doricLayout.widthSpec == DoricLayoutFit
|
||||||
|
|| self.view.doricLayout.heightSpec == DoricLayoutFit) {
|
||||||
|
CGSize size = [self.view sizeThatFits:self.view.bounds.size];
|
||||||
|
if (!CGSizeEqualToSize(size, self.view.bounds.size)) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -488,4 +488,8 @@ - (void)reset {
|
|||||||
self.loadMore = NO;
|
self.loadMore = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)subNodeContentChanged:(DoricViewNode *)subNode {
|
||||||
|
[subNode.view.doricLayout apply];
|
||||||
|
[super subNodeContentChanged:subNode];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -314,4 +314,9 @@ - (void)reset {
|
|||||||
self.propRenderPageFuncId = nil;
|
self.propRenderPageFuncId = nil;
|
||||||
self.renderPageFuncId = nil;
|
self.renderPageFuncId = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)subNodeContentChanged:(DoricViewNode *)subNode {
|
||||||
|
[subNode.view.doricLayout apply];
|
||||||
|
[super subNodeContentChanged:subNode];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -40,4 +40,6 @@
|
|||||||
- (void)recursiveMixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)targetModel;
|
- (void)recursiveMixin:(NSDictionary *)srcModel to:(NSMutableDictionary *)targetModel;
|
||||||
|
|
||||||
- (NSArray *)getSubNodeViewIds;
|
- (NSArray *)getSubNodeViewIds;
|
||||||
|
|
||||||
|
- (void)subNodeContentChanged:(DoricViewNode *)subNode;
|
||||||
@end
|
@end
|
||||||
|
@ -152,6 +152,15 @@ - (void)reset {
|
|||||||
for (NSString *viewId in self.subNodes.allKeys) {
|
for (NSString *viewId in self.subNodes.allKeys) {
|
||||||
[[self subNodeWithViewId:viewId] reset];
|
[[self subNodeWithViewId:viewId] reset];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)subNodeContentChanged:(DoricViewNode *)subNode {
|
||||||
|
if (self.superNode
|
||||||
|
&& (self.view.doricLayout.widthSpec == DoricLayoutFit
|
||||||
|
|| self.view.doricLayout.heightSpec == DoricLayoutFit)) {
|
||||||
|
[self.superNode subNodeContentChanged:self];
|
||||||
|
} else {
|
||||||
|
[self requestLayout];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user