Rework scroll management

Reviewed By: devknoll

Differential Revision: D3138464

fb-gh-sync-id: fd1bb7f623c689836ae52ea8bf384d8efccddfea
fbshipit-source-id: fd1bb7f623c689836ae52ea8bf384d8efccddfea
This commit is contained in:
Spencer Ahrens 2016-04-06 14:08:33 -07:00 committed by Facebook Github Bot 2
parent 41576eaa56
commit 06b2998de8
1 changed files with 6 additions and 0 deletions

View File

@ -154,6 +154,11 @@ type Props = {
* This determines how frequently events such as scroll and layout can trigger a re-render. * This determines how frequently events such as scroll and layout can trigger a re-render.
*/ */
recomputeRowsBatchingPeriod: number; recomputeRowsBatchingPeriod: number;
/**
* Called when rows will be mounted/unmounted. Mounted rows always form a contiguous block so it is expressed as a
* range of start plus count.
*/
onMountedRowsWillChange: (firstIdx: number, count: number) => void;
}; };
const defaultProps = { const defaultProps = {
enableDangerousRecycling: false, enableDangerousRecycling: false,
@ -368,6 +373,7 @@ class WindowedListView extends React.Component {
} }
} }
if (this.state.firstRow !== firstRow || this.state.lastRow !== lastRow) { if (this.state.firstRow !== firstRow || this.state.lastRow !== lastRow) {
this.props.onMountedRowsWillChange && this.props.onMountedRowsWillChange(firstRow, lastRow - firstRow + 1);
console.log('WLV: row render range changed:', {firstRow, lastRow}); console.log('WLV: row render range changed:', {firstRow, lastRow});
} }
this.setState({firstRow, lastRow}); this.setState({firstRow, lastRow});