-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTask.js
54 lines (51 loc) · 1.25 KB
/
Task.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
import React from 'react';
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
const Task = (props) => {
return (
<View style={styles.item} backgroundColor={props.text.color}>
<View style={styles.itemLeft}>
<TouchableOpacity style={props.text.completed? styles.squareCompleted : styles.square} onPress={() => props.toggleSquare(props.index)}></TouchableOpacity>
<Text style={props.text.completed? styles.itemTextCompleted: styles.itemText}>{props.text.task}</Text>
</View>
</View>
)
}
const styles = StyleSheet.create({
item: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: 20,
padding: 5,
borderRadius: 10,
},
itemLeft: {
flexDirection: 'row',
flexWrap: 'wrap',
alignItems: 'center',
},
squareCompleted: {
width: 33,
height: 33,
borderColor: '#FFF',
borderRadius: 50,
borderWidth: 6,
},
square: {
width: 33,
height: 33,
backgroundColor: '#FFF',
borderRadius: 50,
},
itemText:{
marginLeft: 10,
maxWidth: '85%',
},
itemTextCompleted: {
marginLeft: 10,
maxWidth: '85%',
fontStyle: 'italic',
textDecorationLine: 'line-through',
},
});
export default Task;