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
This commit is contained in:
Eli White
2019-10-11 09:49:27 -07:00
committed by Facebook Github Bot
parent 515cc6f596
commit d1789dbf8c
5 changed files with 14 additions and 248 deletions
+3 -1
View File
@@ -682,9 +682,11 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
};
render(): React.Node {
const {numColumns, columnWrapperStyle, ...restProps} = this.props;
return (
<VirtualizedList
{...this.props}
{...restProps}
getItem={this._getItem}
getItemCount={this._getItemCount}
keyExtractor={this._keyExtractor}
+11 -1
View File
@@ -190,9 +190,19 @@ class VirtualizedSectionList<
}, 0)
: 0;
const {
SectionSeparatorComponent,
renderItem,
renderSectionFooter,
renderSectionHeader,
sections: _sections,
stickySectionHeadersEnabled,
...restProps
} = props;
return {
childProps: {
...props,
...restProps,
renderItem: this._renderItem,
ItemSeparatorComponent: undefined, // Rendered with renderItem
data: props.sections,
@@ -33,7 +33,6 @@ exports[`FlatList renders all the bells and whistles 1`] = `
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
numColumns={2}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
@@ -136,7 +135,6 @@ exports[`FlatList renders empty list 1`] = `
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
numColumns={1}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
@@ -165,7 +163,6 @@ exports[`FlatList renders null list 1`] = `
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
numColumns={1}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
@@ -207,7 +204,6 @@ exports[`FlatList renders simple list (multiple columns) 1`] = `
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
numColumns={2}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
@@ -285,7 +281,6 @@ exports[`FlatList renders simple list 1`] = `
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
numColumns={1}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
@@ -353,7 +348,6 @@ exports[`FlatList renders simple list using ListItemComponent (multiple columns)
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
numColumns={2}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
@@ -431,7 +425,6 @@ exports[`FlatList renders simple list using ListItemComponent 1`] = `
initialNumToRender={10}
keyExtractor={[Function]}
maxToRenderPerBatch={10}
numColumns={1}
onContentSizeChange={[Function]}
onEndReachedThreshold={2}
onLayout={[Function]}
@@ -32,29 +32,12 @@ exports[`SectionList rendering empty section headers is fine 1`] = `
onScrollBeginDrag={[Function]}
onScrollEndDrag={[Function]}
renderItem={[Function]}
renderSectionHeader={[Function]}
scrollEventThrottle={50}
sections={
Array [
Object {
"data": Array [
Object {
"key": "i1",
},
Object {
"key": "i2",
},
],
"key": "s1",
},
]
}
stickyHeaderIndices={
Array [
0,
]
}
stickySectionHeadersEnabled={true}
updateCellsBatchingPeriod={50}
windowSize={21}
>
@@ -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}
>
@@ -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}