forked from AkshayWarrier/Volunteer-App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TaskCard.js
84 lines (78 loc) · 2.7 KB
/
TaskCard.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
84
import { StyleSheet, Text, View, Image, TouchableOpacity } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import Icon from 'react-native-vector-icons/FontAwesome';
export const TaskCard = (props) => {
const navigation = useNavigation();
const imgsrc = {
"Environmental": require("./assets/images/environment.png"),
"Community": require("./assets/images/community.png"),
"Animal": require("./assets/images/animal.png"),
"Education": require("./assets/images/education.png"),
"Health": require("./assets/images/health.png"),
}
return (
<TouchableOpacity style={styles.container} activeOpacity={0.7}
onPress={() => {navigation.navigate("OrgTaskDescription", {data:props})}}>
<Image source={imgsrc[props.type]} style={styles.image}/>
<View style={styles.textContainer}>
{/* Name */}
<Text style={styles.name}>
{props.name}
</Text>
{/* Type and Location */}
<View>
<Text style={styles.text}>
{`${props.type} `}
{props.type === "Environmental" && <Icon name="tree" size={20} color="#F7FFF7"/>}
{props.type === "Community" && <Icon name="user" size={20} color="#F7FFF7"/>}
{props.type === "Animal" && <Icon name="paw" size={20} color="#F7FFF7"/>}
{props.type === "Education" && <Icon name="book" size={20} color="#F7FFF7"/>}
{props.type === "Health" && <Icon name="medkit" size={20} color="#F7FFF7"/>}
</Text>
<Text style={styles.text}>
{
props.remote ? "Remote " : props.location
}
<Icon name="map-marker" size={20} color="#F7FFF7"/>
</Text>
</View>
</View>
</TouchableOpacity>
);
}
const styles = StyleSheet.create({
container: {
flexDirection: 'column',
width: '100%',
height: 300,
borderRadius: 10,
backgroundColor: "#FF6B6B",
shadowColor: "black",
shadowOpacity: 0.50,
elevation: 10,
overflow: 'hidden',
marginBottom: 20,
},
textContainer: {
flex: 2,
backgroundColor: "#F7FFF7",
padding: 10,
borderBottomLeftRadius: 10,
borderBottomRightRadius: 10,
backgroundColor: "#FF6B6B",
},
image: {
flex: 5,
width: '100%',
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
},
name: {
fontSize: 20,
color: "#F7FFF7",
},
text: {
fontSize: 16,
color: "#F7FFF7",
},
});