-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHome.js
More file actions
198 lines (187 loc) · 4.31 KB
/
Home.js
File metadata and controls
198 lines (187 loc) · 4.31 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
import React, { Component } from "react";
import { Actions } from "react-native-router-flux";
import { Text, View, StyleSheet, Alert, Button } from "react-native";
import { Agenda } from "react-native-calendars";
import {
Container,
Header,
Content,
Footer,
FooterTab,
Button as Btn,
Icon,
Badge,
Image,
Left,
Right,
Card,
CardItem,
CheckBox
} from "native-base";
const goToAbout = () => {
Actions.about();
};
const goToReward = () => {
Actions.reward()
}
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {
items: {
"2020-06-14": [
{
height: 50,
name: "밥먹기"
}
],
"2020-06-17": [
{
height: 50,
name: "마라톤경기"
}
]
},
data: [],
tempDate: ""
};
}
updateDate(temp) {
this.setState({ tempDate: temp });
}
render() {
return (
<Container>
<Header style={styles.header}>
<Text style={styles.headerText}>Plan-IT</Text>
<Right>
<Btn style={styles.btn}>
<Icon name="person" />
</Btn>
<Btn style={styles.btn}>
<Icon name="menu" />
</Btn>
</Right>
</Header>
<Card style={styles.card}>
<Text style={styles.content_text1}>신영훈님의</Text>
<Text style={styles.content_text2}>일상을 응원합니다:)</Text>
</Card>
<Agenda
items={this.state.items}
onDayPress={this.onDayPress.bind(this)}
selected={"2020-06-16"}
renderItem={this.renderItem.bind(this)}
renderEmptyData={this.renderEmptyData.bind(this)}
rowHasChanged={this.rowHasChanged.bind(this)}
/>
<Footer>
<FooterTab style={styles.footer}>
<Btn vertical onPress={ goToReward }>
<Icon name="ribbon" />
<Text style={styles.footer_text}>리워드샵 </Text>
</Btn>
<Btn active vertical style={styles.btn}>
<Icon name="home" />
<Text style={styles.footer_text}>홈</Text>
</Btn>
<Btn vertical>
<Icon name="chatbubbles" />
<Text style={styles.footer_text}>커뮤니티</Text>
</Btn>
</FooterTab>
</Footer>
</Container>
);
}
onDayPress(day) {
const temp = day.dateString;
this.updateDate(temp);
}
renderItem(item) {
return (
<View style={[styles.item, { height: item.height }]}>
<Text marginBottom="10" >{item.name}</Text>
<Button
title="일정 수정"
onPress={goToAbout}
width="50"
/>
</View>
);
}
renderEmptyData() {
return (
<View style={styles.emptyDate}>
<Button
title="일정 추가"
onPress={goToAbout}
style={styles.addAndUpdate}
/>
</View>
);
}
rowHasChanged(r1, r2) {
return r1.name !== r2.name;
}
}
const styles = StyleSheet.create({
item: {
backgroundColor: "aliceblue",
flex: 1,
borderRadius: 5,
padding: 10,
marginRight: 10,
marginTop: 17
},
emptyDate: {
height: 15,
flex: 1,
paddingTop: 30
},
card: {
// rounded: true,
marginTop: 10,
marginLeft: 20,
marginRight: 20,
backgroundColor: "snow",
},
header: {
backgroundColor: "dodgerblue",
textAlign: "auto"
},
headerText: {
color: "white",
fontWeight: "900",
fontSize: 20,
// marginRight: 250,
textAlignVertical: "center",
textAlign: "left"
},
content_text1: {
color: "#CC9933",
textAlign: "left",
fontWeight: "bold",
fontSize: 25,
marginLeft: 27,
marginTop: 80
},
content_text2: {
color: "#CC9933",
textAlign: "left",
fontWeight: "bold",
fontSize: 25,
marginLeft: 27,
marginBottom: 80
},
footer: {
backgroundColor: "dodgerblue"
},
btn: {
backgroundColor: "dodgerblue"
},
footer_text: {
color: "white",
textShadowColor: "black"
}
});