Fix corner case bug in ListView
Reviewed By: sahrens Differential Revision: D2802885 fb-gh-sync-id: e4bb82e3c63ded2af46f5b078b712636d3afa156
This commit is contained in:
parent
bd3ef4315f
commit
b75c939d59
|
@ -294,13 +294,22 @@ var ListView = React.createClass({
|
||||||
componentWillReceiveProps: function(nextProps) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
if (this.props.dataSource !== nextProps.dataSource) {
|
if (this.props.dataSource !== nextProps.dataSource) {
|
||||||
this.setState((state, props) => {
|
this.setState((state, props) => {
|
||||||
var rowsToRender = Math.min(
|
|
||||||
state.curRenderedRowsCount + props.pageSize,
|
|
||||||
props.dataSource.getRowCount()
|
|
||||||
);
|
|
||||||
this._prevRenderedRowsCount = 0;
|
this._prevRenderedRowsCount = 0;
|
||||||
return {
|
return {
|
||||||
curRenderedRowsCount: rowsToRender,
|
curRenderedRowsCount: Math.min(
|
||||||
|
state.curRenderedRowsCount + props.pageSize,
|
||||||
|
props.dataSource.getRowCount()
|
||||||
|
),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (this.props.initialListSize !== nextProps.initialListSize) {
|
||||||
|
this.setState((state, props) => {
|
||||||
|
return {
|
||||||
|
curRenderedRowsCount: Math.max(
|
||||||
|
state.curRenderedRowsCount,
|
||||||
|
props.initialListSize
|
||||||
|
),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue