99 Property ,
1010 ProxyViewContainer ,
1111 Trace ,
12+ Utils ,
1213 View ,
1314 paddingBottomProperty ,
1415 paddingLeftProperty ,
@@ -25,6 +26,7 @@ export * from './collectionview-common';
2526const infinity = layout . makeMeasureSpec ( 0 , layout . UNSPECIFIED ) ;
2627
2728
29+
2830export enum ContentInsetAdjustmentBehavior {
2931 Always = UIScrollViewContentInsetAdjustmentBehavior . Always ,
3032 Automatic = UIScrollViewContentInsetAdjustmentBehavior . Automatic ,
@@ -39,7 +41,7 @@ function parseContentInsetAdjustmentBehavior(value: string | number) {
3941 return ContentInsetAdjustmentBehavior . Always ;
4042 case 'never' :
4143 return ContentInsetAdjustmentBehavior . Never ;
42- case 'ccrollableAxes ' :
44+ case 'scrollableAxes ' :
4345 return ContentInsetAdjustmentBehavior . ScrollableAxes ;
4446 default :
4547 case 'automatic' :
@@ -466,7 +468,15 @@ export class CollectionView extends CollectionViewBase {
466468
467469 if ( view && ! view . parent ) {
468470 this . _addView ( view ) ;
469- cell . contentView . addSubview ( view . nativeViewProtected ) ;
471+ if ( this . iosOverflowSafeArea ) {
472+ const innerView = UICellView . new ( ) as UICellView ;
473+ innerView . view = new WeakRef ( view ) ;
474+ innerView . addSubview ( view . nativeViewProtected ) ;
475+ cell . contentView . addSubview ( innerView ) ;
476+ } else {
477+ cell . contentView . addSubview ( view . nativeViewProtected ) ;
478+ }
479+
470480 }
471481 if ( needsLayout ) {
472482 view . requestLayout ( ) ;
@@ -543,10 +553,9 @@ export class CollectionView extends CollectionViewBase {
543553 }
544554 layoutCell ( index : number , cell : CollectionViewCell , cellView : View ) : any {
545555 const cellSize = this . getCellSize ( index ) ;
546- cellView . iosOverflowSafeAreaEnabled = false ;
547556 View . layoutChild ( this , cellView , 0 , 0 , cellSize [ 0 ] , cellSize [ 1 ] ) ;
548557 if ( Trace . isEnabled ( ) ) {
549- CLog ( CLogTypes . log , 'layoutCell' , index , cellView . getMeasuredWidth ( ) , cellView . getMeasuredHeight ( ) ) ;
558+ CLog ( CLogTypes . log , 'layoutCell' , index , cellView , cellView . getMeasuredWidth ( ) , cellView . getMeasuredHeight ( ) ) ;
550559 }
551560 }
552561
@@ -619,7 +628,7 @@ export class CollectionView extends CollectionViewBase {
619628 this . _prepareCell ( cell , indexPath , templateType ) ;
620629
621630 const cellView : View = cell . view ;
622- if ( cellView && cellView [ 'isLayoutRequired' ] ) {
631+ if ( ! this . iosOverflowSafeArea && cellView && cellView [ 'isLayoutRequired' ] ) {
623632 this . layoutCell ( indexPath . row , cell , cellView ) ;
624633 }
625634 return cell ;
@@ -729,12 +738,25 @@ interface ViewItemIndex {
729738}
730739
731740type ItemView = View & ViewItemIndex ;
741+
742+ @NativeClass
743+ class UICellView extends UIView {
744+ view : WeakRef < View > ;
745+ layoutSubviews ( ) {
746+ const view = this . view && this . view . get ( ) ;
747+ if ( ! view ) {
748+ return ;
749+ }
750+ this . frame = this . superview . bounds ;
751+ const size = this . bounds . size ;
752+ View . layoutChild ( null , view , 0 , 0 , Utils . layout . toDevicePixels ( size . width ) , Utils . layout . toDevicePixels ( size . height ) ) ;
753+ }
754+ }
755+
732756@NativeClass
733757class CollectionViewCell extends UICollectionViewCell {
734758 owner : WeakRef < ItemView > ;
735- // static class() {
736- // return CollectionViewCell.class();
737- // }
759+
738760 get view ( ) : ItemView {
739761 return this . owner ? this . owner . get ( ) : null ;
740762 }
0 commit comments