@@ -79,8 +79,8 @@ export class Pager extends PagerBase {
79
79
mIsRefreshing : boolean = false ;
80
80
mIsInit : boolean = false ;
81
81
82
- public mInnerWidth : number = 0 ;
83
- public mInnerHeight : number = 0 ;
82
+ // public mInnerWidth: number = 0;
83
+ // public mInnerHeight: number = 0;
84
84
mLastLayoutKey : string ;
85
85
86
86
constructor ( ) {
@@ -451,7 +451,7 @@ export class Pager extends PagerBase {
451
451
return ;
452
452
}
453
453
this . _isDataDirty = false ;
454
- this . mLastLayoutKey = this . mInnerWidth + '_' + this . mInnerHeight ;
454
+ this . mLastLayoutKey = this . _effectiveItemWidth + '_' + this . _effectiveItemHeight ;
455
455
456
456
// clear bindingContext when it is not observable because otherwise bindings to items won't reevaluate
457
457
this . mMap . forEach ( ( view , nativeView , map ) => {
@@ -477,7 +477,7 @@ export class Pager extends PagerBase {
477
477
_isDataDirty = false ;
478
478
public onLoaded ( ) {
479
479
super . onLoaded ( ) ;
480
- if ( this . _isDataDirty && this . mInnerWidth !== undefined && this . mInnerHeight !== undefined ) {
480
+ if ( this . _isDataDirty && this . _effectiveItemWidth !== undefined && this . _effectiveItemHeight !== undefined ) {
481
481
this . refresh ( ) ;
482
482
}
483
483
@@ -604,15 +604,13 @@ export class Pager extends PagerBase {
604
604
} ) ;
605
605
}
606
606
iosOverflowSafeAreaEnabledLayoutHackNeeded = true ;
607
- protected updateInnerSize ( ) {
608
- const width = this . getMeasuredWidth ( ) ;
609
- const height = this . getMeasuredHeight ( ) ;
610
- this . mInnerWidth = width - this . effectivePaddingLeft - this . effectivePaddingRight ;
611
- this . mInnerHeight = height - this . effectivePaddingTop - this . effectivePaddingBottom ;
612
- }
607
+
613
608
public onLayout ( left : number , top : number , right : number , bottom : number ) {
614
609
super . onLayout ( left , top , right , bottom ) ;
615
- this . updateInnerSize ( ) ;
610
+ if ( this . iosOverflowSafeAreaEnabled ) {
611
+ const safeArea = this . getSafeAreaInsets ( ) ;
612
+ this . _effectiveItemHeight += safeArea . top + safeArea . bottom ;
613
+ }
616
614
if ( ! this . nativeView ) {
617
615
return ;
618
616
}
@@ -625,15 +623,15 @@ export class Pager extends PagerBase {
625
623
layoutView . invalidateLayout ( ) ;
626
624
627
625
const size = this . _getSize ( ) ;
626
+ const width = Utils . layout . toDevicePixels ( size . width ) ;
627
+ const height = Utils . layout . toDevicePixels ( size . height ) ;
628
628
this . mMap . forEach ( ( childView , pagerCell ) => {
629
- const width = Utils . layout . toDevicePixels ( size . width ) ;
630
- const height = Utils . layout . toDevicePixels ( size . height ) ;
631
629
View . layoutChild ( this , childView , 0 , 0 , width , height ) ;
632
630
} ) ;
633
631
634
632
// there is no need to call refresh if it was triggered before with same size.
635
633
// this refresh is just to handle size change
636
- const layoutKey = this . mInnerWidth + '_' + this . mInnerHeight ;
634
+ const layoutKey = this . _effectiveItemWidth + '_' + this . _effectiveItemHeight ;
637
635
if ( this . mLastLayoutKey !== layoutKey ) {
638
636
this . refresh ( ) ;
639
637
}
@@ -974,7 +972,6 @@ class UICollectionDelegateImpl extends NSObject implements UICollectionViewDeleg
974
972
scrollView.contentOffset = CGPointMake(Math.ceil(w) * page, scrollView.contentOffset.y);
975
973
}
976
974
};
977
- console.log('page', page, owner.itemCount, page === owner.itemCount);
978
975
if (page === 0) {
979
976
page = owner.itemCount - 2;
980
977
doScroll();
0 commit comments