File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,7 @@ class Carousel extends Component<CarouselProps, CarouselState> {
228
228
return index ;
229
229
}
230
230
231
+ // TODO: currently this returns pagesCount offsets, not starting from 0; look into changing this into (pagesCount - 1) or to have the 1st item as 0
231
232
getSnapToOffsets = ( ) : number [ ] | undefined => {
232
233
const { containerWidth, pageWidth} = this . state ;
233
234
@@ -251,7 +252,7 @@ class Carousel extends Component<CarouselProps, CarouselState> {
251
252
const { initialOffset} = this . state ;
252
253
let contentOffset = initialOffset ;
253
254
if ( snapToOffsets && initialPage !== undefined ) {
254
- const offset = snapToOffsets [ initialPage ] ;
255
+ const offset = initialPage === 0 ? 0 : snapToOffsets [ initialPage - 1 ] ;
255
256
contentOffset = {
256
257
x : horizontal ? offset : 0 ,
257
258
y : horizontal ? 0 : offset
You can’t perform that action at this time.
0 commit comments