Showing
2 changed files
with
8 additions
and
2 deletions
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import { View, Text, StyleSheet, TextInput, TouchableOpacity, Image } from 'react-native'; | 2 | import { View, Text, StyleSheet, TextInput, TouchableOpacity, Image } from 'react-native'; |
3 | import AddButton from '../component/AddButton' | 3 | import AddButton from '../component/AddButton' |
4 | +import {delete_all_data} from '../component/DBhelper' | ||
4 | 5 | ||
5 | var date = new Date(); | 6 | var date = new Date(); |
6 | date.setHours(date.getHours()+9); | 7 | date.setHours(date.getHours()+9); |
7 | -date.setMonth(date.getMonth()+1); | ||
8 | 8 | ||
9 | export default class SettingTab extends Component { | 9 | export default class SettingTab extends Component { |
10 | 10 | ||
... | @@ -40,7 +40,8 @@ export default class SettingTab extends Component { | ... | @@ -40,7 +40,8 @@ export default class SettingTab extends Component { |
40 | 40 | ||
41 | delete_id(){ | 41 | delete_id(){ |
42 | this.setState({ID: ''}) | 42 | this.setState({ID: ''}) |
43 | - //기기연결 해제, 디비비우기 | 43 | + save_app_data() |
44 | + delete_all_data() | ||
44 | } | 45 | } |
45 | render() { | 46 | render() { |
46 | return ( | 47 | return ( | ... | ... |
... | @@ -82,6 +82,11 @@ export function get_today_data(today){ | ... | @@ -82,6 +82,11 @@ export function get_today_data(today){ |
82 | return list; | 82 | return list; |
83 | } | 83 | } |
84 | 84 | ||
85 | +export function delete_all_data(today){ | ||
86 | + let all_wastes = realm.objects('Waste'); | ||
87 | + realm.delete(all_wastes); | ||
88 | +} | ||
89 | + | ||
85 | var get_date = function (date){ | 90 | var get_date = function (date){ |
86 | return pad(date.getFullyear(),4)+pad(date.getMonth()+1, 2)+ pad(date.getDate(), 2) | 91 | return pad(date.getFullyear(),4)+pad(date.getMonth()+1, 2)+ pad(date.getDate(), 2) |
87 | } | 92 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment