Skip to content

Commit 48b32c7

Browse files
jaulzcooperka
authored andcommitted
🐛 Prevent "unknown props ..." when used on web (#33)
* fix: remove unknown props * fix: update jest snapshots * format: add consistent formatting
1 parent bea9c72 commit 48b32c7

File tree

7 files changed

+7
-322
lines changed

7 files changed

+7
-322
lines changed

src/ImmutableListView/EmptyListView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class EmptyListView extends PureComponent {
7272
render() {
7373
const { listData } = this.state;
7474
const {
75-
renderEmpty, renderEmptyInList, renderSectionHeader, ...passThroughProps
75+
renderEmpty, renderEmptyInList, renderSectionHeader, emptyText, ...passThroughProps
7676
} = this.props;
7777

7878
return (

src/ImmutableListView/ImmutableListView.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,15 @@ class ImmutableListView extends PureComponent {
196196

197197
render() {
198198
const { dataSource } = this.state;
199+
const {
200+
immutableData, renderEmpty, renderEmptyInList, rowsDuringInteraction, sectionHeaderHasChanged, ...passThroughProps
201+
} = this.props;
199202

200203
return this.renderEmpty() || (
201204
<ListView
202205
ref={(component) => { this.listViewRef = component; }}
203206
dataSource={dataSource}
204-
{...this.props}
207+
{...passThroughProps}
205208
/>
206209
);
207210
}

src/ImmutableListView/__tests__/__snapshots__/EmptyListView.test.js.snap

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,7 @@ exports[`EmptyListView renders with custom renderRow 1`] = `
88
"items": 1,
99
}
1010
}
11-
emptyText="Nothing. Nothing at all."
1211
enableEmptySections={true}
13-
immutableData={
14-
Immutable.List [
15-
Immutable.List [
16-
undefined,
17-
undefined,
18-
"Nothing. Nothing at all.",
19-
],
20-
]
21-
}
2212
initialListSize={10}
2313
onContentSizeChange={[Function]}
2414
onEndReachedThreshold={1000}
@@ -30,11 +20,9 @@ exports[`EmptyListView renders with custom renderRow 1`] = `
3020
onScroll={[Function]}
3121
pageSize={1}
3222
removeClippedSubviews={false}
33-
renderEmptyInList="No data."
3423
renderRow={[Function]}
3524
scrollEventThrottle={50}
3625
scrollRenderAheadDistance={1000}
37-
sectionHeaderHasChanged={[Function]}
3826
stickyHeaderIndices={Array []}
3927
stickySectionHeadersEnabled={true}
4028
>
@@ -58,17 +46,7 @@ exports[`EmptyListView renders with custom text 1`] = `
5846
"items": 1,
5947
}
6048
}
61-
emptyText="Nothing. Nothing at all."
6249
enableEmptySections={true}
63-
immutableData={
64-
Immutable.List [
65-
Immutable.List [
66-
undefined,
67-
undefined,
68-
"Nothing. Nothing at all.",
69-
],
70-
]
71-
}
7250
initialListSize={10}
7351
onContentSizeChange={[Function]}
7452
onEndReachedThreshold={1000}
@@ -80,11 +58,9 @@ exports[`EmptyListView renders with custom text 1`] = `
8058
onScroll={[Function]}
8159
pageSize={1}
8260
removeClippedSubviews={false}
83-
renderEmptyInList="No data."
8461
renderRow={[Function]}
8562
scrollEventThrottle={50}
8663
scrollRenderAheadDistance={1000}
87-
sectionHeaderHasChanged={[Function]}
8864
stickyHeaderIndices={Array []}
8965
stickySectionHeadersEnabled={true}
9066
>
@@ -114,17 +90,7 @@ exports[`EmptyListView renders with default text 1`] = `
11490
"items": 1,
11591
}
11692
}
117-
emptyText="No data."
11893
enableEmptySections={true}
119-
immutableData={
120-
Immutable.List [
121-
Immutable.List [
122-
undefined,
123-
undefined,
124-
"No data.",
125-
],
126-
]
127-
}
12894
initialListSize={10}
12995
onContentSizeChange={[Function]}
13096
onEndReachedThreshold={1000}
@@ -136,11 +102,9 @@ exports[`EmptyListView renders with default text 1`] = `
136102
onScroll={[Function]}
137103
pageSize={1}
138104
removeClippedSubviews={false}
139-
renderEmptyInList="No data."
140105
renderRow={[Function]}
141106
scrollEventThrottle={50}
142107
scrollRenderAheadDistance={1000}
143-
sectionHeaderHasChanged={[Function]}
144108
stickyHeaderIndices={Array []}
145109
stickySectionHeadersEnabled={true}
146110
>

0 commit comments

Comments
 (0)