HomeTab.js
4.23 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
import React, { Component } from 'react';
import { View, Text, StyleSheet, SafeAreaView, ScrollView, Image } from 'react-native';
import WasteDetail from '../WasteDetail'
import Circle from '../component/circle_component'
import {Table, TableWrapper, Row,Rows} from 'react-native-table-component'
var date = new Date();
date.setHours(date.getHours()+9);
export default class HomeTab extends Component {
constructor(props){
super(props);
this.state = {
today : date.getFullYear() + "." + date.getMonth() + "." + date.getDate(),
current_weight : 0,
table_contents : [['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],['오후','4:27:52', '+0.12kg', 'Total : 1.38kg'],
['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],
['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],
['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],
['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg'],['오후','6:12:15', '+0.25kg', 'Total : 1.5 kg']
]
}
}
render() {
return (
<View style={style.container}>
<View style={style.header}>
<Text style={style.tabName}>Home</Text>
</View>
<View style={{flexDirection:'row',flex:0.8,backgroundColor: "rgba(230,230,230,0.5)"}}>
<View style={{flex:1,justifyContent:'center'}}>
<Image style={style.img}
source={require("../assets/calendar.jpg")}/>
</View>
<View style={{flex : 8, justifyContent:'center'}}>
<Text style ={style.date_text}>{this.state.today}</Text>
</View>
</View>
<View style={style.current_state}>
<Circle
title={"3.6"}>
</Circle>
</View>
<View style={style.waste_detail}>
<SafeAreaView style={style.scroll_container}>
<ScrollView style={style.scroll_page}>
<Text style={style.history}>Today's History</Text>
<Table>
<TableWrapper>
<Row data={['시간', '증감량', '총량']} flexArr={[2.5, 1.5, 1.5]} textStyle={style.row_style1}/>
<Rows data={this.state.table_contents} flexArr={[1, 1.5, 1.5, 1.5]} textStyle={style.row_style2}/>
</TableWrapper>
</Table>
</ScrollView>
</SafeAreaView>
</View>
</View>
);
}
}
const style = StyleSheet.create({
container: {
flex: 1,
},
header: {
flex :1,
justifyContent : 'center',
},
tabName:{
marginStart : 10,
textAlignVertical : 'center',
fontSize : 20,
color : "#0066cc",
fontWeight: 'bold',
},
current_state:{
flex: 5,
backgroundColor: "rgba(230,230,230,0.5)"
},
waste_detail:{
flex :5,
backgroundColor: "rgba(230,230,230,0.5)",
},
date_text:{
fontSize :20,
marginStart:5,
textAlignVertical:'center'
},
scroll_container : {
flex:1,
},
scroll_page:{
margin:20,
borderWidth : 1,
},
history : {
fontSize : 22,
marginBottom : 5,
marginStart : 5
},
content:{
fontSize : 15,
},
wrapper: {
flexDirection: 'row'
},
row_style1:{
textAlign : 'center',
fontSize : 18,
marginBottom : 5,
borderBottomWidth:1,
},
row_style2:{
borderBottomWidth:1,
marginVertical : 2,
fontSize : 15,
textAlign : 'center',
},
img:{
width :20,
resizeMode : 'contain',
alignSelf:'baseline',
marginStart:10,
},
});