iOS:Fix ListNode cannot measure content height properly
This commit is contained in:
parent
4873ff535d
commit
b762b9db4b
@ -50,9 +50,9 @@ class ListVH extends ViewHolder {
|
||||
itemCount: 0,
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.MOST,
|
||||
heightSpec: LayoutSpec.JUST,
|
||||
weight: 1
|
||||
heightSpec: LayoutSpec.FIT,
|
||||
},
|
||||
backgroundColor: Color.YELLOW,
|
||||
})
|
||||
],
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
||||
@ -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) {
|
||||
@ -268,6 +278,13 @@ - (void)callItem:(NSUInteger)position height:(CGFloat)height {
|
||||
});
|
||||
} 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