Skip to content

Commit

Permalink
useful error when switching numColumns on the fly
Browse files Browse the repository at this point in the history
Reviewed By: blairvanderhoof, bvaughn

Differential Revision: D4742842

fbshipit-source-id: a11a088194ead02cc11eb6ccd9ce6d6f75ead3a3
  • Loading branch information
sahrens authored and facebook-github-bot committed Mar 22, 2017
1 parent 1531f5f commit 46d6766
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Libraries/CustomComponents/Lists/FlatList.js
Expand Up @@ -242,6 +242,11 @@ class FlatList<ItemT> extends React.PureComponent<DefaultProps, Props<ItemT>, vo
}

componentWillReceiveProps(nextProps: Props<ItemT>) {
invariant(
nextProps.numColumns === this.props.numColumns,
'Changing numColumns on the fly is not supported. Change the key prop on FlatList when ' +
'changing the number of columns to force a fresh render of the component.'
);
this._checkProps(nextProps);
}

Expand Down

0 comments on commit 46d6766

Please sign in to comment.