Skip to content

Commit 853ba8e

Browse files
committed
1 parent 583a66f commit 853ba8e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,15 @@ const ScrollableTabView = createReactClass({
116116
},
117117

118118
componentDidUpdate(prevProps) {
119+
const currentPage = this.state.currentPage;
119120
if (this.props.children !== prevProps.children) {
120-
this.updateSceneKeys({ page: this.state.currentPage, children: this.props.children, });
121+
if (currentPage >= props.children.length) {
122+
currentPage = 0;
123+
}
124+
this.updateSceneKeys({ page: currentPage, children: props.children, });
121125
}
122126

123-
if (this.props.page >= 0 && this.props.page !== this.state.currentPage) {
127+
if (this.props.page >= 0 && this.props.page !== currentPage) {
124128
this.goToPage(this.props.page);
125129
}
126130
},

0 commit comments

Comments
 (0)