You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A drop-in replacement for React Native's `ListView`.
8
+
A drop-in replacement for React Native's [`ListView`](https://facebook.github.io/react-native/docs/listview.html).
9
9
10
-
It supports [Immutable](https://facebook.github.io/immutable-js/) data out-of-the-box to give you faster performance :racehorse: and less headaches :face_with_head_bandage:.
10
+
It supports [Immutable](https://facebook.github.io/immutable-js/) data out-of-the-box to give you
11
+
faster performance :racehorse: and less headaches :face_with_head_bandage:.
12
+
13
+
## Code
14
+
15
+
```jsx
16
+
<ImmutableListView
17
+
immutableData={this.state.listData}
18
+
renderRow={this.renderRow}
19
+
/>
20
+
```
11
21
12
22
## Motivation
13
23
@@ -17,35 +27,40 @@ It supports [Immutable](https://facebook.github.io/immutable-js/) data out-of-th
17
27
- Do you have nested objects in your state so a shallow diff won't cut it for pure rendering?
18
28
- Do you use a navigator and want better performance while animating?
19
29
20
-
If you answered yes to ANY of these questions, this project will surely be of help. Check out the examples below!
30
+
If you answered yes to ANY of these questions, this project will surely help.
31
+
Check out the [examples](https://github.com/cooperka/react-native-immutable-list-view#how-to-format-your-data) below!
|`immutableData`|[`Immutable.Iterable`](https://facebook.github.io/immutable-js/docs/#/Iterable/isIterable)| Required. | The data to render. |
117
-
|`rowsDuringInteraction`|`number`|`undefined`| How many rows of data to initially display while waiting for interactions to finish (e.g. Navigation animations). If unspecified, this will not have any effect. |
118
-
|`sectionHeaderHasChanged`|`func`|`(prevSectionData, nextSectionData) => false`| Return true if your section header is dependent on your row data (uncommon). See [ListViewDataSource#constructor](https://facebook.github.io/react-native/docs/listviewdatasource.html#constructor) for more info. |
119
-
120
-
Simple, right?
133
+
| `immutableData` | Any [`Immutable.Iterable`](https://facebook.github.io/immutable-js/docs/#/Iterable/isIterable) | Required. | The data to render. See below for some examples. |
134
+
| `rowsDuringInteraction` | `number` | `undefined` | How many rows of data to initially display while waiting for interactions to finish (e.g. Navigation animations). |
135
+
| `sectionHeaderHasChanged` | `func` | `(prevSectionData, nextSectionData) => false` | Return true if your section header is dependent on your row data (uncommon; see [`ListViewDataSource`'sconstructor](https://facebook.github.io/react-native/docs/listviewdatasource.html#constructor) for more info). |
121
136
122
137
## Howtoformatyourdata
123
138
@@ -127,16 +142,16 @@ for list data. Here are some examples:
127
142
#### List
128
143
129
144
```js
130
-
[<rowData1>, <rowData2>, ...]
145
+
[rowData1, rowData2, ...]
131
146
```
132
147
133
148
#### Mapof Lists
134
149
135
150
```js
136
151
{
137
152
section1: [
138
-
<rowData1>,
139
-
<rowData2>,
153
+
rowData1,
154
+
rowData2,
140
155
...
141
156
],
142
157
...
@@ -148,8 +163,8 @@ for list data. Here are some examples:
148
163
```js
149
164
{
150
165
section1: {
151
-
rowID_1:<rowData1>,
152
-
rowID_2:<rowData2>,
166
+
rowId1: rowData1,
167
+
rowId2: rowData2,
153
168
...
154
169
},
155
170
...
@@ -163,19 +178,11 @@ To try it out yourself, you can use the [example app](https://github.com/cooperk
163
178
When using section headers, `ImmutableListView` treats certain types of`Immutable.Map` slightly differently
164
179
than `ListView` treats an equivalent plain JS`Map`. See the snapshot test output
0 commit comments