Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
rich-maker
Commits
4cd275f1
Commit
4cd275f1
authored
Aug 09, 2021
by
Choi Ga Young
Browse files
focus 에러 해결
parent
7d2182de
Changes
4
Show whitespace changes
Inline
Side-by-side
Analy.js
View file @
4cd275f1
Monthly.js
View file @
4cd275f1
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
Calendar
from
'
./components/Calendar
'
;
import
calApi
from
'
./db/calendarInfo.api
'
;
import
{
useFocus
Effect
}
from
'
@react-navigation/native
'
;
import
{
use
Is
Focus
ed
}
from
'
@react-navigation/native
'
;
const
Montly
=
({
navigation
})
=>
{
const
isFocused
=
useIsFocused
();
const
date
=
new
Date
();
const
[
year
,
setYear
]
=
useState
(
date
.
getFullYear
());
const
[
month
,
setMonth
]
=
useState
(
date
.
getMonth
());
...
...
@@ -23,11 +25,10 @@ const Montly = ({ navigation }) => {
getData
()
},
[
month
])
useFocusEffect
(
React
.
useCallback
(()
=>
{
useEffect
(()
=>
{
getData
()
},
[])
);
},
[
isFocused
])
return
(
<
Calendar
navigation
=
{
navigation
}
MData
=
{
totalM
}
year
=
{
year
}
setYear
=
{
setYear
}
month
=
{
month
}
setMonth
=
{
setMonth
}
todayM
=
{
todayM
}
todayY
=
{
todayY
}
/
>
)
...
...
db/calendarInfo.api.js
View file @
4cd275f1
...
...
@@ -14,7 +14,7 @@ const getFullData = async ({ year, month }) => {
db
.
transaction
(
async
(
tx
)
=>
{
const
[
txn
,
results
]
=
await
tx
.
executeSql
(
`SELECT date, type_id, sum(price) as total from money where date BETWEEN "
${
getDateStr
(
thisFirst
)}
" and "
${
getDateStr
(
thisLast
)}
" group by date, type_id`
);
const
temp
=
[];
if
(
results
.
rows
.
length
!=
0
)
{
if
(
results
.
rows
.
length
!=
=
0
)
{
if
(
results
.
rows
.
item
(
0
).
type_id
===
1
)
{
temp
.
push
({
date
:
results
.
rows
.
item
(
0
).
date
,
type
:
{
'
input
'
:
results
.
rows
.
item
(
0
).
total
}
})
}
...
...
db/chartData.api.js
View file @
4cd275f1
...
...
@@ -35,8 +35,6 @@ const outMoney = async ({ year, month }) => {
}
const
yearMoney
=
async
({
year
})
=>
{
const
yearFirst
=
new
Date
(
year
,
0
,
1
);
const
yearLast
=
new
Date
(
year
,
12
,
0
);
const
db
=
await
getDb
();
return
new
Promise
((
res
,
rej
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment