Showing
9 changed files
with
6 additions
and
140 deletions
| 1 | -import React, { Component } from 'react'; | ||
| 2 | -import { View, Text, StyleSheet } from 'react-native'; | ||
| 3 | - | ||
| 4 | -export default class HomeTab extends Component { | ||
| 5 | - render() { | ||
| 6 | - return ( | ||
| 7 | - <View style={style.container}> | ||
| 8 | - <Text>HistoryTab</Text> | ||
| 9 | - </View> | ||
| 10 | - ); | ||
| 11 | - } | ||
| 12 | -} | ||
| 13 | - | ||
| 14 | -const style = StyleSheet.create({ | ||
| 15 | - container: { | ||
| 16 | - flex: 1, | ||
| 17 | - alignItems: 'center', | ||
| 18 | - justifyContent: 'center', | ||
| 19 | - } | ||
| 20 | -}); |
| 1 | -import React, { Component } from 'react'; | ||
| 2 | -import { View, Text, StyleSheet } from 'react-native'; | ||
| 3 | -import WasteDetail from '../WasteDetail' | ||
| 4 | - | ||
| 5 | -export default class HomeTab extends Component { | ||
| 6 | - render() { | ||
| 7 | - return ( | ||
| 8 | - <View style={style.container}> | ||
| 9 | - <Text>HomeTab</Text> | ||
| 10 | - <WasteDetail></WasteDetail> | ||
| 11 | - </View> | ||
| 12 | - ); | ||
| 13 | - } | ||
| 14 | -} | ||
| 15 | - | ||
| 16 | -const style = StyleSheet.create({ | ||
| 17 | - container: { | ||
| 18 | - flex: 1, | ||
| 19 | - } | ||
| 20 | -}); |
| 1 | -import React, { Component } from 'react'; | ||
| 2 | -import { View, Text, StyleSheet } from 'react-native'; | ||
| 3 | - | ||
| 4 | -export default class HomeTab extends Component { | ||
| 5 | - render() { | ||
| 6 | - return ( | ||
| 7 | - <View style={style.container}> | ||
| 8 | - <Text>SettingTab</Text> | ||
| 9 | - </View> | ||
| 10 | - ); | ||
| 11 | - } | ||
| 12 | -} | ||
| 13 | - | ||
| 14 | -const style = StyleSheet.create({ | ||
| 15 | - container: { | ||
| 16 | - flex: 1, | ||
| 17 | - alignItems: 'center', | ||
| 18 | - justifyContent: 'center', | ||
| 19 | - } | ||
| 20 | -}); |
components/MainScreen.js
deleted
100644 → 0
| 1 | -import React, { Component } from 'react'; | ||
| 2 | -import { StyleSheet, Platform, View, Text } from 'react-native'; | ||
| 3 | -import { createAppContainer } from 'react-navigation'; | ||
| 4 | -import { createMaterialTopTabNavigator } from 'react-navigation-tabs' | ||
| 5 | -import HomeTab from './AppTabNavigator/HomeTab' | ||
| 6 | -import HistoryTab from './AppTabNavigator/HistoryTab' | ||
| 7 | -import SettingTab from './AppTabNavigator/SettingTab' | ||
| 8 | - | ||
| 9 | -// 하단 탭 네비게이터 생성 | ||
| 10 | -const AppTabNavigator = createMaterialTopTabNavigator({ | ||
| 11 | - Home: { screen: HomeTab }, | ||
| 12 | - History: { screen: HistoryTab }, | ||
| 13 | - Setting: { screen: SettingTab } | ||
| 14 | -},{ | ||
| 15 | - animationEnabled: true, | ||
| 16 | - swipeEnabled: true, | ||
| 17 | - tabBarPosition: "bottom", | ||
| 18 | - tabBarOptions: { | ||
| 19 | - style: { | ||
| 20 | - ...Platform.select({ | ||
| 21 | - android:{ | ||
| 22 | - backgroundColor:'white', | ||
| 23 | - } | ||
| 24 | - }) | ||
| 25 | - }, | ||
| 26 | - iconStyle: { height: 10 }, | ||
| 27 | - activeTintColor: '#000', | ||
| 28 | - inactiveTintColor: '#d1cece', | ||
| 29 | - upperCaseLabel: true, | ||
| 30 | - showLabel: true, | ||
| 31 | - showIcon: true, | ||
| 32 | - } | ||
| 33 | -}); | ||
| 34 | - | ||
| 35 | -const AppTabContainet = createAppContainer(AppTabNavigator); | ||
| 36 | - | ||
| 37 | -export default class MainScreen extends Component { | ||
| 38 | - | ||
| 39 | - static navigationOptions = { | ||
| 40 | - title: 'FW IOT' } | ||
| 41 | - | ||
| 42 | - render() { | ||
| 43 | - return <AppTabContainet/>; // AppTabContainet 컴포넌트를 리턴한다. | ||
| 44 | - } | ||
| 45 | -} | ||
| 46 | - | ||
| 47 | -const styles = StyleSheet.create({ | ||
| 48 | - container: { | ||
| 49 | - flex: 1, | ||
| 50 | - alignItems: 'center', | ||
| 51 | - justifyContent: 'center', | ||
| 52 | - }, | ||
| 53 | -}); |
components/WasteDetail.js
deleted
100644 → 0
| 1 | -import React, { Component } from 'react'; | ||
| 2 | -import { View, Text, StyleSheet } from 'react-native'; | ||
| 3 | - | ||
| 4 | -export default class HomeTab extends Component { | ||
| 5 | - render() { | ||
| 6 | - return ( | ||
| 7 | - <View style={style.container}> | ||
| 8 | - <Text>총 3.8kg 추가</Text> | ||
| 9 | - </View> | ||
| 10 | - ); | ||
| 11 | - } | ||
| 12 | -} | ||
| 13 | - | ||
| 14 | -const style = StyleSheet.create({ | ||
| 15 | - container: { | ||
| 16 | - flex: 1, | ||
| 17 | - backgroundColor: "rgba(230,230,230,0.5)" | ||
| 18 | - } | ||
| 19 | -}); |
| ... | @@ -2,7 +2,7 @@ import React, { Component } from 'react'; | ... | @@ -2,7 +2,7 @@ import React, { Component } from 'react'; |
| 2 | import { View, Text, StyleSheet,ScrollView, RefreshControl } from 'react-native'; | 2 | import { View, Text, StyleSheet,ScrollView, RefreshControl } from 'react-native'; |
| 3 | import HistoryGraph from '../component/HistoryGraph' | 3 | import HistoryGraph from '../component/HistoryGraph' |
| 4 | import SegmentedControlTab from "react-native-segmented-control-tab"; | 4 | import SegmentedControlTab from "react-native-segmented-control-tab"; |
| 5 | -import {get_id, add_data, get_week_data, get_month_data, get_year_data} from'../component/DBhelper.js'; | 5 | +import {get_id, add_data, get_week_data, get_month_data, get_year_data, get_recent_date} from'../component/DBhelper.js'; |
| 6 | 6 | ||
| 7 | //var today = new Date(); | 7 | //var today = new Date(); |
| 8 | //today.setHours(today.getHours()+9); | 8 | //today.setHours(today.getHours()+9); |
| ... | @@ -68,7 +68,7 @@ export default class HomeTab extends Component { | ... | @@ -68,7 +68,7 @@ export default class HomeTab extends Component { |
| 68 | }, | 68 | }, |
| 69 | body:JSON.stringify({ | 69 | body:JSON.stringify({ |
| 70 | ras_id : this.state.ID, | 70 | ras_id : this.state.ID, |
| 71 | - date : "1576339901541", | 71 | + date : String(get_recent_date()), |
| 72 | }), | 72 | }), |
| 73 | }) | 73 | }) |
| 74 | .then((response) => response.json()) | 74 | .then((response) => response.json()) | ... | ... |
| ... | @@ -2,7 +2,7 @@ import React, { Component } from 'react'; | ... | @@ -2,7 +2,7 @@ import React, { Component } from 'react'; |
| 2 | import { View, Text, StyleSheet, SafeAreaView, ScrollView, Image } from 'react-native'; | 2 | import { View, Text, StyleSheet, SafeAreaView, ScrollView, Image } from 'react-native'; |
| 3 | import Circle from '../component/circle_component' | 3 | import Circle from '../component/circle_component' |
| 4 | import {Table, TableWrapper, Row,Rows} from 'react-native-table-component' | 4 | import {Table, TableWrapper, Row,Rows} from 'react-native-table-component' |
| 5 | -import {get_now_weight, get_today_data, add_data ,get_id} from'../component/DBhelper.js'; | 5 | +import {get_now_weight, get_today_data, add_data ,get_id, get_recent_date} from'../component/DBhelper.js'; |
| 6 | 6 | ||
| 7 | var date = new Date(); | 7 | var date = new Date(); |
| 8 | date.setHours(date.getHours()+9); | 8 | date.setHours(date.getHours()+9); |
| ... | @@ -41,7 +41,7 @@ export default class HomeTab extends Component { | ... | @@ -41,7 +41,7 @@ export default class HomeTab extends Component { |
| 41 | }, | 41 | }, |
| 42 | body:JSON.stringify({ | 42 | body:JSON.stringify({ |
| 43 | ras_id : this.state.ID, | 43 | ras_id : this.state.ID, |
| 44 | - date : "1576648647000", | 44 | + date : String(get_recent_date()), |
| 45 | }), | 45 | }), |
| 46 | }) | 46 | }) |
| 47 | .then((response) => response.json()) | 47 | .then((response) => response.json()) |
| ... | @@ -83,7 +83,7 @@ export default class HomeTab extends Component { | ... | @@ -83,7 +83,7 @@ export default class HomeTab extends Component { |
| 83 | <Text style={style.history}>Today's History</Text> | 83 | <Text style={style.history}>Today's History</Text> |
| 84 | <Table> | 84 | <Table> |
| 85 | <TableWrapper> | 85 | <TableWrapper> |
| 86 | - <Row data={['시간', '증감량', '총량']} flexArr={[1, 1, 1]} textStyle={style.row_style1}/> | 86 | + <Row data={['시간', '증가량', '총량']} flexArr={[1, 1, 1]} textStyle={style.row_style1}/> |
| 87 | <Rows data={this.state.table_contents} flexArr={[1, 1, 1]} textStyle={style.row_style2}/> | 87 | <Rows data={this.state.table_contents} flexArr={[1, 1, 1]} textStyle={style.row_style2}/> |
| 88 | </TableWrapper> | 88 | </TableWrapper> |
| 89 | 89 | ... | ... |
| ... | @@ -57,8 +57,6 @@ export default class Login extends Component { | ... | @@ -57,8 +57,6 @@ export default class Login extends Component { |
| 57 | onChangeText={(text) => {this.setState({ID:text})}} | 57 | onChangeText={(text) => {this.setState({ID:text})}} |
| 58 | /> | 58 | /> |
| 59 | <LoginButton | 59 | <LoginButton |
| 60 | - //onPress={()=>{this.getdata}} | ||
| 61 | - //onPress={() =>{ this.props.navigation.navigate('MainScreen', { ID: this.state.ID });}} | ||
| 62 | onPress={() =>{ this.getdata().then(()=>{this.props.navigation.navigate('MainScreen', { ID: this.state.ID })}) }} | 60 | onPress={() =>{ this.getdata().then(()=>{this.props.navigation.navigate('MainScreen', { ID: this.state.ID })}) }} |
| 63 | /> | 61 | /> |
| 64 | </View> | 62 | </View> | ... | ... |
| ... | @@ -49,7 +49,7 @@ export default class MainScreen extends Component { | ... | @@ -49,7 +49,7 @@ export default class MainScreen extends Component { |
| 49 | 49 | ||
| 50 | render() { | 50 | render() { |
| 51 | registerID(this.state.ID); | 51 | registerID(this.state.ID); |
| 52 | - return <AppTabContainer/>; // AppTabContainet 컴포넌트를 리턴한다. | 52 | + return <AppTabContainer/>; // AppTabContainer 컴포넌트를 리턴한다. |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | 55 | ... | ... |
-
Please register or login to post a comment