Skip to content

Commit 5f900cf

Browse files
committed
fix(android): peaking/spacing not updating on layout change (% values)
1 parent 8382fdc commit 5f900cf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ui-pager/index.android.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ export class Pager extends PagerBase {
8585
}
8686

8787
public initNativeView() {
88+
this.on(View.layoutChangedEvent, this.onLayoutChange, this);
8889
super.initNativeView();
8990
const nativeView = this.nativeViewProtected;
9091
initPagerRecyclerAdapter();
9192
this._pagerAdapter = new PagerRecyclerAdapter(new WeakRef(this));
9293
this.compositeTransformer = new androidx.viewpager2.widget.CompositePageTransformer();
9394
nativeView.setPageTransformer(this.compositeTransformer);
9495
nativeView.setUserInputEnabled(!this.disableSwipe);
95-
this.on(View.layoutChangedEvent, this.onLayoutChange, this);
9696
// Store disable animation value
9797
this._oldDisableAnimation = this.disableAnimation;
9898
// Disable animation to set currentItem w/o animation
@@ -153,10 +153,10 @@ export class Pager extends PagerBase {
153153
this.initStaticPagerAdapter();
154154
}
155155
onLayoutChange(args: any) {
156-
if (this._lastPeaking) {
156+
if (this.peaking) {
157157
this[peakingProperty.setNative](this.peaking);
158158
}
159-
if (this._lastSpacing) {
159+
if (this.spacing) {
160160
this[spacingProperty.setNative](this.spacing);
161161
}
162162
// this._setTransformers(this.transformers ? this.transformers : '');
@@ -182,6 +182,7 @@ export class Pager extends PagerBase {
182182
}
183183
}
184184
this._lastSpacing = size;
185+
this.refresh();
185186
}
186187
}
187188

@@ -201,6 +202,7 @@ export class Pager extends PagerBase {
201202
this.compositeTransformer.addTransformer(this.peakingTransformer);
202203
}
203204
this._lastPeaking = size;
205+
this.refresh();
204206
}
205207
}
206208

0 commit comments

Comments
 (0)