Skip to content

Commit 1531f5f

Browse files
sahrensfacebook-github-bot
authored andcommitted
change section-specific SeparatorComponent -> ItemSeparatorComponent for consistency
Summary: Not sure how I missed this in 3ce31c2 Reviewed By: yungsters Differential Revision: D4731083 fbshipit-source-id: 860ed9d2f99312cd02b84ba467ba66afc5cdd5c5
1 parent 5c85615 commit 1531f5f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Libraries/CustomComponents/Lists/SectionList.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type SectionBase<SectionItemT> = {
4949

5050
// Optional props will override list-wide props just for this section.
5151
renderItem?: ?(info: {item: SectionItemT, index: number}) => ?React.Element<any>,
52-
SeparatorComponent?: ?ReactClass<any>,
52+
ItemSeparatorComponent?: ?ReactClass<any>,
5353
keyExtractor?: (item: SectionItemT) => string,
5454

5555
// TODO: support more optional/override props

Libraries/CustomComponents/Lists/VirtualizedSectionList.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type SectionBase = {
5252

5353
// Optional props will override list-wide props just for this section.
5454
renderItem?: ?({item: SectionItem, index: number}) => ?React.Element<*>,
55-
SeparatorComponent?: ?ReactClass<*>,
55+
ItemSeparatorComponent?: ?ReactClass<*>,
5656
keyExtractor?: (item: SectionItem) => string,
5757

5858
// TODO: support more optional/override props
@@ -229,15 +229,15 @@ class VirtualizedSectionList<SectionT: SectionBase>
229229
if (!info) {
230230
return null;
231231
}
232-
const SeparatorComponent = info.section.SeparatorComponent || this.props.ItemSeparatorComponent;
232+
const ItemSeparatorComponent = info.section.ItemSeparatorComponent || this.props.ItemSeparatorComponent;
233233
const {SectionSeparatorComponent} = this.props;
234234
const isLastItemInList = index === this.state.childProps.getItemCount() - 1;
235235
const isLastItemInSection = info.index === info.section.data.length - 1;
236236
if (SectionSeparatorComponent && isLastItemInSection && !isLastItemInList) {
237237
return SectionSeparatorComponent;
238238
}
239-
if (SeparatorComponent && !isLastItemInSection && !isLastItemInList) {
240-
return SeparatorComponent;
239+
if (ItemSeparatorComponent && !isLastItemInSection && !isLastItemInList) {
240+
return ItemSeparatorComponent;
241241
}
242242
return null;
243243
}

Libraries/CustomComponents/Lists/__tests__/SectionList-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('SectionList', () => {
4848
renderItem: ({item}) => <itemForSection1 value={item.id} />,
4949
key: '1st Section',
5050
keyExtractor: (item, index) => item.id,
51-
SeparatorComponent: () => <itemSeparatorForSection1 />,
51+
ItemSeparatorComponent: () => <itemSeparatorForSection1 />,
5252
data: [{id: 'i1s1'}, {id: 'i2s1'}],
5353
},
5454
{

Libraries/CustomComponents/Lists/__tests__/__snapshots__/SectionList-test.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
9696
data={
9797
Array [
9898
Object {
99-
"SeparatorComponent": [Function],
99+
"ItemSeparatorComponent": [Function],
100100
"data": Array [
101101
Object {
102102
"id": "i1s1",
@@ -152,7 +152,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
152152
sections={
153153
Array [
154154
Object {
155-
"SeparatorComponent": [Function],
155+
"ItemSeparatorComponent": [Function],
156156
"data": Array [
157157
Object {
158158
"id": "i1s1",

0 commit comments

Comments
 (0)