File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -107,9 +107,9 @@ export default class Carousel extends BaseComponent {
107
107
108
108
onOrientationChanged = ( ) => {
109
109
if ( ! this . props . pageWidth || this . props . loop ) {
110
+ this . orientationChange = true ;
110
111
// HACK: setting to containerWidth for Android's call when view disappear
111
112
this . setState ( { pageWidth : this . state . containerWidth || Constants . screenWidth } ) ;
112
- this . goToPage ( this . state . currentPage , true ) ;
113
113
}
114
114
} ;
115
115
@@ -205,8 +205,11 @@ export default class Carousel extends BaseComponent {
205
205
const offsetX = event . nativeEvent . contentOffset . x ;
206
206
207
207
if ( offsetX >= 0 ) {
208
- const newPage = presenter . calcPageIndex ( offsetX , this . props , pageWidth ) ;
209
- this . setState ( { currentPage : newPage } ) ;
208
+ if ( ! this . orientationChange ) { // Avoid new calculation on orientation change
209
+ const newPage = presenter . calcPageIndex ( offsetX , this . props , pageWidth ) ;
210
+ this . setState ( { currentPage : newPage } ) ;
211
+ }
212
+ this . orientationChange = false ;
210
213
}
211
214
212
215
if ( loop && presenter . isOutOfBounds ( offsetX , this . props , pageWidth ) ) {
You can’t perform that action at this time.
0 commit comments