set collection view size when ever reactSetFrame called

This commit is contained in:
Ran Greenberg 2016-07-10 18:14:22 +03:00
parent dc5e0b33ba
commit 70efcc83cb

View File

@ -88,11 +88,14 @@ static NSString * const CellReuseIdentifier = @"Cell";
-(void)reactSetFrame:(CGRect)frame {
[super reactSetFrame:frame];
//NSLog(@"### reactSetFrame #####");
if (CGRectIsEmpty(frame)) return;
if (!self.collectionView) {
//NSLog(@"### collection view create new#####");
UICollectionViewFlowLayout* flowLayout = [[UICollectionViewFlowLayout alloc] init];
flowLayout.itemSize = self.cellSize; //TODO remove this, get it from the JS
flowLayout.itemSize = self.cellSize;
[flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
self.collectionView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:flowLayout];
@ -104,6 +107,10 @@ static NSString * const CellReuseIdentifier = @"Cell";
self.collectionView.backgroundColor = [UIColor whiteColor];
}
else {
//NSLog(@"### collection view using exists #####");
self.collectionView.frame = self.bounds;
}
}