Skip to content

Commit 3cf310b

Browse files
AsimPoptanigusgard
authored andcommitted
Fixed bug: Pagination is not correct sometimes on devices (#37)
1 parent c3948ee commit 3cf310b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/SwiperFlatList/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ export default class SwiperFlatList extends PureComponent {
130130
const { contentOffset, layoutMeasurement } = e.nativeEvent;
131131
let index;
132132
if (vertical) {
133-
index = Math.floor(contentOffset.y / layoutMeasurement.height);
133+
index = Math.round(contentOffset.y / layoutMeasurement.height);
134134
} else {
135135
// Divide the horizontal offset by the width of the view to see which page is visible
136-
index = Math.floor(contentOffset.x / layoutMeasurement.width);
136+
index = Math.round(contentOffset.x / layoutMeasurement.width);
137137
}
138138

139139
if (autoplay) {

0 commit comments

Comments
 (0)