mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-17 23:04:40 +08:00
useful error when switching numColumns on the fly
Reviewed By: blairvanderhoof, bvaughn Differential Revision: D4742842 fbshipit-source-id: a11a088194ead02cc11eb6ccd9ce6d6f75ead3a3
This commit is contained in:
committed by
Facebook Github Bot
parent
1531f5f284
commit
46d6766a53
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user