Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
groteworld committed Apr 17, 2023
1 parent 583a66f commit 853ba8e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,15 @@ const ScrollableTabView = createReactClass({
},

componentDidUpdate(prevProps) {
const currentPage = this.state.currentPage;
if (this.props.children !== prevProps.children) {
this.updateSceneKeys({ page: this.state.currentPage, children: this.props.children, });
if (currentPage >= props.children.length) {
currentPage = 0;
}
this.updateSceneKeys({ page: currentPage, children: props.children, });
}

if (this.props.page >= 0 && this.props.page !== this.state.currentPage) {
if (this.props.page >= 0 && this.props.page !== currentPage) {
this.goToPage(this.props.page);
}
},
Expand Down

0 comments on commit 853ba8e

Please sign in to comment.