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

clean 및 에러해결

parent 0c95c768
...@@ -80,7 +80,7 @@ const ChartM = ({ ...@@ -80,7 +80,7 @@ const ChartM = ({
< PieChart < PieChart
data={resDataM} data={resDataM}
width={screenWidth} width={screenWidth}
height={screenHeight / 3} height={screenHeight *0.3}
chartConfig={chartConfig} chartConfig={chartConfig}
accessor={"total"} accessor={"total"}
backgroundColor={"#ffffff"} backgroundColor={"#ffffff"}
...@@ -88,7 +88,7 @@ const ChartM = ({ ...@@ -88,7 +88,7 @@ const ChartM = ({
: <Text style={style.infoText}> 지출 내역이 없습니다.</Text> : <Text style={style.infoText}> 지출 내역이 없습니다.</Text>
} }
<FlatList <FlatList
style={{ backgroundColor: "#FFFFFF", height: screenHeight*0.42 }} style={{ backgroundColor: "#FFFFFF", height: screenHeight*0.51 }}
data={resDataM} data={resDataM}
renderItem={renderChart} renderItem={renderChart}
keyExtractor={item => item.color} keyExtractor={item => item.color}
...@@ -115,7 +115,8 @@ const style = StyleSheet.create({ ...@@ -115,7 +115,8 @@ const style = StyleSheet.create({
fontSize: 30, fontSize: 30,
textAlign: "center", textAlign: "center",
marginTop: "20%", marginTop: "20%",
fontFamily: 'GowunDodum-Regular' fontFamily: 'GowunDodum-Regular',
backgroundColor:'#ffffff'
} }
}); });
......
...@@ -71,8 +71,8 @@ function DeptPage({ navigation }) { ...@@ -71,8 +71,8 @@ function DeptPage({ navigation }) {
<View> <View>
<View style={{ width: '100%', height: '75%' }}> <View style={{ width: '100%', height: '75%' }}>
<TabView value={selectedIndex} onChange={setSelectedIndex} > {selectedIndex === 0 ?
<TabView.Item style={{ width: '100%', height: '100%' }}> <View style={{ width: '100%', height: '100%' }}>
<FlatList <FlatList
data={lend} data={lend}
renderItem={({ item }) => ( renderItem={({ item }) => (
...@@ -81,8 +81,9 @@ function DeptPage({ navigation }) { ...@@ -81,8 +81,9 @@ function DeptPage({ navigation }) {
</TouchableOpacity> </TouchableOpacity>
)} )}
/> />
</TabView.Item> </View>
<TabView.Item style={{ width: '100%', height: '100%' }}> :
<View style={{ width: '100%', height: '100%' }}>
<FlatList <FlatList
data={dept} data={dept}
renderItem={({ item }) => ( renderItem={({ item }) => (
...@@ -91,8 +92,8 @@ function DeptPage({ navigation }) { ...@@ -91,8 +92,8 @@ function DeptPage({ navigation }) {
</TouchableOpacity> </TouchableOpacity>
)} )}
/> />
</TabView.Item> </View>
</TabView> }
</View> </View>
<Ionicons <Ionicons
name='add' name='add'
......
...@@ -54,7 +54,7 @@ const AssetItem = ({ item }) => { ...@@ -54,7 +54,7 @@ const AssetItem = ({ item }) => {
const getMarkedDates = (weeklyData) => { const getMarkedDates = (weeklyData) => {
if (weeklyData.length === 0) { if (weeklyData.length === 0) {
return null; return ([]);
} }
const markedData = weeklyData.map(data => { const markedData = weeklyData.map(data => {
...@@ -65,8 +65,7 @@ const getMarkedDates = (weeklyData) => { ...@@ -65,8 +65,7 @@ const getMarkedDates = (weeklyData) => {
} }
); );
}) })
return (markedData)
return markedData
} }
const getDots = (typeArray) => { const getDots = (typeArray) => {
...@@ -96,7 +95,6 @@ function MainScreen({ navigation }) { ...@@ -96,7 +95,6 @@ function MainScreen({ navigation }) {
const [selectedDate, setSelectedDate] = useState(getDateStr()) const [selectedDate, setSelectedDate] = useState(getDateStr())
const [startingDate, setStartingDate] = useState(initialStartingDate) const [startingDate, setStartingDate] = useState(initialStartingDate)
const [endDate, setEndDate] = useState(initialEndDate)
const [weekMoney, setWeekMoney] = useState({ input: 0, output: 0 }) const [weekMoney, setWeekMoney] = useState({ input: 0, output: 0 })
const [markedDates, setMarkedDates] = useState([]) const [markedDates, setMarkedDates] = useState([])
...@@ -106,16 +104,18 @@ function MainScreen({ navigation }) { ...@@ -106,16 +104,18 @@ function MainScreen({ navigation }) {
const [totalAssetsMoney, setTotalAssetsMoney] = useState([]) const [totalAssetsMoney, setTotalAssetsMoney] = useState([])
useEffect(() => { useEffect(() => {
getthisWeekData(initialStartingDate, initialEndDate) getthisWeekData(initialStartingDate, initialEndDate);
getTotalMoney() getTotalMoney();
getSingleData() getSingleData();
}, [isFocused]) }, [isFocused])
const getthisWeekData = async (start, end) => { const getthisWeekData = async (start, end) => {
const { data, input, output } = await weekApi.getWeeklyData(start, end) const { data, input, output } = await weekApi.getWeeklyData(start, end)
setStartingDate(start) setStartingDate(start)
setWeekMoney({ input: input, output, output }) setWeekMoney({ input: input, output, output })
setTimeout(() => {
setMarkedDates(getMarkedDates(data)) setMarkedDates(getMarkedDates(data))
}, 300)
} }
const getWeeklyData = async (start, end) => { const getWeeklyData = async (start, end) => {
...@@ -152,7 +152,7 @@ function MainScreen({ navigation }) { ...@@ -152,7 +152,7 @@ function MainScreen({ navigation }) {
selectedDate={selectedDate} selectedDate={selectedDate}
startingDate={startingDate} startingDate={startingDate}
onWeekChanged={(start, end) => getWeeklyData(start, end)} onWeekChanged={(start, end) => getWeeklyData(start, end)}
onDateSelected={(date) => setSelectedDate(date)} onDateSelected={(date) => setSelectedDate(getDateStr(date))}
markedDates={markedDates} markedDates={markedDates}
/> />
<View style={style.weekData}> <View style={style.weekData}>
...@@ -165,7 +165,7 @@ function MainScreen({ navigation }) { ...@@ -165,7 +165,7 @@ function MainScreen({ navigation }) {
{ {
singleMoney.length !== 0 ? singleMoney.length !== 0 ?
<View> <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>
: <View style={{ marginTop: 10, marginBottom: 50 }}> : <View style={{ marginTop: 10, marginBottom: 50 }}>
<Text style={{ textAlign: "center", fontSize: 20, fontFamily: 'GowunDodum-Regular' }}>내역이 없습니다.</Text> <Text style={{ textAlign: "center", fontSize: 20, fontFamily: 'GowunDodum-Regular' }}>내역이 없습니다.</Text>
...@@ -195,7 +195,7 @@ function MainScreen({ navigation }) { ...@@ -195,7 +195,7 @@ function MainScreen({ navigation }) {
onClose={() => setOpen(!open)} onClose={() => setOpen(!open)}
> >
<SpeedDial.Action <SpeedDial.Action
icon={<FontAwesome name={'money'} size={20} color={'#fff'}/>} icon={<FontAwesome name={'money'} size={20} color={'#fff'} />}
title="부채" title="부채"
onPress={() => navigation.navigate('DeptPage')} onPress={() => navigation.navigate('DeptPage')}
/> />
......
...@@ -51,9 +51,9 @@ const PostMoney = ({ navigation }) => { ...@@ -51,9 +51,9 @@ const PostMoney = ({ navigation }) => {
useEffect(() => { useEffect(() => {
let isProper = false let isProper = false
if (selectedIndex === 2) { 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 { } 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) { if (isProper) {
...@@ -121,7 +121,9 @@ const PostMoney = ({ navigation }) => { ...@@ -121,7 +121,9 @@ const PostMoney = ({ navigation }) => {
} }
if (success) { if (success) {
setTimeout(() => {
navigation.goBack() navigation.goBack()
}, 500)
} }
return ( return (
...@@ -131,7 +133,7 @@ const PostMoney = ({ navigation }) => { ...@@ -131,7 +133,7 @@ const PostMoney = ({ navigation }) => {
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<View> <View>
<ButtonsForm <ButtonsForm
onPress={(index) => {setSelectedIndex(index); Keyboard.dismiss();}} onPress={(index) => { setSelectedIndex(index); Keyboard.dismiss(); }}
selectedIndex={selectedIndex} selectedIndex={selectedIndex}
group={["수입", "지출", "이동"]} /> group={["수입", "지출", "이동"]} />
<DatePicker <DatePicker
......
...@@ -134,8 +134,11 @@ function updatePage({ navigation, route }) { ...@@ -134,8 +134,11 @@ function updatePage({ navigation, route }) {
} }
if (success) { if (success) {
setTimeout(() => {
navigation.goBack() navigation.goBack()
}, 500)
} }
return ( return (
<TouchableWithoutFeedback onPress={() => { <TouchableWithoutFeedback onPress={() => {
Keyboard.dismiss(); 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