Skip to content

Commit ef1877b

Browse files
authored
Merge pull request ptomasroos#362 from ghuh/fix-width-on-new-tabs
A change in tabs can produce display issues.
2 parents 75360db + 601090d commit ef1877b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ScrollableTabBar.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ const ScrollableTabBar = React.createClass({
190190
</View>;
191191
},
192192

193+
componentWillReceiveProps(nextProps) {
194+
// If the tabs change, force the width of the tabs container to be recalculated
195+
if (JSON.stringify(this.props.tabs) != JSON.stringify(nextProps.tabs) && this.state._containerWidth) {
196+
this.setState({ _containerWidth: null, });
197+
}
198+
},
199+
193200
onTabContainerLayout(e) {
194201
this._tabContainerMeasurements = e.nativeEvent.layout;
195202
let width = this._tabContainerMeasurements.width;

0 commit comments

Comments
 (0)