This commit is contained in:
2019-07-24 00:53:01 -04:00
parent 434a1ded24
commit a9f4324f29
21 changed files with 345 additions and 100 deletions

View File

@@ -1,3 +1,4 @@
import { List } from 'immutable';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
@@ -8,11 +9,10 @@ import {
View,
} from 'react-native';
import { SORT_MODES, VIEW_MODES } from '../constants/constants.js';
import { SORT_MODES, AUCTION_VIEW_MODES } from '../constants/constants.js';
import FilterBar from '../components/Auction/FilterBar.js';
import GridItem from '../components/Item/Grid.js';
import ListItem from '../components/Item/List.js';
import ListItem from '../containers/Item/List.js';
export default class Auction extends Component {
static get propTypes() {
@@ -20,7 +20,10 @@ export default class Auction extends Component {
changeFilter: PropTypes.func,
fetchItems: PropTypes.func.isRequired,
fetchStatus: PropTypes.func.isRequired,
items: PropTypes.array,
items: PropTypes.oneOfType([
PropTypes.array,
PropTypes.instanceOf(List),
]),
};
}
@@ -39,7 +42,7 @@ export default class Auction extends Component {
this.state = {
sort: SORT_MODES.TITLE_ASC,
view: VIEW_MODES.LIST,
view: AUCTION_VIEW_MODES.ALL,
};
}
@@ -58,14 +61,7 @@ export default class Auction extends Component {
_keyExtractor = (item, index) => `${item._id}_${index}`;
_renderItem = (view) => ({ item }) => {
console.log('_renderItem', item);
if (view === VIEW_MODES.GRID) {
return <GridItem {...item} />;
}
return <ListItem {...item} />;
}
_renderItem = ({ item }) => <ListItem item={item} />;
render() {
const { items } = this.props;