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
e9c42566
Commit
e9c42566
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Extract temp input into component
parent
3a162ca0
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
+57
-37
57 additions, 37 deletions
components/cycle-day/symptoms/temperature.js
with
57 additions
and
37 deletions
components/cycle-day/symptoms/temperature.js
+
57
−
37
View file @
e9c42566
...
...
@@ -49,48 +49,16 @@ export default class Temp extends Component {
}
}
checkRange
=
()
=>
{
const
value
=
Number
(
`
${
this
.
state
.
integer
}
.
${
this
.
state
.
fractional
}
`
)
if
(
isNaN
(
value
))
return
const
scale
=
scaleObservable
.
value
if
(
value
<
scale
.
min
||
value
>
scale
.
max
)
{
Alert
.
alert
(
shared
.
warning
,
tempLabels
.
outOfRangeWarning
,
)
}
}
render
()
{
return
(
<
View
style
=
{
styles
.
symptomEditView
}
>
<
View
style
=
{
styles
.
symptomViewRowInline
}
>
<
Text
style
=
{
styles
.
symptomDayView
}
>
Temperature
(
°
C
)
<
/Text
>
<
View
style
=
{{
flexDirection
:
'
row
'
,
alignItems
:
'
center
'
}}
>
<
TextInput
style
=
{
styles
.
temperatureTextInput
}
onChangeText
=
{(
val
)
=>
{
if
(
isNaN
(
Number
(
val
)))
return
this
.
setState
({
integer
:
val
})
}}
keyboardType
=
'
numeric
'
value
=
{
this
.
state
.
integer
}
maxLength
=
{
2
}
/
>
<
Text
style
=
{
styles
.
temperatureTextInput
}
>
.
<
/Text
>
<
TextInput
style
=
{
styles
.
temperatureTextInput
}
onChangeText
=
{(
val
)
=>
{
if
(
isNaN
(
Number
(
val
)))
return
this
.
setState
({
fractional
:
val
})
}}
keyboardType
=
'
numeric
'
value
=
{
this
.
state
.
fractional
}
onBlur
=
{
this
.
checkRange
}
maxLength
=
{
2
}
autoFocus
=
{
true
}
/
>
<
/View
>
<
TempInputPair
integer
=
{
this
.
state
.
integer
}
fractional
=
{
this
.
state
.
fractional
}
setState
=
{(
val
)
=>
this
.
setState
(
val
)}
/
>
<
/View
>
<
View
style
=
{
styles
.
symptomViewRowInline
}
>
<
Text
style
=
{
styles
.
symptomDayView
}
>
Time
<
/Text
>
...
...
@@ -148,6 +116,58 @@ export default class Temp extends Component {
}
}
class
TempInputPair
extends
Component
{
render
()
{
return
(
<
View
style
=
{{
flexDirection
:
'
row
'
,
alignItems
:
'
center
'
}}
>
<
TempInput
type
=
'
integer
'
integer
=
{
this
.
props
.
integer
}
fractional
=
{
this
.
props
.
fractional
}
setState
=
{
this
.
props
.
setState
}
/
>
<
Text
style
=
{
styles
.
temperatureTextInput
}
>
.
<
/Text
>
<
TempInput
type
=
'
fractional
'
integer
=
{
this
.
props
.
integer
}
fractional
=
{
this
.
props
.
fractional
}
setState
=
{
this
.
props
.
setState
}
/
>
<
/View
>
)
}
}
class
TempInput
extends
Component
{
checkRange
=
()
=>
{
const
value
=
Number
(
`
${
this
.
props
.
integer
}
.
${
this
.
props
.
fractional
}
`
)
if
(
isNaN
(
value
))
return
const
scale
=
scaleObservable
.
value
if
(
value
<
scale
.
min
||
value
>
scale
.
max
)
{
Alert
.
alert
(
shared
.
warning
,
tempLabels
.
outOfRangeWarning
,
)
}
}
render
()
{
return
(
<
TextInput
style
=
{
styles
.
temperatureTextInput
}
onChangeText
=
{(
val
)
=>
{
if
(
isNaN
(
Number
(
val
)))
return
this
.
props
.
setState
({
[
this
.
props
.
type
]:
val
})
}}
keyboardType
=
'
numeric
'
value
=
{
this
.
props
[
this
.
props
.
type
]}
onBlur
=
{
this
.
checkRange
}
maxLength
=
{
2
}
autoFocus
=
{
this
.
props
.
type
===
'
fractional
'
}
/
>
)
}
}
function
isInvalidTime
(
timeString
)
{
try
{
LocalTime
.
parse
(
timeString
)
...
...
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