Skip to content

Commit 691af12

Browse files
author
farfromrefug
committed
fix(android): reqestTransform option for scrollToIndexAnimated
1 parent 0057665 commit 691af12

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/ui-pager/index.android.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export class Pager extends PagerBase {
424424
}
425425
}
426426

427-
public scrollToIndexAnimated(index: number, animate: boolean) {
427+
public scrollToIndexAnimated(index: number, animate: boolean, requestTransform = false) {
428428
const nativeView = this.nativeViewProtected;
429429
if (nativeView) {
430430
nativeView.setCurrentItem(this.pagerAdapter.getIndex(index), animate);
@@ -435,6 +435,11 @@ export class Pager extends PagerBase {
435435
this.indicator.setSelection(index, false);
436436
}
437437
}
438+
if (requestTransform) {
439+
setTimeout(() => {
440+
nativeView.requestTransform();
441+
}, 0);
442+
}
438443
}
439444
}
440445

src/ui-pager/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export declare class Pager extends PagerBase {
1212
readonly android: any;
1313
readonly ios: any;
1414

15-
scrollToIndexAnimated(index: number, animate: boolean): void;
15+
scrollToIndexAnimated(index: number, animate: boolean, requestTransform?: boolean): void;
1616

1717
eachChildView(callback: (child: View) => boolean): void;
1818

0 commit comments

Comments
 (0)