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
3912238f
Commit
3912238f
authored
Aug 08, 2021
by
YoonDongMin
Browse files
0808DM
parent
ff89d354
Changes
8
Hide whitespace changes
Inline
Side-by-side
MainScreen.js
View file @
3912238f
import
React
,
{
useState
}
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
Button
,
Keyboard
,
TouchableWithoutFeedback
,
Modal
}
from
'
react-native
'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
Button
,
Keyboard
,
TouchableWithoutFeedback
,
Modal
}
from
'
react-native
'
;
import
{
SpeedDial
}
from
'
react-native-elements
'
;
import
{
SpeedDial
}
from
'
react-native-elements
'
;
import
WeeklyCalendar
from
'
./components/WeeklyCalendar
'
;
import
WeeklyCalendar
from
'
./components/WeeklyCalendar
'
;
...
@@ -36,15 +36,18 @@ function MainScreen({ navigation }) {
...
@@ -36,15 +36,18 @@ function MainScreen({ navigation }) {
title
=
"
월별 페이지로 이동
"
title
=
"
월별 페이지로 이동
"
onPress
=
{()
=>
navigation
.
navigate
(
'
Monthly
'
)}
onPress
=
{()
=>
navigation
.
navigate
(
'
Monthly
'
)}
/
>
/
>
<
SpeedDial
<
SpeedDial
isOpen
=
{
open
}
isOpen
=
{
open
}
icon
=
{{
name
:
'
edit
'
,
color
:
'
#fff
'
}}
//연필모양
icon
=
{{
name
:
'
edit
'
,
color
:
'
#fff
'
,
backgroundcolor
:
'
skyblue
'
}}
//연필모양
openIcon
=
{{
name
:
'
close
'
,
color
:
'
#fff
'
}}
//x모양
openIcon
=
{{
name
:
'
close
'
,
color
:
'
#fff
'
,
backgroundcolor
:
'
orange
'
}}
//x모양
onOpen
=
{()
=>
setOpen
(
!
open
)}
onOpen
=
{()
=>
setOpen
(
!
open
)}
onClose
=
{()
=>
setOpen
(
!
open
)}
onClose
=
{()
=>
setOpen
(
!
open
)}
>
>
<
SpeedDial
.
Action
<
SpeedDial
.
Action
icon
=
{{
name
:
'
add
'
,
color
:
'
#fff
'
}}
icon
=
{{
name
:
'
add
'
,
color
:
'
white
'
}}
title
=
"
부채
"
title
=
"
부채
"
onPress
=
{()
=>
navigation
.
navigate
(
'
DeptPage
'
)}
onPress
=
{()
=>
navigation
.
navigate
(
'
DeptPage
'
)}
/
>
/
>
...
...
MemoPage.js
View file @
3912238f
...
@@ -7,7 +7,6 @@ import memoApi from './db/memoPage.api';
...
@@ -7,7 +7,6 @@ import memoApi from './db/memoPage.api';
function
MemoPage
({
navigation
})
{
function
MemoPage
({
navigation
})
{
const
[
memos
,
setMemos
]
=
useState
([])
const
[
memos
,
setMemos
]
=
useState
([])
const
[
selectedIndex
,
setSelectedIndex
]
=
useState
(
0
)
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
);
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
);
const
loadMemos
=
async
()
=>
{
const
loadMemos
=
async
()
=>
{
...
...
components/DatePicker.js
View file @
3912238f
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
Button
,
View
,
Text
,
StyleSheet
,
Pressable
}
from
"
react-native
"
;
import
{
Button
,
View
,
Text
,
StyleSheet
,
Pressable
}
from
"
react-native
"
;
import
DateTimePickerModal
from
"
react-native-modal-datetime-picker
"
;
import
DateTimePickerModal
from
"
react-native-modal-datetime-picker
"
;
import
{
getDateStr
}
from
'
../utils/dateFunction
'
;
const
DatePicker
=
(
props
)
=>
{
const
DatePicker
=
(
props
)
=>
{
const
[
isDatePickerVisible
,
setDatePickerVisibility
]
=
useState
(
false
);
const
[
isDatePickerVisible
,
setDatePickerVisibility
]
=
useState
(
false
);
...
@@ -14,8 +14,8 @@ const DatePicker = (props) => {
...
@@ -14,8 +14,8 @@ const DatePicker = (props) => {
};
};
const
handleConfirm
=
(
date
)
=>
{
const
handleConfirm
=
(
date
)
=>
{
console
.
log
(
"
A date has been picked:
"
,
String
(
date
.
toJSON
()).
split
(
/T/
)[
0
]
);
console
.
log
(
"
A date has been picked:
"
,
getDateStr
(
date
)
);
props
.
setDate
(
String
(
date
.
toJSON
()).
split
(
/T/
)[
0
]
)
props
.
setDate
(
getDateStr
(
date
)
)
hideDatePicker
();
hideDatePicker
();
};
};
...
...
screens/DeptDetails.js
View file @
3912238f
...
@@ -5,14 +5,15 @@ import InputBox from '../components/InputBox';
...
@@ -5,14 +5,15 @@ import InputBox from '../components/InputBox';
import
StyledButton
from
'
../components/StyledButton
'
;
import
StyledButton
from
'
../components/StyledButton
'
;
import
DatePicker
from
'
../components/DatePicker.js
'
;
import
DatePicker
from
'
../components/DatePicker.js
'
;
import
deptApi
from
'
../db/deptPage.api
'
;
import
deptApi
from
'
../db/deptPage.api
'
;
import
{
getDateStr
}
from
'
../utils/dateFunction
'
;
function
DeptDetails
({
route
,
navigation
})
{
function
DeptDetails
({
route
,
navigation
})
{
const
{
item
,
loadLoan
}
=
route
.
params
const
{
item
,
loadLoan
}
=
route
.
params
const
getDate
=
()
=>
{
const
getDate
s
=
()
=>
{
var
date
=
new
Date
();
const
date
=
new
Date
();
return
(
String
(
date
.
toJSON
()).
split
(
/T/
)[
0
]
)
return
(
getDateStr
(
date
)
)
}
}
const
[
date
,
setDate
]
=
useState
(
getDate
())
const
[
date
,
setDate
]
=
useState
(
getDate
s
())
const
[
message
,
setMessage
]
=
useState
(
''
)
const
[
message
,
setMessage
]
=
useState
(
''
)
const
[
money
,
setMoney
]
=
useState
(
''
)
const
[
money
,
setMoney
]
=
useState
(
''
)
const
[
remained_money
,
setRemained_money
]
=
useState
(
''
)
const
[
remained_money
,
setRemained_money
]
=
useState
(
''
)
...
...
screens/DeptForm.js
View file @
3912238f
...
@@ -5,6 +5,7 @@ import { Formik } from 'formik';
...
@@ -5,6 +5,7 @@ import { Formik } from 'formik';
import
*
as
yup
from
'
yup
'
;
import
*
as
yup
from
'
yup
'
;
import
DatePicker
from
'
../components/DatePicker.js
'
;
import
DatePicker
from
'
../components/DatePicker.js
'
;
import
InputBox
from
'
../components/InputBox
'
;
import
InputBox
from
'
../components/InputBox
'
;
import
{
getDateStr
}
from
'
../utils/dateFunction
'
;
const
ReviewSchema
=
yup
.
object
({
const
ReviewSchema
=
yup
.
object
({
date
:
yup
.
string
()
//string만 받는다
date
:
yup
.
string
()
//string만 받는다
...
@@ -18,11 +19,11 @@ const ReviewSchema = yup.object({
...
@@ -18,11 +19,11 @@ const ReviewSchema = yup.object({
.
required
()
.
required
()
})
})
const
getDate
=
()
=>
{
const
getDate
s
=
()
=>
{
var
date
=
new
Date
();
const
date
=
new
Date
();
return
(
String
(
date
.
toJSON
()).
split
(
/T/
)[
0
]
)
return
(
getDateStr
(
date
)
)
}
}
// const [date, setDate] = useState(getDate())
function
DeptForm
({
addInfo
})
{
function
DeptForm
({
addInfo
})
{
return
(
return
(
...
@@ -45,7 +46,7 @@ function DeptForm({ addInfo }) {
...
@@ -45,7 +46,7 @@ function DeptForm({ addInfo }) {
<
DatePicker
<
DatePicker
inputTitle
=
'
날짜
'
inputTitle
=
'
날짜
'
date
=
{
values
.
date
||
getDate
()}
//오늘날짜 아니면 바뀐날짜
date
=
{
values
.
date
||
getDate
s
()}
//오늘날짜 아니면 바뀐날짜
setDate
=
{
handleChange
(
'
date
'
)}
setDate
=
{
handleChange
(
'
date
'
)}
/
>
/
>
<
InputBox
<
InputBox
...
...
screens/MemoDetails.js
View file @
3912238f
...
@@ -5,15 +5,15 @@ import InputBox from '../components/InputBox';
...
@@ -5,15 +5,15 @@ import InputBox from '../components/InputBox';
import
StyledButton
from
'
../components/StyledButton
'
;
import
StyledButton
from
'
../components/StyledButton
'
;
import
DatePicker
from
'
../components/DatePicker.js
'
;
import
DatePicker
from
'
../components/DatePicker.js
'
;
import
memoApi
from
'
../db/memoPage.api
'
;
import
memoApi
from
'
../db/memoPage.api
'
;
import
{
getDateStr
}
from
'
../utils/dateFunction
'
;
function
MemoDetails
({
route
,
navigation
})
{
function
MemoDetails
({
route
,
navigation
})
{
const
{
item
,
loadMemos
}
=
route
.
params
const
{
item
,
loadMemos
}
=
route
.
params
const
getDate
=
()
=>
{
const
getDate
s
=
()
=>
{
var
date
=
new
Date
();
const
date
=
new
Date
();
return
(
String
(
date
.
toJSON
()).
split
(
/T/
)[
0
]
)
return
(
getDateStr
(
date
)
)
}
}
const
[
date
,
setDate
]
=
useState
(
getDate
())
const
[
date
,
setDate
]
=
useState
(
getDate
s
())
const
[
message
,
setMessage
]
=
useState
(
''
)
const
[
message
,
setMessage
]
=
useState
(
''
)
const
onUpdateHandle
=
async
()
=>
{
const
onUpdateHandle
=
async
()
=>
{
await
memoApi
.
updateMemo
({
date
,
message
},
item
.
id
)
await
memoApi
.
updateMemo
({
date
,
message
},
item
.
id
)
...
...
screens/MemoForm.js
View file @
3912238f
...
@@ -5,20 +5,21 @@ import { Formik } from 'formik';
...
@@ -5,20 +5,21 @@ import { Formik } from 'formik';
import
*
as
yup
from
'
yup
'
;
import
*
as
yup
from
'
yup
'
;
import
DatePicker
from
'
../components/DatePicker.js
'
;
import
DatePicker
from
'
../components/DatePicker.js
'
;
import
InputBox
from
'
../components/InputBox.js
'
;
import
InputBox
from
'
../components/InputBox.js
'
;
import
{
getDateStr
}
from
'
../utils/dateFunction
'
;
const
ReviewSchema
=
yup
.
object
({
const
ReviewSchema
=
yup
.
object
({
// date: yup.string() //string만 받는다
date
:
yup
.
string
()
//string만 받는다
// .required() //아무것도 입력안했하면 안받음
.
required
(),
// , //최소4글짜
message
:
yup
.
string
()
message
:
yup
.
string
()
.
required
()
.
required
()
.
min
(
2
),
.
min
(
2
),
})
})
const
getDate
=
()
=>
{
const
getDate
s
=
()
=>
{
var
date
=
new
Date
();
const
date
=
new
Date
();
return
(
String
(
date
.
toJSON
()).
split
(
/T/
)[
0
]
)
return
(
getDateStr
(
date
)
)
}
}
...
@@ -41,7 +42,7 @@ function MemoForm({ addInfo }) {
...
@@ -41,7 +42,7 @@ function MemoForm({ addInfo }) {
<
View
>
<
View
>
<
DatePicker
<
DatePicker
inputTitle
=
'
날짜
'
inputTitle
=
'
날짜
'
date
=
{
values
.
date
||
getDate
()}
//오늘날짜 아니면 바뀐날짜
date
=
{
values
.
date
||
getDate
s
()}
//오늘날짜 아니면 바뀐날짜
setDate
=
{
handleChange
(
'
date
'
)}
setDate
=
{
handleChange
(
'
date
'
)}
/
>
/
>
<
InputBox
<
InputBox
...
...
utils/dateFunction.js
View file @
3912238f
export
function
getDate
(
item
)
{
export
function
getDate
Str
(
item
)
{
let
date
=
''
let
date
=
''
if
(
item
)
{
if
(
item
)
{
date
=
new
Date
(
item
)
date
=
new
Date
(
item
)
...
...
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