Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
safetcut-app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
atichat
safetcut-app
Commits
7f7851c9
Commit
7f7851c9
authored
Jul 27, 2019
by
OuiAtichat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demo add timer
parent
190fbc8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
12 deletions
+47
-12
screens/Private/TimerScreen/TimerScreen.js
+47
-12
No files found.
screens/Private/TimerScreen/TimerScreen.js
View file @
7f7851c9
...
...
@@ -11,6 +11,7 @@ import SwipeableRow from '../../../components/SwipeableRow';
import
DatePicker
from
'react-native-date-picker'
;
import
{
height
}
from
'../../../constants/Layout'
;
import
InputField
from
'../../../components/InputField'
;
import
{
isIphoneX
}
from
'../../../utils/isPhoneX'
;
// mock data
const
MultipleMockData
=
[
...
...
@@ -340,15 +341,20 @@ export default class TimerScreen extends Component {
<
/TouchableOpacity
>
),
});
state
=
{
dat
e
:
new
Date
(),
currentTim
e
:
new
Date
(),
isVisible
:
false
,
};
renderTimerFab
=
()
=>
{
return
(
<
Fab
containerStyle
=
{{
bottom
:
'15%'
}}
containerStyle
=
{{
bottom
:
'15%'
,
// right: '50%', // centerFAB
// marginRight: -28,
}}
style
=
{{
backgroundColor
:
color
.
primary
}}
position
=
"bottomRight"
onPress
=
{()
=>
this
.
setState
({
isVisible
:
true
})}
...
...
@@ -379,6 +385,7 @@ export default class TimerScreen extends Component {
heading
=
{
item
.
tabName
}
>
<
FlatList
contentContainerStyle
=
{{
paddingBottom
:
isIphoneX
()
?
90
:
55
}}
data
=
{
item
.
timer
}
ListEmptyComponent
=
{()
=>
(
<
View
>
...
...
@@ -400,19 +407,14 @@ export default class TimerScreen extends Component {
animationType
=
"slide"
visible
=
{
this
.
state
.
isVisible
}
>
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'rgba(0, 0, 0,0.5)'
,
}}
>
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'rgba(0, 0, 0,0.5)'
}}
>
<
ScrollView
contentContainerStyle
=
{
styles
.
scrollContainer
}
>
<
Text
style
=
{
theme
.
title
}
>
Create
Timer
<
/Text
>
<
View
>
<
Text
style
=
{[
theme
.
normalText
,
theme
.
textDark
]}
>
Set
Time
<
/Text
>
<
DatePicker
date
=
{
this
.
state
.
dat
e
}
onDateChange
=
{
date
=>
this
.
setState
({
date
})}
date
=
{
this
.
state
.
currentTim
e
}
onDateChange
=
{
date
=>
this
.
setState
({
currentTime
:
date
})}
mode
=
"time"
style
=
{{
height
:
100
}}
/
>
...
...
@@ -443,7 +445,6 @@ export default class TimerScreen extends Component {
))}
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-evenly'
}}
>
<
Button
transparent
...
...
@@ -459,7 +460,41 @@ export default class TimerScreen extends Component {
justifyContent
:
'center'
,
backgroundColor
:
color
.
primary
,
}}
onPress
=
{()
=>
this
.
setState
({
isVisible
:
false
})}
onPress
=
{()
=>
{
this
.
setState
({
isVisible
:
false
});
let
hours
=
this
.
state
.
currentTime
.
getHours
();
let
minutes
=
this
.
state
.
currentTime
.
getMinutes
();
if
(
minutes
<
10
)
{
minutes
=
'0'
+
minutes
;
}
let
suffix
=
'AM'
;
if
(
hours
>=
12
)
{
suffix
=
'PM'
;
hours
=
hours
-
12
;
}
if
(
hours
==
0
)
{
hours
=
12
;
}
{
MultipleMockData
[
1
].
timer
.
push
({
time
:
`
${
hours
}
:
${
minutes
}
`
,
period
:
suffix
,
name
:
'Slot 1'
,
active
:
true
,
power
:
true
,
day
:
[
{
day
:
'S'
,
dayActive
:
true
},
{
day
:
'M'
,
dayActive
:
true
},
{
day
:
'T'
,
dayActive
:
true
},
{
day
:
'W'
,
dayActive
:
true
},
{
day
:
'T'
,
dayActive
:
false
},
{
day
:
'F'
,
dayActive
:
true
},
{
day
:
'S'
,
dayActive
:
true
},
],
});
}
}}
>
<
Text
style
=
{{
color
:
color
.
white
}}
>
Confirm
<
/Text
>
<
/Button
>
...
...
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