Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions packages/react-native/ReactNativeApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<20bbe8284af4b8863a39651a46b7a53a>>
* @generated SignedSource<<e1e5d049dbe6ac83cba9346adb38c71b>>
*
* This file was generated by scripts/js-api/build-types/index.js.
*/
Expand Down Expand Up @@ -3406,7 +3406,6 @@ declare type OptionalSectionListProps<ItemT, SectionT = DefaultSectionT> = {
declare type OptionalVirtualizedListProps = {
CellRendererComponent?: React.ComponentType<CellRendererProps<Item>>
debug?: boolean
disableVirtualization?: boolean
extraData?: any
horizontal?: boolean
initialNumToRender?: number
Expand Down Expand Up @@ -5919,7 +5918,7 @@ export {
AlertOptions, // a0cdac0f
AlertType, // 5ab91217
AndroidKeyboardEvent, // e03becc8
Animated, // 1ac00401
Animated, // a3d1d649
AppConfig, // 35c0ca70
AppRegistry, // 7ef8e53a
AppState, // 12012be5
Expand Down Expand Up @@ -5969,9 +5968,9 @@ export {
EventSubscription, // b8d084aa
ExtendedExceptionData, // 5a6ccf5a
FilterFunction, // bf24c0e3
FlatList, // b5cfde24
FlatListInstance, // 8f76f3b2
FlatListProps, // 3725656d
FlatList, // cc8679e2
FlatListInstance, // 64354e60
FlatListProps, // 10085d10
FocusEvent, // 850f1517
FontVariant, // 7c7558bb
GestureResponderEvent, // 14d3e77a
Expand Down Expand Up @@ -6119,10 +6118,10 @@ export {
ScrollViewPropsIOS, // da991b9a
ScrollViewScrollToOptions, // 3313411e
SectionBase, // dca83594
SectionList, // 626263b4
SectionList, // 2c5dc428
SectionListData, // e0d79987
SectionListInstance, // 019cdaef
SectionListProps, // 4cb9dfa9
SectionListInstance, // f94c3498
SectionListProps, // 9bd7f8d1
SectionListRenderItem, // 466e3e87
SectionListRenderItemInfo, // d809238e
Separators, // 6a45f7e3
Expand Down Expand Up @@ -6196,10 +6195,10 @@ export {
VirtualViewMode, // 6be59722
VirtualizedList, // 68c7345e
VirtualizedListInstance, // 423ee7c0
VirtualizedListProps, // 29367911
VirtualizedListProps, // 14094746
VirtualizedSectionList, // 9fd9cd61
VirtualizedSectionListInstance, // 12b706d5
VirtualizedSectionListProps, // 6b9d9c05
VirtualizedSectionListProps, // bb4c282f
WrapperComponentProvider, // 4b8c7962
codegenNativeCommands, // 628a7c0a
codegenNativeComponent, // 32a1bca6
Expand Down
8 changes: 0 additions & 8 deletions packages/rn-tester/js/examples/FlatList/FlatList-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ type State = {
filterText: string,
fixedHeight: boolean,
logViewable: boolean,
virtualized: boolean,
empty: boolean,
useFlatListItemComponent: boolean,
fadingEdgeLength: number,
Expand All @@ -89,7 +88,6 @@ class FlatListExample extends React.PureComponent<Props, State> {
filterText: '',
fixedHeight: true,
logViewable: false,
virtualized: true,
empty: false,
useFlatListItemComponent: false,
fadingEdgeLength: 0,
Expand Down Expand Up @@ -166,11 +164,6 @@ class FlatListExample extends React.PureComponent<Props, State> {
/>
</View>
<View style={styles.options}>
{renderSmallSwitchOption(
'Virtualized',
this.state.virtualized,
this._setBooleanValue('virtualized'),
)}
{renderSmallSwitchOption(
'Horizontal',
this.state.horizontal,
Expand Down Expand Up @@ -260,7 +253,6 @@ class FlatListExample extends React.PureComponent<Props, State> {
// $FlowFixMe[missing-empty-array-annot]
data={this.state.empty ? [] : filteredData}
debug={this.state.debug}
disableVirtualization={!this.state.virtualized}
getItemLayout={
this.state.fixedHeight ? this._getItemLayout : undefined
}
Expand Down
10 changes: 0 additions & 10 deletions packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ component MultiColumnExample() {
const [fixedHeight, setFixedHeight] = useState(true);
const [logViewable, setLogViewable] = useState(false);
const [numColumns, setNumColumns] = useState(2);
const [virtualized, setVirtualized] = useState(true);

const _onChangeFilterText = (_filterText: string) => {
setFilterText(_filterText);
Expand All @@ -48,9 +47,6 @@ component MultiColumnExample() {

const _setBooleanValue = (key: string) => (value: boolean) => {
switch (key) {
case 'virtualized':
setVirtualized(value);
break;
case 'fixedHeight':
setFixedHeight(value);
break;
Expand Down Expand Up @@ -138,11 +134,6 @@ component MultiColumnExample() {
/>
</View>
<View style={styles.row}>
{renderSmallSwitchOption(
'Virtualized',
virtualized,
_setBooleanValue('virtualized'),
)}
{renderSmallSwitchOption(
'Fixed Height',
fixedHeight,
Expand All @@ -168,7 +159,6 @@ component MultiColumnExample() {
}
refreshing={false}
renderItem={_renderItemComponent}
disableVirtualization={virtualized}
onViewableItemsChanged={_onViewableItemsChanged}
/>
</RNTesterPage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export component SectionList_scrollable() {
{useNativeDriver: true},
);
const [filterText, setFilterText] = useState('');
const [virtualized, setVirtualized] = useState(true);
const [logViewable, setLogViewable] = useState(false);
const [debug, setDebug] = useState(false);
const [inverted, setInverted] = useState(false);
Expand Down Expand Up @@ -253,7 +252,6 @@ export component SectionList_scrollable() {
value={filterText}
/>
<View style={styles.optionSection}>
{renderSmallSwitchOption('Virtualized', virtualized, setVirtualized)}
{renderSmallSwitchOption('Log Viewable', logViewable, setLogViewable)}
{renderSmallSwitchOption('Debug', debug, setDebug)}
{renderSmallSwitchOption('Inverted', inverted, setInverted)}
Expand Down Expand Up @@ -299,7 +297,6 @@ export component SectionList_scrollable() {
accessibilityRole="list"
debug={debug}
inverted={inverted}
disableVirtualization={!virtualized}
onRefresh={() => Alert.alert('onRefresh: nothing to refresh :P')}
onScroll={scrollSinkY}
onViewableItemsChanged={onViewableItemsChanged}
Expand Down
7 changes: 0 additions & 7 deletions packages/virtualized-lists/Lists/VirtualizedList.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,6 @@ export interface VirtualizedListWithoutRenderItemProps<ItemT>
*/
debug?: boolean | undefined;

/**
* DEPRECATED: Virtualization provides significant performance and memory optimizations, but fully
* unmounts react instances that are outside of the render window. You should only need to disable
* this for debugging purposes.
*/
disableVirtualization?: boolean | undefined;

/**
* A marker property for telling the list to re-render (since it implements `PureComponent`). If
* any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the
Expand Down
66 changes: 20 additions & 46 deletions packages/virtualized-lists/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,8 @@ class VirtualizedList extends StateSafePureComponent<
pendingScrollUpdateCount: number,
): {first: number, last: number} {
const {data, getItemCount} = props;
const onEndReachedThreshold = onEndReachedThresholdOrDefault(
props.onEndReachedThreshold,
);
const {offset, visibleLength} = this._scrollMetrics;
const {visibleLength} = this._scrollMetrics;
const contentLength = this._listMetrics.getContentLength();
const distanceFromEnd = contentLength - visibleLength - offset;

// Wait until the scroll view metrics have been set up. And until then,
// we will trust the initialNumToRender suggestion
Expand All @@ -624,43 +620,27 @@ class VirtualizedList extends StateSafePureComponent<
: cellsAroundViewport;
}

let newCellsAroundViewport: {first: number, last: number};
if (props.disableVirtualization) {
const renderAhead =
distanceFromEnd < onEndReachedThreshold * visibleLength
? maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch)
: 0;

newCellsAroundViewport = {
first: 0,
last: Math.min(
cellsAroundViewport.last + renderAhead,
getItemCount(data) - 1,
),
};
} else {
// If we have a pending scroll update, we should not adjust the render window as it
// might override the correct window.
if (pendingScrollUpdateCount > 0) {
return cellsAroundViewport.last >= getItemCount(data)
? VirtualizedList._constrainToItemCount(cellsAroundViewport, props)
: cellsAroundViewport;
}

newCellsAroundViewport = computeWindowedRenderLimits(
props,
maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch),
windowSizeOrDefault(props.windowSize),
cellsAroundViewport,
this._listMetrics,
this._scrollMetrics,
);
invariant(
newCellsAroundViewport.last < getItemCount(data),
'computeWindowedRenderLimits() should return range in-bounds',
);
// If we have a pending scroll update, we should not adjust the render window as it
// might override the correct window.
if (pendingScrollUpdateCount > 0) {
return cellsAroundViewport.last >= getItemCount(data)
? VirtualizedList._constrainToItemCount(cellsAroundViewport, props)
: cellsAroundViewport;
}

const newCellsAroundViewport = computeWindowedRenderLimits(
props,
maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch),
windowSizeOrDefault(props.windowSize),
cellsAroundViewport,
this._listMetrics,
this._scrollMetrics,
);
invariant(
newCellsAroundViewport.last < getItemCount(data),
'computeWindowedRenderLimits() should return range in-bounds',
);

if (this._nestedChildLists.size() > 0) {
// If some cell in the new state has a child list in it, we should only render
// up through that item, so that we give that list a chance to render.
Expand Down Expand Up @@ -1015,12 +995,6 @@ class VirtualizedList extends StateSafePureComponent<

for (const section of renderRegions) {
if (section.isSpacer) {
// Legacy behavior is to avoid spacers when virtualization is
// disabled (including head spacers on initial render).
if (this.props.disableVirtualization) {
continue;
}

// Without getItemLayout, we limit our tail spacer to the _highestMeasuredFrameIndex to
// prevent the user for hyperscrolling into un-measured area because otherwise content will
// likely jump around as it renders in above the viewport.
Expand Down
6 changes: 0 additions & 6 deletions packages/virtualized-lists/Lists/VirtualizedListProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ type OptionalVirtualizedListProps = {
* implementation, but with a significant perf hit.
*/
debug?: ?boolean,
/**
* DEPRECATED: Virtualization provides significant performance and memory optimizations, but fully
* unmounts react instances that are outside of the render window. You should only need to disable
* this for debugging purposes. Defaults to false.
*/
disableVirtualization?: ?boolean,
/**
* A marker property for telling the list to re-render (since it implements `PureComponent`). If
* any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the
Expand Down
Loading
Loading