Skip to content

Commit 68bdf62

Browse files
Manfred Xuptomasroos
authored andcommitted
Use componentDidUpdate (#1037)
1 parent a386010 commit 68bdf62

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ScrollableTabBar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ const ScrollableTabBar = createReactClass({
193193
</View>;
194194
},
195195

196-
componentWillReceiveProps(nextProps) {
196+
componentDidUpdate(prevProps) {
197197
// If the tabs change, force the width of the tabs container to be recalculated
198-
if (JSON.stringify(this.props.tabs) !== JSON.stringify(nextProps.tabs) && this.state._containerWidth) {
198+
if (JSON.stringify(prevProps.tabs) !== JSON.stringify(this.props.tabs) && this.state._containerWidth) {
199199
this.setState({ _containerWidth: null, });
200200
}
201201
},

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ const ScrollableTabView = createReactClass({
107107
};
108108
},
109109

110-
componentWillReceiveProps(props) {
111-
if (props.children !== this.props.children) {
112-
this.updateSceneKeys({ page: this.state.currentPage, children: props.children, });
110+
componentDidUpdate(prevProps) {
111+
if (this.props.children !== prevProps.children) {
112+
this.updateSceneKeys({ page: this.state.currentPage, children: this.props.children, });
113113
}
114114

115-
if (props.page >= 0 && props.page !== this.state.currentPage) {
116-
this.goToPage(props.page);
115+
if (this.props.page >= 0 && this.props.page !== this.state.currentPage) {
116+
this.goToPage(this.props.page);
117117
}
118118
},
119119

0 commit comments

Comments
 (0)