diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index c3a72ab7a93157..85f22f2675cb59 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -76,7 +76,7 @@ type OptionalProps = { * unmounts react instances that are outside of the render window. You should only need to disable * this for debugging purposes. */ - disableVirtualization: boolean, + 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 @@ -705,7 +705,7 @@ class VirtualizedList extends React.PureComponent { }; _isVirtualizationDisabled(): boolean { - return this.props.disableVirtualization; + return this.props.disableVirtualization || false; } _isNestedWithSameOrientation(): boolean { diff --git a/Libraries/Lists/VirtualizedSectionList.js b/Libraries/Lists/VirtualizedSectionList.js index c1e76e1228f494..c52395954482ca 100644 --- a/Libraries/Lists/VirtualizedSectionList.js +++ b/Libraries/Lists/VirtualizedSectionList.js @@ -91,11 +91,11 @@ type OptionalProps = { */ ItemSeparatorComponent?: ?React.ComponentType, /** - * Warning: Virtualization can drastically improve memory consumption for long lists, but trashes - * the state of items when they scroll out of the render window, so make sure all relavent data is - * stored outside of the recursive `renderItem` instance tree. + * 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. */ - enableVirtualization?: ?boolean, + disableVirtualization?: ?boolean, keyExtractor: (item: Item, index: number) => string, onEndReached?: ?({distanceFromEnd: number}) => void, /** diff --git a/RNTester/js/SectionListExample.js b/RNTester/js/SectionListExample.js index be4179f7e6c120..455b1d36efcc0b 100644 --- a/RNTester/js/SectionListExample.js +++ b/RNTester/js/SectionListExample.js @@ -149,7 +149,7 @@ class SectionListExample extends React.PureComponent<{}, $FlowFixMeState> { )} debug={this.state.debug} inverted={this.state.inverted} - enableVirtualization={this.state.virtualized} + disableVirtualization={!this.state.virtualized} onRefresh={() => Alert.alert('onRefresh: nothing to refresh :P')} onScroll={this._scrollSinkY} onViewableItemsChanged={this._onViewableItemsChanged}