Skip to content

Commit d56b67e

Browse files
MoOxcknitt
authored andcommitted
Improve lists (#443)
1 parent 9e2ad4e commit d56b67e

10 files changed

Lines changed: 114 additions & 65 deletions

File tree

‎reason-react-native/src/components/FlatList.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ external make:
2727
~numColumns: 'int=?,
2828
// VirtualizedList props
2929
// ~_CellRendererComponent: VirtualizedList.cellRendererComponent('item)=?,
30-
~_ListEmptyComponent: React.element=?,
31-
~_ListFooterComponent: React.element=?,
32-
~_ListHeaderComponent: React.element=?,
30+
~_ListEmptyComponent: unit => React.element=?,
31+
~_ListFooterComponent: unit => React.element=?,
32+
~_ListFooterComponentStyle: Style.t=?,
33+
~_ListHeaderComponent: unit => React.element=?,
34+
~_ListHeaderComponentStyle: Style.t=?,
3335
~debug: bool=?,
3436
// ~data: 'data, // any collection of 'item
3537
~disableVirtualization: bool=?, // deprecated
@@ -116,7 +118,7 @@ external make:
116118
~snapToInterval: float=?,
117119
~snapToOffsets: array(float)=?,
118120
~snapToStart: bool=?,
119-
~stickyHeaderIndices: list(int)=?,
121+
~stickyHeaderIndices: array(int)=?,
120122
~zoomScale: float=?,
121123
// View props
122124
~accessibilityComponentType: [@bs.string] [

‎reason-react-native/src/components/FlatList.re‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ external make:
2020
~numColumns: 'int=?,
2121
// VirtualizedList props
2222
// ~_CellRendererComponent: VirtualizedList.cellRendererComponent('item)=?,
23-
~_ListEmptyComponent: React.element=?,
24-
~_ListFooterComponent: React.element=?,
25-
~_ListHeaderComponent: React.element=?,
23+
~_ListEmptyComponent: unit => React.element=?,
24+
~_ListFooterComponent: unit => React.element=?,
25+
~_ListFooterComponentStyle: Style.t=?,
26+
~_ListHeaderComponent: unit => React.element=?,
27+
~_ListHeaderComponentStyle: Style.t=?,
2628
~debug: bool=?,
2729
// ~data: 'data, // any collection of 'item
2830
~disableVirtualization: bool=?, // deprecated
@@ -109,7 +111,7 @@ external make:
109111
~snapToInterval: float=?,
110112
~snapToOffsets: array(float)=?,
111113
~snapToStart: bool=?,
112-
~stickyHeaderIndices: list(int)=?,
114+
~stickyHeaderIndices: array(int)=?,
113115
~zoomScale: float=?,
114116
// View props
115117
~accessibilityComponentType: [@bs.string] [

‎reason-react-native/src/components/ScrollView.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ external make:
6767
~snapToInterval: float=?,
6868
~snapToOffsets: array(float)=?,
6969
~snapToStart: bool=?,
70-
~stickyHeaderIndices: list(int)=?,
70+
~stickyHeaderIndices: array(int)=?,
7171
~zoomScale: float=?,
7272
// View props
7373
~accessibilityComponentType: [@bs.string] [

‎reason-react-native/src/components/ScrollView.re‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ external make:
6060
~snapToInterval: float=?,
6161
~snapToOffsets: array(float)=?,
6262
~snapToStart: bool=?,
63-
~stickyHeaderIndices: list(int)=?,
63+
~stickyHeaderIndices: array(int)=?,
6464
~zoomScale: float=?,
6565
// View props
6666
~accessibilityComponentType: [@bs.string] [

‎reason-react-native/src/components/SectionList.md‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,32 @@ external make:
1313
(
1414
~ref: ref=?,
1515
// VirtualizedSectionList props
16-
~sections: array(VirtualizedSectionList.section('item)),
17-
~stickySectionHeadersEnabled: bool=?,
16+
~_ItemSeparatorComponent: VirtualizedSectionList.separatorProps('item) =>
17+
React.element
18+
=?,
19+
~_SectionSeparatorComponent: VirtualizedSectionList.separatorProps(
20+
'item,
21+
) =>
22+
React.element
23+
=?,
1824
~renderItem: VirtualizedSectionList.renderItemCallback('item),
19-
~renderSectionHeader: VirtualizedSectionList.renderSectionHeaderCallback(
25+
~renderSectionFooter: VirtualizedSectionList.renderSectionHeaderCallback(
2026
'item,
2127
)
2228
=?,
23-
~renderSectionFooter: VirtualizedSectionList.renderSectionHeaderCallback(
29+
~renderSectionHeader: VirtualizedSectionList.renderSectionHeaderCallback(
2430
'item,
2531
)
2632
=?,
27-
// @todo support components too (only?)
28-
~_SectionSeparatorComponent: React.element=?,
29-
~_ItemSeparatorComponent: React.element=?,
33+
~sections: array(VirtualizedSectionList.section('item)),
34+
~stickySectionHeadersEnabled: bool=?,
3035
// VirtualizedList props
3136
~_CellRendererComponent: VirtualizedList.cellRendererComponent('item)=?,
32-
~_ListEmptyComponent: React.element=?,
33-
~_ListFooterComponent: React.element=?,
34-
~_ListHeaderComponent: React.element=?,
37+
~_ListEmptyComponent: unit => React.element=?,
38+
~_ListFooterComponent: unit => React.element=?,
39+
~_ListFooterComponentStyle: Style.t=?,
40+
~_ListHeaderComponent: unit => React.element=?,
41+
~_ListHeaderComponentStyle: Style.t=?,
3542
~debug: bool=?,
3643
// ~enableVirtualization: bool=?, // not working, disableVirtualization?
3744
// ~data: 'data, // any collection of 'item
@@ -119,7 +126,7 @@ external make:
119126
~snapToInterval: float=?,
120127
~snapToOffsets: array(float)=?,
121128
~snapToStart: bool=?,
122-
~stickyHeaderIndices: list(int)=?,
129+
~stickyHeaderIndices: array(int)=?,
123130
~zoomScale: float=?,
124131
// View props
125132
~accessibilityComponentType: [@bs.string] [
@@ -239,5 +246,4 @@ external scrollToOffset: scrollToOffsetParams => unit = "scrollToOffset";
239246
[@bs.send] external recordInteraction: element => unit = "";
240247
241248
[@bs.send] external flashScrollIndicators: element => unit = "";
242-
243249
```

‎reason-react-native/src/components/SectionList.re‎

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,32 @@ external make:
66
(
77
~ref: ref=?,
88
// VirtualizedSectionList props
9-
~sections: array(VirtualizedSectionList.section('item)),
10-
~stickySectionHeadersEnabled: bool=?,
9+
~_ItemSeparatorComponent: VirtualizedSectionList.separatorProps('item) =>
10+
React.element
11+
=?,
12+
~_SectionSeparatorComponent: VirtualizedSectionList.separatorProps(
13+
'item,
14+
) =>
15+
React.element
16+
=?,
1117
~renderItem: VirtualizedSectionList.renderItemCallback('item),
12-
~renderSectionHeader: VirtualizedSectionList.renderSectionHeaderCallback(
18+
~renderSectionFooter: VirtualizedSectionList.renderSectionHeaderCallback(
1319
'item,
1420
)
1521
=?,
16-
~renderSectionFooter: VirtualizedSectionList.renderSectionHeaderCallback(
22+
~renderSectionHeader: VirtualizedSectionList.renderSectionHeaderCallback(
1723
'item,
1824
)
1925
=?,
20-
// @todo support components too (only?)
21-
~_SectionSeparatorComponent: React.element=?,
22-
~_ItemSeparatorComponent: React.element=?,
26+
~sections: array(VirtualizedSectionList.section('item)),
27+
~stickySectionHeadersEnabled: bool=?,
2328
// VirtualizedList props
2429
~_CellRendererComponent: VirtualizedList.cellRendererComponent('item)=?,
25-
~_ListEmptyComponent: React.element=?,
26-
~_ListFooterComponent: React.element=?,
27-
~_ListHeaderComponent: React.element=?,
30+
~_ListEmptyComponent: unit => React.element=?,
31+
~_ListFooterComponent: unit => React.element=?,
32+
~_ListFooterComponentStyle: Style.t=?,
33+
~_ListHeaderComponent: unit => React.element=?,
34+
~_ListHeaderComponentStyle: Style.t=?,
2835
~debug: bool=?,
2936
// ~enableVirtualization: bool=?, // not working, disableVirtualization?
3037
// ~data: 'data, // any collection of 'item
@@ -112,7 +119,7 @@ external make:
112119
~snapToInterval: float=?,
113120
~snapToOffsets: array(float)=?,
114121
~snapToStart: bool=?,
115-
~stickyHeaderIndices: list(int)=?,
122+
~stickyHeaderIndices: array(int)=?,
116123
~zoomScale: float=?,
117124
// View props
118125
~accessibilityComponentType: [@bs.string] [

‎reason-react-native/src/components/VirtualizedList.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ external make:
8787
~ref: ref=?,
8888
// VirtualizedList props
8989
~_CellRendererComponent: cellRendererComponent('item)=?,
90-
~_ListEmptyComponent: React.element=?,
91-
~_ListFooterComponent: React.element=?,
92-
~_ListHeaderComponent: React.element=?,
90+
~_ListEmptyComponent: unit => React.element=?,
91+
~_ListFooterComponent: unit => React.element=?,
92+
~_ListFooterComponentStyle: Style.t=?,
93+
~_ListHeaderComponent: unit => React.element=?,
94+
~_ListHeaderComponentStyle: Style.t=?,
9395
~debug: bool=?,
9496
~data: 'data, // any collection of 'item
9597
~disableVirtualization: bool=?, // deprecated
@@ -170,7 +172,7 @@ external make:
170172
~snapToInterval: float=?,
171173
~snapToOffsets: array(float)=?,
172174
~snapToStart: bool=?,
173-
~stickyHeaderIndices: list(int)=?,
175+
~stickyHeaderIndices: array(int)=?,
174176
~zoomScale: float=?,
175177
// View props
176178
~accessibilityComponentType: [@bs.string] [

‎reason-react-native/src/components/VirtualizedList.re‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ external make:
8080
~ref: ref=?,
8181
// VirtualizedList props
8282
~_CellRendererComponent: cellRendererComponent('item)=?,
83-
~_ListEmptyComponent: React.element=?,
84-
~_ListFooterComponent: React.element=?,
85-
~_ListHeaderComponent: React.element=?,
83+
~_ListEmptyComponent: unit => React.element=?,
84+
~_ListFooterComponent: unit => React.element=?,
85+
~_ListFooterComponentStyle: Style.t=?,
86+
~_ListHeaderComponent: unit => React.element=?,
87+
~_ListHeaderComponentStyle: Style.t=?,
8688
~debug: bool=?,
8789
~data: 'data, // any collection of 'item
8890
~disableVirtualization: bool=?, // deprecated
@@ -163,7 +165,7 @@ external make:
163165
~snapToInterval: float=?,
164166
~snapToOffsets: array(float)=?,
165167
~snapToStart: bool=?,
166-
~stickyHeaderIndices: list(int)=?,
168+
~stickyHeaderIndices: array(int)=?,
167169
~zoomScale: float=?,
168170
// View props
169171
~accessibilityComponentType: [@bs.string] [

‎reason-react-native/src/components/VirtualizedSectionList.md‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ type renderItemProps('item) = {
1313
"item": 'item,
1414
"index": int,
1515
"section": section('item),
16-
// "separators": TODO
16+
"separators": {
17+
.
18+
"highlight": unit => unit,
19+
"unhighlight": unit => unit,
20+
},
1721
}
1822
and section('item) = {
1923
.
@@ -26,26 +30,36 @@ and section('item) = {
2630
and renderItemCallback('item) = renderItemProps('item) => React.element
2731
and renderSectionHeaderProps('item) = {. "section": section('item)}
2832
and renderSectionHeaderCallback('item) =
29-
renderSectionHeaderProps('item) => React.element;
33+
renderSectionHeaderProps('item) => React.element
34+
and separatorProps('item) = {
35+
.
36+
"highlighted": bool,
37+
"leadingItem": option('item),
38+
"leadingSection": option(section('item)),
39+
"section": section('item),
40+
"trailingItem": option('item),
41+
"trailingSection": option(section('item)),
42+
};
3043
3144
[@react.component] [@bs.module "react-native"]
3245
external make:
3346
(
3447
~ref: ref=?,
3548
// VirtualizedSectionList props
36-
~sections: array(section('item)),
37-
~stickySectionHeadersEnabled: bool=?,
49+
~_ItemSeparatorComponent: separatorProps('item) => React.element=?,
50+
~_SectionSeparatorComponent: separatorProps('item) => React.element=?,
3851
~renderItem: renderItemCallback('item),
39-
~renderSectionHeader: renderSectionHeaderCallback('item)=?,
4052
~renderSectionFooter: renderSectionHeaderCallback('item)=?,
41-
// @todo support components too (only?)
42-
~_SectionSeparatorComponent: React.element=?,
43-
~_ItemSeparatorComponent: React.element=?,
53+
~renderSectionHeader: renderSectionHeaderCallback('item)=?,
54+
~sections: array(section('item)),
55+
~stickySectionHeadersEnabled: bool=?,
4456
// VirtualizedList props
4557
~_CellRendererComponent: VirtualizedList.cellRendererComponent('item)=?,
46-
~_ListEmptyComponent: React.element=?,
47-
~_ListFooterComponent: React.element=?,
48-
~_ListHeaderComponent: React.element=?,
58+
~_ListEmptyComponent: unit => React.element=?,
59+
~_ListFooterComponent: unit => React.element=?,
60+
~_ListFooterComponentStyle: Style.t=?,
61+
~_ListHeaderComponent: unit => React.element=?,
62+
~_ListHeaderComponentStyle: Style.t=?,
4963
~debug: bool=?,
5064
// ~enableVirtualization: bool=?, // not working, disableVirtualization?
5165
// ~data: 'data, // any collection of 'item
@@ -133,7 +147,7 @@ external make:
133147
~snapToInterval: float=?,
134148
~snapToOffsets: array(float)=?,
135149
~snapToStart: bool=?,
136-
~stickyHeaderIndices: list(int)=?,
150+
~stickyHeaderIndices: array(int)=?,
137151
~zoomScale: float=?,
138152
// View props
139153
~accessibilityComponentType: [@bs.string] [

‎reason-react-native/src/components/VirtualizedSectionList.re‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ type renderItemProps('item) = {
66
"item": 'item,
77
"index": int,
88
"section": section('item),
9-
// "separators": TODO
9+
"separators": {
10+
.
11+
"highlight": unit => unit,
12+
"unhighlight": unit => unit,
13+
},
1014
}
1115
and section('item) = {
1216
.
@@ -19,26 +23,36 @@ and section('item) = {
1923
and renderItemCallback('item) = renderItemProps('item) => React.element
2024
and renderSectionHeaderProps('item) = {. "section": section('item)}
2125
and renderSectionHeaderCallback('item) =
22-
renderSectionHeaderProps('item) => React.element;
26+
renderSectionHeaderProps('item) => React.element
27+
and separatorProps('item) = {
28+
.
29+
"highlighted": bool,
30+
"leadingItem": option('item),
31+
"leadingSection": option(section('item)),
32+
"section": section('item),
33+
"trailingItem": option('item),
34+
"trailingSection": option(section('item)),
35+
};
2336

2437
[@react.component] [@bs.module "react-native"]
2538
external make:
2639
(
2740
~ref: ref=?,
2841
// VirtualizedSectionList props
29-
~sections: array(section('item)),
30-
~stickySectionHeadersEnabled: bool=?,
42+
~_ItemSeparatorComponent: separatorProps('item) => React.element=?,
43+
~_SectionSeparatorComponent: separatorProps('item) => React.element=?,
3144
~renderItem: renderItemCallback('item),
32-
~renderSectionHeader: renderSectionHeaderCallback('item)=?,
3345
~renderSectionFooter: renderSectionHeaderCallback('item)=?,
34-
// @todo support components too (only?)
35-
~_SectionSeparatorComponent: React.element=?,
36-
~_ItemSeparatorComponent: React.element=?,
46+
~renderSectionHeader: renderSectionHeaderCallback('item)=?,
47+
~sections: array(section('item)),
48+
~stickySectionHeadersEnabled: bool=?,
3749
// VirtualizedList props
3850
~_CellRendererComponent: VirtualizedList.cellRendererComponent('item)=?,
39-
~_ListEmptyComponent: React.element=?,
40-
~_ListFooterComponent: React.element=?,
41-
~_ListHeaderComponent: React.element=?,
51+
~_ListEmptyComponent: unit => React.element=?,
52+
~_ListFooterComponent: unit => React.element=?,
53+
~_ListFooterComponentStyle: Style.t=?,
54+
~_ListHeaderComponent: unit => React.element=?,
55+
~_ListHeaderComponentStyle: Style.t=?,
4256
~debug: bool=?,
4357
// ~enableVirtualization: bool=?, // not working, disableVirtualization?
4458
// ~data: 'data, // any collection of 'item
@@ -126,7 +140,7 @@ external make:
126140
~snapToInterval: float=?,
127141
~snapToOffsets: array(float)=?,
128142
~snapToStart: bool=?,
129-
~stickyHeaderIndices: list(int)=?,
143+
~stickyHeaderIndices: array(int)=?,
130144
~zoomScale: float=?,
131145
// View props
132146
~accessibilityComponentType: [@bs.string] [

0 commit comments

Comments
 (0)