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
049713f4
Commit
049713f4
authored
Jul 24, 2021
by
YoonDongMin
Browse files
YdM
parent
55abadbf
Changes
22
Hide whitespace changes
Inline
Side-by-side
screens/reviewDetails.js
deleted
100644 → 0
View file @
55abadbf
import
React
from
'
react
'
;
import
{
StyleSheet
,
View
,
Text
}
from
'
react-native
'
;
export
default
function
ReviewDetails
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
ReviewDetails
Screen
<
/Text
>
<
/View
>
)
}
const
styles
=
StyleSheet
.
create
({
container
:
(
padding
:
24
)
});
\ No newline at end of file
screens/reviewForm.js
deleted
100644 → 0
View file @
55abadbf
import
React
from
'
react
'
;
import
{
StyleSheet
,
Button
,
TextInput
,
View
,
Text
}
from
'
react-native
'
;
import
{
globalStyles
}
from
'
../styles/global.js
'
import
{
Formik
}
from
'
formik
'
;
import
*
as
yup
from
'
yup
'
;
const
ReviewSchema
=
yup
.
object
({
title
:
yup
.
string
()
.
required
()
.
min
(
4
),
body
:
yup
.
string
()
.
required
()
.
min
(
8
),
rating
:
yup
.
string
()
.
required
()
.
test
(
'
is-num-1-5
'
,
'
Rating must be a number 1 -5
'
,
(
val
)
=>
{
return
parseInt
(
val
)
<
6
&&
passInt
(
val
)
>
0
;
})
})
export
default
function
ReviewForm
(
addReview
)
{
return
(
<
View
style
=
{
globalStyles
.
container
}
>
<
Formik
initialValues
=
{{
title
:
''
,
body
:
''
,
rating
:
''
}}
validationSchema
=
{
ReviewSchema
}
onSubmit
=
{(
values
)
=>
{
addReview
(
values
);
}}
>
{(
props
)
=>
(
<
View
>
<
TextInput
style
=
{
globalStyles
.
input
}
placeholder
=
'
Review title
'
onChangeText
=
{
props
.
handleChange
(
'
title
'
)}
value
=
{
props
.
values
.
title
}
/
>
<
TextInput
multiline
style
=
{
globalStyles
.
input
}
placeholder
=
'
Review body
'
onChangeText
=
{
props
.
handleChange
(
'
body
'
)}
value
=
{
props
.
values
.
body
}
/
>
<
TextInput
multiline
style
=
{
globalStyles
.
input
}
placeholder
=
'
Rating (1-5)
'
onChangeText
=
{
props
.
handleChange
(
'
rating
'
)}
value
=
{
props
.
values
.
rating
}
keyboardType
=
'
numeric
'
/>
<
Button
title
=
'
submit
'
color
=
'
maroon
'
onPress
=
{
props
.
handleSubmit
}
/
>
<
/View
>
)}
<
/Formik
>
<
/View
>
)
}
\ No newline at end of file
Prev
1
2
Next
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