From 636d01bbd0b9a2e9617f8063713183a0a3a4d5fe Mon Sep 17 00:00:00 2001 From: Eli White Date: Tue, 9 Oct 2018 17:25:02 -0700 Subject: [PATCH] Remove legacyImplementation from FlatList and SectionList Summary: `legacyImplementation` has caused a warning in FlatList for a long time. FlatList supports the use cases of the legacy implementation and should be adopted. We will be removing the deprecated MetroListView and ListView components to reduce bundle sizes and the complexity of the codebase. Reviewed By: yungsters Differential Revision: D10245824 fbshipit-source-id: 60ff0d54974649b57bac9f9f29b769f34ca2701c --- Libraries/Lists/FlatList.js | 5 ++++- Libraries/Lists/SectionList.js | 9 +++++---- RNTester/js/FlatListExample.js | 1 - RNTester/js/MultiColumnExample.js | 1 - RNTester/js/RNTesterExampleList.js | 1 - 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 9719aff75f010c..eace682747649c 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -190,7 +190,10 @@ type OptionalProps = { * @platform android */ progressViewOffset?: number, - legacyImplementation?: ?boolean, + /** + * The legacy implementation is no longer supported. + */ + legacyImplementation?: empty, /** * Set this true while waiting for new data from a refresh. */ diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index 396344a05c1b3e..10c26fd1437537 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -181,7 +181,10 @@ type OptionalProps> = { */ stickySectionHeadersEnabled?: boolean, - legacyImplementation?: ?boolean, + /** + * The legacy implementation is no longer supported. + */ + legacyImplementation?: empty, }; export type Props = RequiredProps & @@ -323,9 +326,7 @@ class SectionList> extends React.PureComponent< } render() { - const List = this.props.legacyImplementation - ? MetroListView - : VirtualizedSectionList; + const List = VirtualizedSectionList; /* $FlowFixMe(>=0.66.0 site=react_native_fb) This comment suppresses an * error found when Flow v0.66 was deployed. To see the error delete this * comment and run Flow. */ diff --git a/RNTester/js/FlatListExample.js b/RNTester/js/FlatListExample.js index 2f27f32241afa6..d8eeb4626cf7ba 100644 --- a/RNTester/js/FlatListExample.js +++ b/RNTester/js/FlatListExample.js @@ -131,7 +131,6 @@ class FlatListExample extends React.PureComponent<{}, $FlowFixMeState> { } keyboardShouldPersistTaps="always" keyboardDismissMode="on-drag" - legacyImplementation={false} numColumns={1} onEndReached={this._onEndReached} onRefresh={this._onRefresh} diff --git a/RNTester/js/MultiColumnExample.js b/RNTester/js/MultiColumnExample.js index d943c4d323837e..1266cf1b6f771e 100644 --- a/RNTester/js/MultiColumnExample.js +++ b/RNTester/js/MultiColumnExample.js @@ -96,7 +96,6 @@ class MultiColumnExample extends React.PureComponent< renderItem={this._renderItemComponent} disableVirtualization={!this.state.virtualized} onViewableItemsChanged={this._onViewableItemsChanged} - legacyImplementation={false} /> ); diff --git a/RNTester/js/RNTesterExampleList.js b/RNTester/js/RNTesterExampleList.js index 28541443bd50de..c99b1b222e6fb9 100644 --- a/RNTester/js/RNTesterExampleList.js +++ b/RNTester/js/RNTesterExampleList.js @@ -111,7 +111,6 @@ class RNTesterExampleList extends React.Component { keyboardShouldPersistTaps="handled" automaticallyAdjustContentInsets={false} keyboardDismissMode="on-drag" - legacyImplementation={false} renderSectionHeader={renderSectionHeader} />