/
list.js
46 lines (41 loc) · 982 Bytes
/
list.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* @Author: czy0729
* @Date: 2019-08-25 19:50:36
* @Last Modified by: czy0729
* @Last Modified time: 2019-12-22 02:55:43
*/
import React from 'react'
import PropTypes from 'prop-types'
import { observer } from 'mobx-react'
import { Loading, ListView } from '@components'
import { _ } from '@stores'
import Item from '../_/item'
import { tabs } from './store'
function List({ index }, { $ }) {
const { key } = tabs[index]
const list = $.list(key)
if (!list._loaded) {
return <Loading style={_.container.flex} />
}
const event = {
id: 'ICO.跳转'
}
return (
<ListView
style={_.container.flex}
keyExtractor={item => String(item.id)}
data={list}
renderItem={({ item, index }) => (
<Item index={index} event={event} {...item} />
)}
onHeaderRefresh={() => $.fetchList(key)}
/>
)
}
List.defaultProps = {
title: '全部'
}
List.contextTypes = {
$: PropTypes.object
}
export default observer(List)