From d1789dbf8c3c47d4b26c5ea4ef0969e76dafd89d Mon Sep 17 00:00:00 2001 From: Eli White Date: Fri, 11 Oct 2019 09:44:48 -0700 Subject: [PATCH] Destructure out unused props Summary: These props are unusupported by the component they were being passed to. Changelog: [Internal] Reviewed By: zackargyle Differential Revision: D17839765 fbshipit-source-id: 13c80a07da2026b61070ffc93f26194b979ee8fc --- Libraries/Lists/FlatList.js | 4 +- Libraries/Lists/VirtualizedSectionList.js | 12 +- .../__snapshots__/FlatList-test.js.snap | 7 - .../__snapshots__/SectionList-test.js.snap | 84 ---------- .../VirtualizedSectionList-test.js.snap | 155 ------------------ 5 files changed, 14 insertions(+), 248 deletions(-) diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 403fb391777..9704c873ef0 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -682,9 +682,11 @@ class FlatList extends React.PureComponent, void> { }; render(): React.Node { + const {numColumns, columnWrapperStyle, ...restProps} = this.props; + return ( @@ -112,23 +95,12 @@ exports[`SectionList renders a footer when there is no data 1`] = ` onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} renderItem={[Function]} - renderSectionFooter={[Function]} - renderSectionHeader={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [], - "key": "s1", - }, - ] - } stickyHeaderIndices={ Array [ 0, ] } - stickySectionHeadersEnabled={true} updateCellsBatchingPeriod={50} windowSize={21} > @@ -178,22 +150,12 @@ exports[`SectionList renders a footer when there is no data and no header 1`] = onScrollBeginDrag={[Function]} onScrollEndDrag={[Function]} renderItem={[Function]} - renderSectionFooter={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [], - "key": "s1", - }, - ] - } stickyHeaderIndices={ Array [ 0, ] } - stickySectionHeadersEnabled={true} updateCellsBatchingPeriod={50} windowSize={21} > @@ -219,7 +181,6 @@ exports[`SectionList renders all the bells and whistles 1`] = ` ListEmptyComponent={[Function]} ListFooterComponent={[Function]} ListHeaderComponent={[Function]} - SectionSeparatorComponent={[Function]} data={ Array [ Object { @@ -283,49 +244,7 @@ exports[`SectionList renders all the bells and whistles 1`] = ` } refreshing={false} renderItem={[Function]} - renderSectionFooter={[Function]} - renderSectionHeader={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "ItemSeparatorComponent": [Function], - "data": Array [ - Object { - "id": "i1s1", - }, - Object { - "id": "i2s1", - }, - ], - "key": "s1", - "keyExtractor": [Function], - "renderItem": [Function], - }, - Object { - "data": Array [ - Object { - "key": "i1s2", - }, - Object { - "key": "i2s2", - }, - ], - "key": "s2", - }, - Object { - "data": Array [ - Object { - "key": "i1s3", - }, - Object { - "key": "i2s3", - }, - ], - "key": "s3", - }, - ] - } stickyHeaderIndices={ Array [ 1, @@ -333,7 +252,6 @@ exports[`SectionList renders all the bells and whistles 1`] = ` 9, ] } - stickySectionHeadersEnabled={true} updateCellsBatchingPeriod={50} windowSize={21} > @@ -511,9 +429,7 @@ exports[`SectionList renders empty list 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={Array []} stickyHeaderIndices={Array []} - stickySectionHeadersEnabled={true} updateCellsBatchingPeriod={50} windowSize={21} > diff --git a/Libraries/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap b/Libraries/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap index 3d737ada261..faa91c2e49c 100644 --- a/Libraries/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap +++ b/Libraries/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap @@ -33,21 +33,6 @@ exports[`VirtualizedSectionList handles nested lists 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "key": "outer0", - }, - Object { - "key": "outer1", - }, - ], - "title": "outer", - }, - ] - } stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -93,21 +78,6 @@ exports[`VirtualizedSectionList handles nested lists 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "key": "outer0:inner0", - }, - Object { - "key": "outer0:inner1", - }, - ], - "title": "inner", - }, - ] - } stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -174,21 +144,6 @@ exports[`VirtualizedSectionList handles nested lists 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "key": "outer1:inner0", - }, - Object { - "key": "outer1:inner1", - }, - ], - "title": "inner", - }, - ] - } stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -293,24 +248,6 @@ exports[`VirtualizedSectionList handles separators correctly 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "key": "i0", - }, - Object { - "key": "i1", - }, - Object { - "key": "i2", - }, - ], - "title": "s0", - }, - ] - } stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -450,24 +387,6 @@ exports[`VirtualizedSectionList handles separators correctly 2`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "key": "i0", - }, - Object { - "key": "i1", - }, - Object { - "key": "i2", - }, - ], - "title": "s0", - }, - ] - } stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -607,24 +526,6 @@ exports[`VirtualizedSectionList handles separators correctly 3`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "key": "i0", - }, - Object { - "key": "i1", - }, - Object { - "key": "i2", - }, - ], - "title": "s0", - }, - ] - } stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -785,30 +686,6 @@ exports[`VirtualizedSectionList renders all the bells and whistles 1`] = ` refreshing={false} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "id": "0", - }, - Object { - "id": "1", - }, - Object { - "id": "2", - }, - Object { - "id": "3", - }, - Object { - "id": "4", - }, - ], - "title": "s1", - }, - ] - } stickyHeaderIndices={Array []} style={ Array [ @@ -1022,7 +899,6 @@ exports[`VirtualizedSectionList renders empty list 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={Array []} stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -1053,7 +929,6 @@ exports[`VirtualizedSectionList renders empty list with empty component 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={Array []} stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -1105,18 +980,6 @@ exports[`VirtualizedSectionList renders list with empty component 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "key": "hello", - }, - ], - "title": "s1", - }, - ] - } stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21} @@ -1204,24 +1067,6 @@ exports[`VirtualizedSectionList renders simple list 1`] = ` onScrollEndDrag={[Function]} renderItem={[Function]} scrollEventThrottle={50} - sections={ - Array [ - Object { - "data": Array [ - Object { - "key": "i1", - }, - Object { - "key": "i2", - }, - Object { - "key": "i3", - }, - ], - "title": "s1", - }, - ] - } stickyHeaderIndices={Array []} updateCellsBatchingPeriod={50} windowSize={21}