@@ -171,11 +171,11 @@ export class CollectionView extends CollectionViewBase {
171171 p . onLayout && p . onLayout ( this , left , top , right , bottom ) ;
172172 } ) ;
173173
174- // const layoutView = this.nativeViewProtected.collectionViewLayout;
175- // if ((layoutView instanceof UICollectionViewFlowLayout && this._effectiveColWidth) || this._effectiveRowHeight) {
176- // // @ts -ignore
177- // layoutView.estimatedItemSize = layoutView.itemSize = CGSizeMake(layout.toDeviceIndependentPixels(this._effectiveColWidth), layout.toDeviceIndependentPixels(this._effectiveRowHeight));
178- // }
174+ const layoutView = this . nativeViewProtected . collectionViewLayout ;
175+ if ( ( layoutView instanceof UICollectionViewFlowLayout && this . _effectiveColWidth ) || this . _effectiveRowHeight ) {
176+ // @ts -ignore
177+ layoutView . estimatedItemSize = layoutView . itemSize = CGSizeMake ( layout . toDeviceIndependentPixels ( this . _effectiveColWidth ) , layout . toDeviceIndependentPixels ( this . _effectiveRowHeight ) ) ;
178+ }
179179 this . _map . forEach ( ( cellView , cell ) => {
180180 if ( Trace . isEnabled ( ) ) {
181181 CLog ( CLogTypes . log , 'onLayout' , 'cell' , cellView . _listViewItemIndex ) ;
@@ -432,24 +432,11 @@ export class CollectionView extends CollectionViewBase {
432432 this . _addView ( view ) ;
433433 cell . contentView . addSubview ( view . nativeViewProtected ) ;
434434 }
435- ( view as any ) . performLayout = ( ) => { } ;
436435 if ( needsLayout ) {
437436 view . requestLayout ( ) ;
438437 }
439438 cellSize = this . measureCell ( cell , view , indexPath ) ;
440439
441- //performlayout will ask the whole page to relayout which will break us as it goes downward
442- // and calls onLayout which layouts the cells ...
443- ( view as any ) . performLayout = ( ) => {
444- // this is really ugly!
445- console . log ( 'performLayout' , view . _listViewItemIndex , index ) ;
446- const widthSpec = layout . makeMeasureSpec ( cellSize [ 0 ] , layout . EXACTLY ) ;
447- const heightSpec = layout . makeMeasureSpec ( cellSize [ 1 ] , layout . EXACTLY ) ;
448- View . measureChild ( this , view , widthSpec , heightSpec ) ;
449- View . layoutChild ( this , view , 0 , 0 , cellSize [ 0 ] , cellSize [ 1 ] ) ;
450- console . log ( 'performLayout done ' , view . _listViewItemIndex , index ) ;
451- } ;
452-
453440 if ( Trace . isEnabled ( ) ) {
454441 CLog ( CLogTypes . log , '_prepareCell done' , index , cellSize ) ;
455442 }
0 commit comments