Skip to content

Commit 3ce31c2

Browse files
sahrensfacebook-github-bot
authored andcommitted
Rename *Component props to match SectionList
Reviewed By: yungsters Differential Revision: D4697335 fbshipit-source-id: 742b7a1729ba7a08fe3d9707bcf6c51026779739
1 parent ac452c0 commit 3ce31c2

File tree

6 files changed

+24
-41
lines changed

6 files changed

+24
-41
lines changed

Examples/UIExplorer/js/FlatListExample.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ class FlatListExample extends React.PureComponent {
133133
</View>
134134
<SeparatorComponent />
135135
<AnimatedFlatList
136-
HeaderComponent={HeaderComponent}
137-
FooterComponent={FooterComponent}
138-
SeparatorComponent={SeparatorComponent}
136+
ItemSeparatorComponent={SeparatorComponent}
137+
ListHeaderComponent={HeaderComponent}
138+
ListFooterComponent={FooterComponent}
139139
data={filteredData}
140140
debug={this.state.debug}
141141
disableVirtualization={!this.state.virtualized}

Examples/UIExplorer/js/MultiColumnExample.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ class MultiColumnExample extends React.PureComponent {
9797
</View>
9898
<SeparatorComponent />
9999
<FlatList
100-
FooterComponent={FooterComponent}
101-
HeaderComponent={HeaderComponent}
102-
SeparatorComponent={SeparatorComponent}
100+
ItemSeparatorComponent={SeparatorComponent}
101+
ListFooterComponent={FooterComponent}
102+
ListHeaderComponent={HeaderComponent}
103103
getItemLayout={this.state.fixedHeight ? this._getItemLayout : undefined}
104104
data={filteredData}
105105
key={this.state.numColumns + (this.state.fixedHeight ? 'f' : 'v')}

Libraries/CustomComponents/Lists/FlatList.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ type RequiredProps<ItemT> = {
6767
};
6868
type OptionalProps<ItemT> = {
6969
/**
70-
* Rendered at the bottom of all the items.
70+
* Rendered in between each item, but not at the top or bottom.
7171
*/
72-
FooterComponent?: ?ReactClass<any>,
72+
ItemSeparatorComponent?: ?ReactClass<any>,
7373
/**
74-
* Rendered at the top of all the items.
74+
* Rendered at the bottom of all the items.
7575
*/
76-
HeaderComponent?: ?ReactClass<any>,
76+
ListFooterComponent?: ?ReactClass<any>,
7777
/**
78-
* Rendered in between each item, but not at the top or bottom.
78+
* Rendered at the top of all the items.
7979
*/
80-
SeparatorComponent?: ?ReactClass<any>,
80+
ListHeaderComponent?: ?ReactClass<any>,
8181
/**
8282
* `getItemLayout` is an optional optimizations that let us skip measurement of dynamic content if
8383
* you know the height of items a priori. `getItemLayout` is the most efficient, and is easy to
@@ -88,7 +88,7 @@ type OptionalProps<ItemT> = {
8888
* )}
8989
*
9090
* Remember to include separator length (height or width) in your offset calculation if you
91-
* specify `SeparatorComponent`.
91+
* specify `ItemSeparatorComponent`.
9292
*/
9393
getItemLayout?: (data: ?Array<ItemT>, index: number) =>
9494
{length: number, offset: number, index: number},
@@ -132,13 +132,6 @@ type OptionalProps<ItemT> = {
132132
* Optional custom style for multi-item rows generated when numColumns > 1
133133
*/
134134
columnWrapperStyle?: StyleObj,
135-
/**
136-
* Optional optimization to minimize re-rendering items.
137-
*/
138-
shouldItemUpdate: (
139-
prevInfo: {item: ItemT, index: number},
140-
nextInfo: {item: ItemT, index: number}
141-
) => boolean,
142135
/**
143136
* See `ViewabilityHelper` for flow type and further documentation.
144137
*/

Libraries/CustomComponents/Lists/SectionList.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,8 @@ class SectionList<SectionT: SectionBase<any>>
183183
static defaultProps: DefaultProps = VirtualizedSectionList.defaultProps;
184184

185185
render() {
186-
const {ListFooterComponent, ListHeaderComponent, ItemSeparatorComponent} = this.props;
187186
const List = this.props.legacyImplementation ? MetroListView : VirtualizedSectionList;
188-
return (
189-
<List
190-
{...this.props}
191-
FooterComponent={ListFooterComponent}
192-
HeaderComponent={ListHeaderComponent}
193-
SeparatorComponent={ItemSeparatorComponent}
194-
/>
195-
);
187+
return <List {...this.props} />;
196188
}
197189
}
198190

Libraries/CustomComponents/Lists/VirtualizedList.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ type RequiredProps = {
5959
data?: any,
6060
};
6161
type OptionalProps = {
62-
FooterComponent?: ?ReactClass<any>,
63-
HeaderComponent?: ?ReactClass<any>,
64-
SeparatorComponent?: ?ReactClass<any>,
6562
/**
6663
* `debug` will turn on extra logging and visual overlays to aid with debugging both usage and
6764
* implementation, but with a significant perf hit.
@@ -305,6 +302,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
305302
'Components based on VirtualizedList must be wrapped with Animated.createAnimatedComponent ' +
306303
'to support native onScroll events with useNativeDriver',
307304
);
305+
308306
this._updateCellsToRenderBatcher = new Batchinator(
309307
this._updateCellsToRender,
310308
this.props.updateCellsBatchingPeriod,
@@ -334,7 +332,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
334332
}
335333

336334
_pushCells(cells, first, last) {
337-
const {SeparatorComponent, data, getItem, getItemCount, keyExtractor} = this.props;
335+
const {ItemSeparatorComponent, data, getItem, getItemCount, keyExtractor} = this.props;
338336
const end = getItemCount(data) - 1;
339337
last = Math.min(end, last);
340338
for (let ii = first; ii <= last; ii++) {
@@ -352,19 +350,19 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
352350
parentProps={this.props}
353351
/>
354352
);
355-
if (SeparatorComponent && ii < end) {
356-
cells.push(<SeparatorComponent key={'sep' + ii}/>);
353+
if (ItemSeparatorComponent && ii < end) {
354+
cells.push(<ItemSeparatorComponent key={'sep' + ii}/>);
357355
}
358356
}
359357
}
360358
render() {
361-
const {FooterComponent, HeaderComponent} = this.props;
359+
const {ListFooterComponent, ListHeaderComponent} = this.props;
362360
const {data, disableVirtualization, horizontal} = this.props;
363361
const cells = [];
364-
if (HeaderComponent) {
362+
if (ListHeaderComponent) {
365363
cells.push(
366364
<View key="$header" onLayout={this._onLayoutHeader}>
367-
<HeaderComponent />
365+
<ListHeaderComponent />
368366
</View>
369367
);
370368
}
@@ -404,10 +402,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
404402
);
405403
}
406404
}
407-
if (FooterComponent) {
405+
if (ListFooterComponent) {
408406
cells.push(
409407
<View key="$footer" onLayout={this._onLayoutFooter}>
410-
<FooterComponent />
408+
<ListFooterComponent />
411409
</View>
412410
);
413411
}

Libraries/CustomComponents/Lists/VirtualizedSectionList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type OptionalProps<SectionT: SectionBase> = {
8484
renderSectionHeader?: ?({section: SectionT}) => ?React.Element<*>,
8585
/**
8686
* Rendered at the bottom of every Section, except the very last one, in place of the normal
87-
* SeparatorComponent.
87+
* ItemSeparatorComponent.
8888
*/
8989
SectionSeparatorComponent?: ?ReactClass<*>,
9090
/**

0 commit comments

Comments
 (0)