Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
bb27cb09
Commit
bb27cb09
authored
6 years ago
by
emelko
Browse files
Options
Downloads
Patches
Plain Diff
Add disabled to check for feeling AND texture to be selected; needs state
parent
2b5e6351
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/mucus.js
+155
-0
155 additions, 0 deletions
components/mucus.js
with
155 additions
and
0 deletions
components/mucus.js
0 → 100644
+
155
−
0
View file @
bb27cb09
import
React
,
{
Component
}
from
'
react
'
import
{
View
,
Button
,
Text
,
Switch
}
from
'
react-native
'
import
RadioForm
from
'
react-native-simple-radio-button
'
import
{
saveMucus
}
from
'
../db
'
import
styles
from
'
../styles/index
'
import
{
mucusFeeling
as
feelingLabels
,
mucusTexture
as
textureLabels
}
from
'
../labels/labels
'
export
default
class
Mucus
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
cycleDay
=
props
.
cycleDay
this
.
showView
=
props
.
showView
let
currentFeelingValue
=
this
.
cycleDay
.
mucus
&&
this
.
cycleDay
.
mucus
.
feeling
if
(
typeof
currentFeelingValue
!==
'
number
'
)
{
currentFeelingValue
=
-
1
}
let
currentTextureValue
=
this
.
cycleDay
.
mucus
&&
this
.
cycleDay
.
mucus
.
texture
if
(
typeof
currentTextureValue
!==
'
number
'
)
{
currentTextureValue
=
-
1
}
this
.
state
=
{
currentFeelingValue
,
currentTextureValue
,
exclude
:
this
.
cycleDay
.
mucus
?
this
.
cycleDay
.
mucus
.
exclude
:
false
}
}
render
()
{
const
mucusFeelingRadioProps
=
[
{
label
:
feelingLabels
[
0
],
value
:
0
},
{
label
:
feelingLabels
[
1
],
value
:
1
},
{
label
:
feelingLabels
[
2
],
value
:
2
},
{
label
:
feelingLabels
[
3
],
value
:
3
}
]
const
mucusTextureRadioProps
=
[
{
label
:
textureLabels
[
0
],
value
:
0
},
{
label
:
textureLabels
[
1
],
value
:
1
},
{
label
:
textureLabels
[
2
],
value
:
2
}
]
return
(
<
View
style
=
{
styles
.
symptomEditView
}
>
<
View
style
=
{
styles
.
symptomEditSplitSymptomsAndLastRowButtons
}
>
<
View
style
=
{
styles
.
symptomEditListedSymptomView
}
>
<
View
style
=
{{
flex
:
1
}}
>
<
Text
style
=
{
styles
.
symptomDayView
}
>
Mucus
<
/Text
>
<
/View
>
<
View
style
=
{{
flex
:
1
}}
>
<
Text
style
=
{
styles
.
symptomDayView
}
>
Feeling
<
/Text
>
<
/View
>
<
View
style
=
{{
flex
:
1
}}
>
<
RadioForm
radio_props
=
{
mucusFeelingRadioProps
}
initial
=
{
this
.
state
.
currentFeelingValue
}
formHorizontal
=
{
true
}
labelHorizontal
=
{
false
}
labelStyle
=
{
styles
.
radioButton
}
onPress
=
{(
itemValue
)
=>
{
this
.
setState
({
currentFeelingValue
:
itemValue
})
}}
/
>
<
/View
>
<
View
style
=
{{
flex
:
1
}}
>
<
Text
style
=
{
styles
.
symptomDayView
}
>
Color
/
Texture
<
/Text
>
<
/View
>
<
View
style
=
{{
flex
:
1
}}
>
<
RadioForm
radio_props
=
{
mucusTextureRadioProps
}
initial
=
{
this
.
state
.
currentTextureValue
}
formHorizontal
=
{
true
}
labelHorizontal
=
{
false
}
labelStyle
=
{
styles
.
radioButton
}
onPress
=
{(
itemValue
)
=>
{
this
.
setState
({
currentTextureValue
:
itemValue
})
}}
/
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
itemsInRowSeparatedView
}
>
<
View
style
=
{
styles
.
singleButtonView
}
>
<
Text
style
=
{
styles
.
symptomDayView
}
>
Exclude
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
singleButtonView
}
>
<
Switch
onValueChange
=
{(
val
)
=>
{
this
.
setState
({
exclude
:
val
})
}}
value
=
{
this
.
state
.
exclude
}
/
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
itemsInRowSeparatedView
}
>
<
View
style
=
{
styles
.
singleButtonView
}
>
<
Button
onPress
=
{()
=>
this
.
showView
(
'
dayView
'
)}
title
=
"
Cancel
"
>
<
/Button
>
<
/View
>
<
View
style
=
{
styles
.
singleButtonView
}
>
<
Button
onPress
=
{()
=>
{
saveMucus
(
this
.
cycleDay
)
this
.
showView
(
'
dayView
'
)
}}
title
=
"
Delete
"
>
<
/Button
>
<
/View
>
<
View
style
=
{
styles
.
singleButtonView
}
>
<
Button
onPress
=
{()
=>
{
saveMucus
(
this
.
cycleDay
,
{
feeling
:
this
.
state
.
currentFeelingValue
,
texture
:
this
.
state
.
currentTextureValue
,
exclude
:
this
.
state
.
exclude
})
this
.
showView
(
'
dayView
'
)
}}
// FIXME: find out how disabled works when 2 values need to be checked
disabled
=
{
this
.
state
.
currentFeelingValue
===
-
1
||
this
.
state
.
currentTextureValue
===
-
1
}
title
=
"
Save
"
>
<
/Button
>
<
/View
>
<
/View
>
<
/View
>
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment