@nativescript-community/ui-collectionview 5.3.17 → 5.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +2 -2
- package/platforms/ios/src/Info.plist +0 -0
- package/platforms/ios/src/NSCollectionView.h +2 -0
- package/platforms/ios/src/UICollectionViewCacheDelegateFlowLayout.h +6 -0
- package/platforms/ios/src/UICollectionViewCacheDelegateFlowLayout.m +36 -0
- package/platforms/ios/src/module.modulemap +5 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [5.3.18](https://github.com/nativescript-community/ui-collectionview/compare/v5.3.17...v5.3.18) (2024-02-06)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-collectionview
|
9
|
+
|
6
10
|
## [5.3.17](https://github.com/nativescript-community/ui-collectionview/compare/v5.3.16...v5.3.17) (2024-02-06)
|
7
11
|
|
8
12
|
**Note:** Version bump only for package @nativescript-community/ui-collectionview
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-collectionview",
|
3
|
-
"version": "5.3.
|
3
|
+
"version": "5.3.18",
|
4
4
|
"description": "Allows you to easily add a collection view (grid list view) to your projects. Supports vertical and horizontal modes, templating, and more.",
|
5
5
|
"main": "./index",
|
6
6
|
"sideEffects": false,
|
@@ -48,5 +48,5 @@
|
|
48
48
|
},
|
49
49
|
"license": "Apache-2.0",
|
50
50
|
"readmeFilename": "README.md",
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "0b4bc5be87f69aec9f33d05cd62a74f0ffd1a881"
|
52
52
|
}
|
Binary file
|
@@ -0,0 +1,6 @@
|
|
1
|
+
@interface UICollectionViewCacheDelegateFlowLayout: NSObject <UICollectionViewDelegateFlowLayout>
|
2
|
+
|
3
|
+
@property (nonatomic, retain) NSMutableArray* cachedSizes;
|
4
|
+
|
5
|
+
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout computedSizeForItemAtIndexPath:(NSIndexPath *)indexPath;
|
6
|
+
@end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#import "UICollectionViewCacheDelegateFlowLayout.h"
|
2
|
+
|
3
|
+
@implementation UICollectionViewCacheDelegateFlowLayout
|
4
|
+
@synthesize cachedSizes;
|
5
|
+
- (instancetype)init
|
6
|
+
{
|
7
|
+
self = [super init];
|
8
|
+
if (self) {
|
9
|
+
self.cachedSizes = [NSMutableArray new];
|
10
|
+
}
|
11
|
+
return self;
|
12
|
+
}
|
13
|
+
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout computedSizeForItemAtIndexPath:(NSIndexPath *)indexPath
|
14
|
+
{
|
15
|
+
return CGSizeZero;
|
16
|
+
}
|
17
|
+
|
18
|
+
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
|
19
|
+
{
|
20
|
+
NSInteger index = indexPath.row;
|
21
|
+
if (index < [self.cachedSizes count]) {
|
22
|
+
NSValue* value = [self.cachedSizes objectAtIndex:indexPath.row];
|
23
|
+
if (value != nil && !CGSizeEqualToSize([value CGSizeValue], CGSizeZero)) {
|
24
|
+
return [value CGSizeValue];
|
25
|
+
}
|
26
|
+
CGSize size = [self collectionView:collectionView layout:collectionViewLayout computedSizeForItemAtIndexPath:indexPath];
|
27
|
+
[self.cachedSizes replaceObjectAtIndex:indexPath.row withObject:[NSValue valueWithCGSize:size]];
|
28
|
+
return size;
|
29
|
+
} else {
|
30
|
+
CGSize size = [self collectionView:collectionView layout:collectionViewLayout computedSizeForItemAtIndexPath:indexPath];
|
31
|
+
[self.cachedSizes addObject:[NSValue valueWithCGSize:size]];
|
32
|
+
return size;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
@end
|