-
Notifications
You must be signed in to change notification settings - Fork 0
/
CategoryBlock.js
executable file
·83 lines (78 loc) · 1.84 KB
/
CategoryBlock.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 category component used in the home page
**/
// React native and others libraries imports
import React, { Component } from 'react';
import { Image, Dimensions, TouchableOpacity } from 'react-native';
import { View } from 'native-base';
import { Actions } from 'react-native-router-flux';
// Our custom files and classes import
import Text from './Text';
export default class CategoryBlock extends Component {
render() {
return(
<View style={{flex:1}}>
<TouchableOpacity
onPress={this._onPress.bind(this)}
activeOpacity={0.9}
>
<View>
<Image style={styles.image} source={{uri: this.props.image}} />
<View style={styles.overlay} />
<View style={styles.border} />
<View style={styles.text}>
<Text style={styles.title}>{this.props.title}</Text>
<Text style={styles.subtitle}>Shop Now</Text>
</View>
</View>
</TouchableOpacity>
</View>
);
}
_onPress() {
Actions.category({id: this.props.id, title: this.props.title});
}
}
const styles = {
text: {
width: Dimensions.get('window').width,
height: 200,
position: 'absolute',
alignItems: 'center',
justifyContent: 'center',
},
title: {
textAlign: 'center',
color: '#fdfdfd',
fontSize: 32
},
subtitle: {
textAlign: 'center',
color: '#fdfdfd',
fontSize: 16,
fontWeight: '100',
fontStyle: 'italic'
},
overlay: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(30, 42, 54, 0.4)'
},
border: {
position: 'absolute',
top: 10,
left: 10,
right: 10,
bottom: 10,
borderWidth: 1,
borderColor: 'rgba(253, 253, 253, 0.2)'
},
image: {
height: 200,
width: null,
flex: 1
}
};