-
Notifications
You must be signed in to change notification settings - Fork 0
/
Home.js
executable file
·83 lines (76 loc) · 2.35 KB
/
Home.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* This is the Home page
**/
// React native and others libraries imports
import React, { Component } from 'react';
import { Image } from 'react-native';
import { Container, Content, View, Button, Left, Right, Icon, Card, CardItem, cardBody } from 'native-base';
import { Actions } from 'react-native-router-flux';
// Our custom files and classes import
import Text from '../component/Text';
import Navbar from '../component/Navbar';
import SideMenu from '../component/SideMenu';
import SideMenuDrawer from '../component/SideMenuDrawer';
import CategoryBlock from '../component/CategoryBlock';
export default class Home extends Component {
render() {
var left = (
<Left style={{flex:1}}>
<Button onPress={() => this._sideMenuDrawer.open()} transparent>
<Icon name='ios-menu-outline' />
</Button>
</Left>
);
var right = (
<Right style={{flex:1}}>
<Button onPress={() => Actions.search()} transparent>
<Icon name='ios-search-outline' />
</Button>
<Button onPress={() => Actions.cart()} transparent>
<Icon name='ios-cart' />
</Button>
</Right>
);
return(
<SideMenuDrawer ref={(ref) => this._sideMenuDrawer = ref}>
<Container>
<Navbar left={left} right={right} title="MY STORE" />
<Content>
{this.renderCategories()}
</Content>
</Container>
</SideMenuDrawer>
);
}
renderCategories() {
let cat = [];
for(var i=0; i<categories.length; i++) {
cat.push(
<CategoryBlock key={categories[i].id} id={categories[i].id} image={categories[i].image} title={categories[i].title} />
);
}
return cat;
}
}
var categories = [
{
id: 1,
title: 'MEN',
image: 'http://res.cloudinary.com/atf19/image/upload/c_scale,w_489/v1500284127/pexels-photo-497848_yenhuf.jpg'
},
{
id: 2,
title: 'WOMEN',
image: 'http://res.cloudinary.com/atf19/image/upload/c_scale,w_460/v1500284237/pexels-photo-324030_wakzz4.jpg'
},
{
id: 3,
title: 'KIDS',
image: 'http://res.cloudinary.com/atf19/image/upload/c_scale,w_445/v1500284286/child-childrens-baby-children-s_shcevh.jpg'
},
{
id: 4,
title: 'ACCESORIES',
image: 'http://res.cloudinary.com/atf19/image/upload/c_scale,w_467/v1500284346/pexels-photo-293229_qxnjtd.jpg'
}
];