Skip to content

Commit 7f6230f

Browse files
simonli92troZee
andauthored
fix(android): page margin issue (#273)
* Fix android orientation change page offset issue * fix: android Co-authored-by: Piotr Trocki <[email protected]>
1 parent e2b382f commit 7f6230f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

android/src/main/java/com/reactnativecommunity/viewpager/VerticalViewPager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ public boolean onTouchEvent(MotionEvent ev) {
8181
return result;
8282
}
8383

84+
// Handle orientation change
85+
// https://issuetracker.google.com/issues/36957831#comment7
86+
@Override
87+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
88+
super.onSizeChanged(w - this.getPageMargin(), h, oldw - this.getPageMargin(), oldh);
89+
}
90+
8491
private MotionEvent flipXY(MotionEvent ev) {
8592
if (mVertical) {
8693
final float width = getWidth();

0 commit comments

Comments
 (0)