Skip to content

Commit 2a907e3

Browse files
authored
Do not notify the user onPageChange for the fake page (fix autoscroll on Android bug) (#994)
1 parent 18b761b commit 2a907e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/carousel/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,12 @@ class Carousel extends Component {
326326
const {currentStandingPage, currentPage} = this.state;
327327
const index = this.getCalcIndex(currentPage);
328328

329-
this.setState({currentStandingPage: index});
330-
if (currentStandingPage !== index) {
331-
_.invoke(this.props, 'onChangePage', index, currentStandingPage);
329+
const pagesCount = presenter.getChildrenLength(this.props);
330+
if (index < pagesCount) {
331+
this.setState({currentStandingPage: index});
332+
if (currentStandingPage !== index) {
333+
_.invoke(this.props, 'onChangePage', index, currentStandingPage);
334+
}
332335
}
333336
};
334337

0 commit comments

Comments
 (0)