iOS:Fix ListNode cannot measure content height properly
This commit is contained in:
@@ -296,6 +296,13 @@ - (void)callItem:(NSUInteger)position size:(CGSize)size {
|
||||
return;
|
||||
}
|
||||
self.itemSizeInfo[@(position)] = [NSValue valueWithCGSize:size];
|
||||
if (self.view.doricLayout.widthSpec == DoricLayoutFit || self.view.doricLayout.heightSpec == DoricLayoutFit) {
|
||||
DoricSuperNode *node = self.superNode;
|
||||
while (node.superNode != nil) {
|
||||
node = node.superNode;
|
||||
}
|
||||
[node requestLayout];
|
||||
}
|
||||
[self.view.collectionViewLayout invalidateLayout];
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,9 @@ @interface DoricTableView : UITableView
|
||||
@end
|
||||
|
||||
@implementation DoricTableView
|
||||
- (CGSize)sizeThatFits:(CGSize)size {
|
||||
return [super sizeThatFits:size];
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@@ -232,7 +235,7 @@ - (void)blendSubNode:(NSDictionary *)subModel {
|
||||
@try {
|
||||
[self.view reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
@catch(id exception) {
|
||||
@catch (id exception) {
|
||||
[self.doricContext.driver.registry onException:exception inContext:self.doricContext];
|
||||
}
|
||||
}];
|
||||
@@ -251,6 +254,13 @@ - (void)callItem:(NSUInteger)position height:(CGFloat)height {
|
||||
self.itemHeights[@(position)] = @(height);
|
||||
if (@available(iOS 10.0, *)) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.view.doricLayout.heightSpec == DoricLayoutFit) {
|
||||
DoricSuperNode *node = self.superNode;
|
||||
while (node.superNode != nil) {
|
||||
node = node.superNode;
|
||||
}
|
||||
[node requestLayout];
|
||||
}
|
||||
[UIView performWithoutAnimation:^{
|
||||
NSUInteger itemCount = self.itemCount + (self.loadMore ? 1 : 0);
|
||||
if (itemCount <= position || currentCount != itemCount) {
|
||||
@@ -261,13 +271,20 @@ - (void)callItem:(NSUInteger)position height:(CGFloat)height {
|
||||
@try {
|
||||
[self.view reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
@catch(id exception) {
|
||||
@catch (id exception) {
|
||||
[self.doricContext.driver.registry onException:exception inContext:self.doricContext];
|
||||
}
|
||||
}];
|
||||
});
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.view.doricLayout.heightSpec == DoricLayoutFit) {
|
||||
DoricSuperNode *node = self.superNode;
|
||||
while (node.superNode != nil) {
|
||||
node = node.superNode;
|
||||
}
|
||||
[node requestLayout];
|
||||
}
|
||||
[self.view reloadData];
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user