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
018ec3bc
Commit
018ec3bc
authored
5 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Add autosave for temperate
parent
bc358bd9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/cycle-day/symptoms/temperature.js
+13
-14
13 additions, 14 deletions
components/cycle-day/symptoms/temperature.js
with
13 additions
and
14 deletions
components/cycle-day/symptoms/temperature.js
+
13
−
14
View file @
018ec3bc
...
@@ -63,19 +63,12 @@ export default class Temp extends SymptomView {
...
@@ -63,19 +63,12 @@ export default class Temp extends SymptomView {
})
})
}
}
a
sync
onBackButtonPress
()
{
a
utoSave
=
()
=>
{
if
(
typeof
this
.
state
.
temperature
!=
'
string
'
||
this
.
state
.
temperature
===
''
)
{
if
(
typeof
this
.
state
.
temperature
!=
'
string
'
||
this
.
state
.
temperature
===
''
)
{
this
.
deleteSymptomEntry
()
this
.
deleteSymptomEntry
()
return
return
}
}
const
userWantsToSave
=
await
this
.
warnUserIfTempOutOfRange
()
if
(
!
userWantsToSave
)
return
true
this
.
saveTemperature
()
}
saveTemperature
=
()
=>
{
const
dataToSave
=
{
const
dataToSave
=
{
value
:
Number
(
this
.
state
.
temperature
),
value
:
Number
(
this
.
state
.
temperature
),
exclude
:
this
.
state
.
exclude
,
exclude
:
this
.
state
.
exclude
,
...
@@ -103,15 +96,14 @@ export default class Temp extends SymptomView {
...
@@ -103,15 +96,14 @@ export default class Temp extends SymptomView {
// it in a promise
// it in a promise
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
if
(
warningMsg
)
{
if
(
warningMsg
)
{
// we set this so the time picker doesn't open at the same time
this
.
warningAlertOpen
=
true
Alert
.
alert
(
Alert
.
alert
(
sharedLabels
.
warning
,
sharedLabels
.
warning
,
warningMsg
,
warningMsg
,
[
[
{
text
:
sharedLabels
.
cancel
,
onPress
:
()
=>
{
{
text
:
sharedLabels
.
ok
,
onPress
:
()
=>
{
resolve
(
false
)
this
.
warningAlertOpen
=
false
}},
{
text
:
sharedLabels
.
save
,
onPress
:
()
=>
{
resolve
(
true
)
}}
}}
]
]
)
)
...
@@ -154,6 +146,7 @@ export default class Temp extends SymptomView {
...
@@ -154,6 +146,7 @@ export default class Temp extends SymptomView {
onChangeText
=
{
this
.
setTemperature
}
onChangeText
=
{
this
.
setTemperature
}
keyboardType
=
'
numeric
'
keyboardType
=
'
numeric
'
maxLength
=
{
5
}
maxLength
=
{
5
}
onBlur
=
{
this
.
warnUserIfTempOutOfRange
}
/
>
/
>
<
AppText
style
=
{{
marginLeft
:
5
}}
>
°
C
<
/AppText
>
<
AppText
style
=
{{
marginLeft
:
5
}}
>
°
C
<
/AppText
>
<
/View
>
<
/View
>
...
@@ -164,7 +157,13 @@ export default class Temp extends SymptomView {
...
@@ -164,7 +157,13 @@ export default class Temp extends SymptomView {
<
View
style
=
{
styles
.
framedSegmentInlineChildren
}
>
<
View
style
=
{
styles
.
framedSegmentInlineChildren
}
>
<
AppTextInput
<
AppTextInput
style
=
{[
styles
.
temperatureTextInput
]}
style
=
{[
styles
.
temperatureTextInput
]}
onFocus
=
{
this
.
showTimePicker
}
onFocus
=
{()
=>
{
if
(
this
.
warningAlertOpen
)
{
Keyboard
.
dismiss
()
}
else
{
this
.
showTimePicker
()
}
}}
value
=
{
this
.
state
.
time
}
value
=
{
this
.
state
.
time
}
/
>
/
>
<
DateTimePicker
<
DateTimePicker
...
...
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