BuyWhat/src/components/StoreList/index.js

28 lines
744 B
JavaScript
Raw Normal View History

2017-07-04 13:14:01 +00:00
import React from 'react'
import {View, Text, ListView, RefreshControl} from 'react-native'
2017-07-04 15:08:19 +00:00
import Item from './Item'
const ds1 = new ListView.DataSource({
2017-07-04 13:14:01 +00:00
rowHasChanged: (r1, r2) => {
return r1.name != r2.name
}
})
2017-07-04 15:08:19 +00:00
export default StoreList = ({dev, show, list, refresh, getList, loadItems}) => {
2017-07-04 13:14:01 +00:00
if(!show) return null
2017-07-04 15:08:19 +00:00
console.log('Store', list)
2017-07-04 13:14:01 +00:00
return (
<View style={{flex: 1}}>
<ListView
refreshControl={<RefreshControl refreshing={refresh} onRefresh={getList} />}
enableEmptySections={true}
2017-07-04 15:08:19 +00:00
dataSource={ds1.cloneWithRows(list)}
2017-07-04 13:14:01 +00:00
renderRow={data => {
return (
2017-07-04 15:08:19 +00:00
<Item name={data.name} onClick={()=>loadItems(data.id)} />
2017-07-04 13:14:01 +00:00
)
}} />
</View>
)
}