Commit 9a694c44 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

clean 및 에러해결

parent 0c95c768
......@@ -80,7 +80,7 @@ const ChartM = ({
< PieChart
data={resDataM}
width={screenWidth}
height={screenHeight / 3}
height={screenHeight *0.3}
chartConfig={chartConfig}
accessor={"total"}
backgroundColor={"#ffffff"}
......@@ -88,7 +88,7 @@ const ChartM = ({
: <Text style={style.infoText}> 지출 내역이 없습니다.</Text>
}
<FlatList
style={{ backgroundColor: "#FFFFFF", height: screenHeight*0.42 }}
style={{ backgroundColor: "#FFFFFF", height: screenHeight*0.51 }}
data={resDataM}
renderItem={renderChart}
keyExtractor={item => item.color}
......@@ -115,7 +115,8 @@ const style = StyleSheet.create({
fontSize: 30,
textAlign: "center",
marginTop: "20%",
fontFamily: 'GowunDodum-Regular'
fontFamily: 'GowunDodum-Regular',
backgroundColor:'#ffffff'
}
});
......
......@@ -2,14 +2,14 @@ import React, { useState, useEffect } from 'react';
import { StyleSheet, View, FlatList, TouchableOpacity, Modal, TouchableWithoutFeedback, Keyboard } from 'react-native';
import TodoItem from './components/TodoItem';
import Ionicons from 'react-native-vector-icons/Ionicons';
import ButtonsForm from './components/ButtonsForm';
import ButtonsForm from './components/ButtonsForm';
import DeptForm from './screens/DeptForm';
import { TabView } from 'react-native-elements';
import deptApi from './db/deptPage.api';
function DeptPage({ navigation }) {
const [lend, setLend] = useState([])
const [dept, setDept] = useState([])
const [lend, setLend] = useState([])
const [dept, setDept] = useState([])
const [selectedIndex, setSelectedIndex] = useState(0)
const [modallOpen, setModallOpen] = useState(false);
......@@ -23,7 +23,7 @@ function DeptPage({ navigation }) {
}
}
const loadDept = async () => {
const loadDept = async () => {
try {
const deptArray = await deptApi.selectLoan("빌린금액")
setDept(deptArray);
......@@ -44,7 +44,7 @@ function DeptPage({ navigation }) {
info['loan'] = "빌려준금액"
}
await deptApi.insertDept(info)
setModallOpen(false);
setModallOpen(false);
loadLoan()
}
......@@ -53,7 +53,7 @@ function DeptPage({ navigation }) {
loadLoan()
}
useEffect(() => {
useEffect(() => {
loadLoan()
}, [])
......@@ -71,8 +71,8 @@ function DeptPage({ navigation }) {
<View>
<View style={{ width: '100%', height: '75%' }}>
<TabView value={selectedIndex} onChange={setSelectedIndex} >
<TabView.Item style={{ width: '100%', height: '100%' }}>
{selectedIndex === 0 ?
<View style={{ width: '100%', height: '100%' }}>
<FlatList
data={lend}
renderItem={({ item }) => (
......@@ -81,8 +81,9 @@ function DeptPage({ navigation }) {
</TouchableOpacity>
)}
/>
</TabView.Item>
<TabView.Item style={{ width: '100%', height: '100%' }}>
</View>
:
<View style={{ width: '100%', height: '100%' }}>
<FlatList
data={dept}
renderItem={({ item }) => (
......@@ -91,13 +92,13 @@ function DeptPage({ navigation }) {
</TouchableOpacity>
)}
/>
</TabView.Item>
</TabView>
</View>
}
</View>
<Ionicons
name='add'
size={24}
style={style.modalToggle}
style={style.modalToggle}
onPress={() => setModallOpen(true)}
/>
</View>
......@@ -131,14 +132,14 @@ const style = StyleSheet.create({
},
modalToggle: {
borderWidth: 1,
borderColor: 'gray',
borderColor: 'gray',
padding: 5,
borderRadius: 10,
alignSelf: 'center',
alignSelf: 'center',
},
modalContent: {
flex: 1,
flex: 1,
}
});
......
......@@ -54,7 +54,7 @@ const AssetItem = ({ item }) => {
const getMarkedDates = (weeklyData) => {
if (weeklyData.length === 0) {
return null;
return ([]);
}
const markedData = weeklyData.map(data => {
......@@ -65,8 +65,7 @@ const getMarkedDates = (weeklyData) => {
}
);
})
return markedData
return (markedData)
}
const getDots = (typeArray) => {
......@@ -96,7 +95,6 @@ function MainScreen({ navigation }) {
const [selectedDate, setSelectedDate] = useState(getDateStr())
const [startingDate, setStartingDate] = useState(initialStartingDate)
const [endDate, setEndDate] = useState(initialEndDate)
const [weekMoney, setWeekMoney] = useState({ input: 0, output: 0 })
const [markedDates, setMarkedDates] = useState([])
......@@ -106,16 +104,18 @@ function MainScreen({ navigation }) {
const [totalAssetsMoney, setTotalAssetsMoney] = useState([])
useEffect(() => {
getthisWeekData(initialStartingDate, initialEndDate)
getTotalMoney()
getSingleData()
getthisWeekData(initialStartingDate, initialEndDate);
getTotalMoney();
getSingleData();
}, [isFocused])
const getthisWeekData = async (start, end) => {
const { data, input, output } = await weekApi.getWeeklyData(start, end)
setStartingDate(start)
setWeekMoney({ input: input, output, output })
setMarkedDates(getMarkedDates(data))
setTimeout(() => {
setMarkedDates(getMarkedDates(data))
}, 300)
}
const getWeeklyData = async (start, end) => {
......@@ -152,7 +152,7 @@ function MainScreen({ navigation }) {
selectedDate={selectedDate}
startingDate={startingDate}
onWeekChanged={(start, end) => getWeeklyData(start, end)}
onDateSelected={(date) => setSelectedDate(date)}
onDateSelected={(date) => setSelectedDate(getDateStr(date))}
markedDates={markedDates}
/>
<View style={style.weekData}>
......@@ -165,7 +165,7 @@ function MainScreen({ navigation }) {
{
singleMoney.length !== 0 ?
<View>
{singleMoney.length !== 0 && singleMoney.map((item, index) => <DetailItem item={item} key={index} onPress={() => navigation.navigate('UpdatePage', [selectedDate, item])}/>)}
{singleMoney.length !== 0 && singleMoney.map((item, index) => <DetailItem item={item} key={index} onPress={() => navigation.navigate('UpdatePage', [selectedDate, item])} />)}
</View>
: <View style={{ marginTop: 10, marginBottom: 50 }}>
<Text style={{ textAlign: "center", fontSize: 20, fontFamily: 'GowunDodum-Regular' }}>내역이 없습니다.</Text>
......@@ -195,7 +195,7 @@ function MainScreen({ navigation }) {
onClose={() => setOpen(!open)}
>
<SpeedDial.Action
icon={<FontAwesome name={'money'} size={20} color={'#fff'}/>}
icon={<FontAwesome name={'money'} size={20} color={'#fff'} />}
title="부채"
onPress={() => navigation.navigate('DeptPage')}
/>
......
......@@ -37,10 +37,10 @@ const PostMoney = ({ navigation }) => {
const [subcategories, setSubcategories] = useState([])
const [selected_subcat, setSelected_subcat] = useState(INIT_SUBCATEGORY)
const [disabled, setDisabled] = useState(true)
const [success, setSuccess] = useState(false)
useEffect(() => {
loadCat()
loadSubCat()
......@@ -51,9 +51,9 @@ const PostMoney = ({ navigation }) => {
useEffect(() => {
let isProper = false
if (selectedIndex === 2) {
isProper = [contents, price, selected_asset_type.value, selected_deposit_asset_type.value, selected_cat.value].every( elem => elem !== '')
isProper = [contents, price, selected_asset_type.value, selected_deposit_asset_type.value, selected_cat.value].every(elem => elem !== '')
} else {
isProper = [contents, price, selected_asset_type.value, selected_cat.value].every( elem => elem !== '')
isProper = [contents, price, selected_asset_type.value, selected_cat.value].every(elem => elem !== '')
}
if (isProper) {
......@@ -121,9 +121,11 @@ const PostMoney = ({ navigation }) => {
}
if (success) {
navigation.goBack()
setTimeout(() => {
navigation.goBack()
}, 500)
}
return (
<TouchableWithoutFeedback onPress={() => {
Keyboard.dismiss();
......@@ -131,7 +133,7 @@ const PostMoney = ({ navigation }) => {
<View style={{ flex: 1 }}>
<View>
<ButtonsForm
onPress={(index) => {setSelectedIndex(index); Keyboard.dismiss();}}
onPress={(index) => { setSelectedIndex(index); Keyboard.dismiss(); }}
selectedIndex={selectedIndex}
group={["수입", "지출", "이동"]} />
<DatePicker
......
......@@ -134,8 +134,11 @@ function updatePage({ navigation, route }) {
}
if (success) {
navigation.goBack()
setTimeout(() => {
navigation.goBack()
}, 500)
}
return (
<TouchableWithoutFeedback onPress={() => {
Keyboard.dismiss();
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment