@@ -21,11 +21,8 @@ export default class Example extends Component {
21
21
}
22
22
}
23
23
24
- sleep = ( time ) => {
25
- return new Promise ( resolve => {
26
- setTimeout ( ( ) => resolve ( ) , time ) ;
27
- } )
28
- } ;
24
+ sleep = ( time ) => new Promise ( resolve => setTimeout ( ( ) => resolve ( ) , time ) ) ;
25
+
29
26
30
27
onFetch = async ( page = 1 , startFetch , abortFetch ) => {
31
28
try {
@@ -79,8 +76,6 @@ export default class Example extends Component {
79
76
} ;
80
77
81
78
renderItem = ( item , index , separator ) => {
82
- console . log ( separator ) ;
83
-
84
79
if ( this . state . layout === 'list' ) {
85
80
return (
86
81
< FlatListItem item = { item } index = { index } onPress = { this . onPressItem } />
@@ -137,13 +132,12 @@ export default class Example extends Component {
137
132
</ Header >
138
133
< UltimateListView
139
134
ref = { ( ref ) => this . listView = ref }
140
- key = { this . state . layout } //this is important to distinguish different FlatList
135
+ key = { this . state . layout } //this is important to distinguish different FlatList, default is numColumns
141
136
onFetch = { this . onFetch }
142
137
keyExtractor = { ( item , index ) => `${ this . state . layout } - ${ item } ` } //this is required when you are using FlatList
143
138
refreshableMode = "advanced" //basic or advanced
144
139
145
- //-------FlatList--------
146
- item = { this . renderItem } //this takes two params (item, index)
140
+ item = { this . renderItem } //this takes three params (item, index, separator)
147
141
numColumns = { this . state . layout === 'list' ? 1 : 3 } //to use grid layout, simply set gridColumn > 1
148
142
columnWrapperStyle = { { height : 120 } } //use this line to customise style of each row in FlatList, only work when gridColumn > 1
149
143
0 commit comments