INNER CODE UNIT · JavaScript
nextPage
phil-r/react-native-looped-carousel · index.js:121
const nextPage = currentPage >= childrenLength ? childrenLength - 1 : currentPage;
this.setState({ childrenLength }, () => {
this.animateToPage(nextPage);
this._setUpTimer();
});
}
}
_setUpPages() {
const { size } = this.state;
const { children: propsChildren, isLooped, pageStyle } = this.props;
const children = React.Children.toArray(propsChildren);
const pages = [];
if (children && children.length > 1) {
// add all pages
pages.push(...children);
// We want to make infinite pages structure like this: 1-2-3-1-2