Skip to content

Commit af4903e

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Cleanup legacyImplementation code from FlatList
Summary: This functionality was removed here: facebook@636d01b This is just a step of cleanup Reviewed By: yungsters Differential Revision: D10515512 fbshipit-source-id: 6d24cc9c53c71924a82c67a4058585ee978de2d9
1 parent dc74975 commit af4903e

File tree

2 files changed

+12
-251
lines changed

2 files changed

+12
-251
lines changed

Libraries/Lists/FlatList.js

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
'use strict';
1111

1212
const deepDiffer = require('deepDiffer');
13-
const MetroListView = require('MetroListView'); // Used as a fallback legacy option
1413
const React = require('React');
1514
const View = require('View');
1615
const VirtualizedList = require('VirtualizedList');
17-
const ListView = require('ListView');
1816
const StyleSheet = require('StyleSheet');
1917

2018
const invariant = require('fbjs/lib/invariant');
@@ -359,7 +357,6 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
359357
viewPosition?: number,
360358
}) {
361359
if (this._listRef) {
362-
// $FlowFixMe Found when typing ListView
363360
this._listRef.scrollToIndex(params);
364361
}
365362
}
@@ -376,7 +373,6 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
376373
viewPosition?: number,
377374
}) {
378375
if (this._listRef) {
379-
// $FlowFixMe Found when typing ListView
380376
this._listRef.scrollToItem(params);
381377
}
382378
}
@@ -388,7 +384,6 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
388384
*/
389385
scrollToOffset(params: {animated?: ?boolean, offset: number}) {
390386
if (this._listRef) {
391-
// $FlowFixMe Found when typing ListView
392387
this._listRef.scrollToOffset(params);
393388
}
394389
}
@@ -400,7 +395,6 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
400395
*/
401396
recordInteraction() {
402397
if (this._listRef) {
403-
// $FlowFixMe Found when typing ListView
404398
this._listRef.recordInteraction();
405399
}
406400
}
@@ -412,7 +406,6 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
412406
*/
413407
flashScrollIndicators() {
414408
if (this._listRef) {
415-
// $FlowFixMe Found when typing ListView
416409
this._listRef.flashScrollIndicators();
417410
}
418411
}
@@ -422,14 +415,12 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
422415
*/
423416
getScrollResponder() {
424417
if (this._listRef) {
425-
// $FlowFixMe Found when typing ListView
426418
return this._listRef.getScrollResponder();
427419
}
428420
}
429421

430422
getScrollableNode() {
431423
if (this._listRef) {
432-
// $FlowFixMe Found when typing ListView
433424
return this._listRef.getScrollableNode();
434425
}
435426
}
@@ -488,8 +479,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
488479
this._checkProps(this.props);
489480
}
490481

491-
_hasWarnedLegacy = false;
492-
_listRef: null | VirtualizedList | ListView | MetroListView;
482+
_listRef: ?React.ElementRef<typeof VirtualizedList>;
493483
_virtualizedListPairs: Array<ViewabilityConfigCallbackPair> = [];
494484

495485
_captureRef = ref => {
@@ -501,7 +491,6 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
501491
getItem,
502492
getItemCount,
503493
horizontal,
504-
legacyImplementation,
505494
numColumns,
506495
columnWrapperStyle,
507496
onViewableItemsChanged,
@@ -519,22 +508,6 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
519508
'columnWrapperStyle not supported for single column lists',
520509
);
521510
}
522-
if (legacyImplementation) {
523-
invariant(
524-
numColumns === 1,
525-
'Legacy list does not support multiple columns.',
526-
);
527-
// Warning: may not have full feature parity and is meant more for debugging and performance
528-
// comparison.
529-
if (!this._hasWarnedLegacy) {
530-
console.warn(
531-
'FlatList: legacyImplementation is deprecated and will be removed in a ' +
532-
'future release - some features not supported and performance may suffer. ' +
533-
'Please migrate to the default implementation.',
534-
);
535-
this._hasWarnedLegacy = true;
536-
}
537-
}
538511
invariant(
539512
!(onViewableItemsChanged && viewabilityConfigCallbackPairs),
540513
'FlatList does not support setting both onViewableItemsChanged and ' +
@@ -648,27 +621,17 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
648621
};
649622

650623
render() {
651-
if (this.props.legacyImplementation) {
652-
return (
653-
<MetroListView
654-
{...this.props}
655-
items={this.props.data}
656-
ref={this._captureRef}
657-
/>
658-
);
659-
} else {
660-
return (
661-
<VirtualizedList
662-
{...this.props}
663-
renderItem={this._renderItem}
664-
getItem={this._getItem}
665-
getItemCount={this._getItemCount}
666-
keyExtractor={this._keyExtractor}
667-
ref={this._captureRef}
668-
viewabilityConfigCallbackPairs={this._virtualizedListPairs}
669-
/>
670-
);
671-
}
624+
return (
625+
<VirtualizedList
626+
{...this.props}
627+
renderItem={this._renderItem}
628+
getItem={this._getItem}
629+
getItemCount={this._getItemCount}
630+
keyExtractor={this._keyExtractor}
631+
ref={this._captureRef}
632+
viewabilityConfigCallbackPairs={this._virtualizedListPairs}
633+
/>
634+
);
672635
}
673636
}
674637

Libraries/Lists/MetroListView.js

Lines changed: 0 additions & 202 deletions
This file was deleted.

0 commit comments

Comments
 (0)