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
756c4c6b
Commit
756c4c6b
authored
Aug 14, 2019
by
OuiAtichat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update overlay & update seachbar
parent
a44a6e17
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
36 deletions
+66
-36
screens/Private/TimerScreen/TimerScreen.js
+66
-36
No files found.
screens/Private/TimerScreen/TimerScreen.js
View file @
756c4c6b
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Fab
,
Icon
,
Text
}
from
'native-base'
;
import
{
Fab
,
Icon
,
Text
}
from
'native-base'
;
import
{
View
,
StyleSheet
,
FlatList
,
ScrollView
,
Modal
,
TouchableOpacity
}
from
'react-native'
;
import
{
View
,
StyleSheet
,
FlatList
,
ScrollView
,
Modal
,
TouchableOpacity
,
TextInput
}
from
'react-native'
;
import
{
Switch
,
Button
}
from
'native-base'
;
import
{
Switch
,
Button
}
from
'native-base'
;
import
{
HeaderButtons
,
Item
as
HeaderItem
}
from
'react-navigation-header-buttons'
;
import
{
HeaderButtons
,
Item
as
HeaderItem
}
from
'react-navigation-header-buttons'
;
import
IoniconsHeaderButton
from
'../../../components/IoniconsHeaderButton'
;
import
IoniconsHeaderButton
from
'../../../components/IoniconsHeaderButton'
;
import
{
color
,
theme
}
from
'../../../constants/Styles'
;
import
{
color
,
theme
}
from
'../../../constants/Styles'
;
import
RNPickerSelect
from
'react-native-picker-select'
;
import
{
Badge
}
from
'react-native-elements'
;
import
{
Badge
,
CheckBox
,
SearchBar
}
from
'react-native-elements'
;
import
SwipeableRow
from
'../../../components/SwipeableRow'
;
import
SwipeableRow
from
'../../../components/SwipeableRow'
;
import
DatePicker
from
'react-native-date-picker'
;
import
DatePicker
from
'react-native-date-picker'
;
import
{
height
}
from
'../../../constants/Layout'
;
import
{
width
,
height
}
from
'../../../constants/Layout'
;
import
InputField
from
'../../../components/InputField'
;
import
InputField
from
'../../../components/InputField'
;
import
{
isIphoneX
}
from
'../../../utils/isPhoneX'
;
import
{
isIphoneX
}
from
'../../../utils/isPhoneX'
;
// import { TouchableOpacity } from 'react-native-gesture-handler';
// mock data
// mock data
const
MultipleMockData
=
[
const
MultipleMockData
=
[
{
{
...
@@ -163,11 +162,11 @@ export default class TimerScreen extends Component {
...
@@ -163,11 +162,11 @@ export default class TimerScreen extends Component {
{
day
:
'F'
,
isRepeat
:
false
},
{
day
:
'F'
,
isRepeat
:
false
},
{
day
:
'S'
,
isRepeat
:
false
},
{
day
:
'S'
,
isRepeat
:
false
},
],
],
// repeatDays: [{ S: false }, { M: false }, { T: false }, { W: false }, { T: false }, { F: false }, { S: false }],
isVisible
:
false
,
isVisible
:
false
,
filterOpen
:
false
,
filterOpen
:
false
,
selectedBreaker
:
''
,
selectedBreaker
:
''
,
checked
:
[],
checked
:
[],
search
:
''
,
};
};
renderTimerFab
=
()
=>
{
renderTimerFab
=
()
=>
{
...
@@ -218,6 +217,10 @@ export default class TimerScreen extends Component {
...
@@ -218,6 +217,10 @@ export default class TimerScreen extends Component {
}));
}));
};
};
updateSearch
=
search
=>
{
this
.
setState
({
search
});
};
componentDidUpdate
=
(
prevProps
,
prevState
)
=>
{
componentDidUpdate
=
(
prevProps
,
prevState
)
=>
{
if
(
prevState
!==
this
.
state
)
console
.
log
(
this
.
state
);
if
(
prevState
!==
this
.
state
)
console
.
log
(
this
.
state
);
};
};
...
@@ -226,27 +229,22 @@ export default class TimerScreen extends Component {
...
@@ -226,27 +229,22 @@ export default class TimerScreen extends Component {
return
(
return
(
<>
<>
{
/* Overlay */
}
{
/* Overlay */
}
{
this
.
state
.
isVisible
||
(
this
.
state
.
filterOpen
&&
(
<
Modal
<
View
transparent
style
=
{{
presentationStyle
=
{
'overFullScreen'
}
flex
:
1
,
animationType
=
"fade"
position
:
'absolute'
,
visible
=
{
this
.
state
.
filterOpen
||
this
.
state
.
isVisible
}
top
:
0
,
>
bottom
:
0
,
<
View
style
=
{{
width
,
height
,
backgroundColor
:
'rgba(0,0,0,0.5)'
}}
/
>
left
:
0
,
<
/Modal
>
right
:
0
,
backgroundColor
:
'rgba(0,0,0,0.5)'
,
zIndex
:
1
,
}}
/
>
))}
{
/* Search Bar */
}
{
/* Search Bar */
}
<
View
style
=
{{
padding
:
15
,
flexDirection
:
'row'
,
alignItems
:
'center'
}}
>
<
View
style
=
{{
padding
:
15
,
flexDirection
:
'row'
,
alignItems
:
'center'
}}
>
<
View
{
/*
<View
style={[
style={[
{
{
// height: 30,
paddingVertical: 5,
paddingVertical: 5,
paddingHorizontal: 10,
paddingHorizontal: 10,
borderColor: '#c7cad1',
borderColor: '#c7cad1',
...
@@ -263,7 +261,32 @@ export default class TimerScreen extends Component {
...
@@ -263,7 +261,32 @@ export default class TimerScreen extends Component {
placeholderTextColor="#b9bdc5"
placeholderTextColor="#b9bdc5"
style={{ fontSize: 14, fontFamily: 'Avenir-Roman' }}
style={{ fontSize: 14, fontFamily: 'Avenir-Roman' }}
/>
/>
<
/View
>
</View> */
}
<
SearchBar
containerStyle
=
{{
flex
:
1
,
display
:
'flex'
,
borderWidth
:
1
,
borderColor
:
'#c7cad1'
,
backgroundColor
:
'transparent'
,
height
:
30
,
paddingVertical
:
0
,
borderRadius
:
30
,
}}
inputContainerStyle
=
{{
borderWidth
:
0
,
backgroundColor
:
'transparent'
,
minHeight
:
10
,
height
:
30
,
borderColor
:
'#c7cad1'
,
}}
inputStyle
=
{{
fontFamily
:
'Avenir-Roman'
,
fontSize
:
12
,
color
:
color
.
darkGrey
}}
round
lightTheme
placeholder
=
"Search..."
onChangeText
=
{
this
.
updateSearch
}
value
=
{
this
.
state
.
search
}
/
>
<
Icon
<
Icon
name
=
"funnel"
name
=
"funnel"
style
=
{{
color
:
'#c7cad1'
,
fontSize
:
14
,
marginLeft
:
10
}}
style
=
{{
color
:
'#c7cad1'
,
fontSize
:
14
,
marginLeft
:
10
}}
...
@@ -365,16 +388,29 @@ export default class TimerScreen extends Component {
...
@@ -365,16 +388,29 @@ export default class TimerScreen extends Component {
justifyContent
:
'center'
,
justifyContent
:
'center'
,
backgroundColor
:
color
.
primary
,
backgroundColor
:
color
.
primary
,
}}
}}
onPress
=
{()
=>
{
onPress
=
{
async
()
=>
{
this
.
setState
({
isVisible
:
false
});
await
MultipleMockData
[
0
].
timer
.
push
({
MultipleMockData
[
0
].
timer
.
push
({
name
:
'Slot 1'
,
name
:
'Slot 1'
,
time
:
this
.
state
.
timer
,
time
:
this
.
state
.
timer
,
active
:
this
.
state
.
active
,
active
:
this
.
state
.
active
,
power
:
this
.
state
.
power
,
power
:
this
.
state
.
power
,
repeatDays
:
this
.
state
.
repeatDays
,
repeatDays
:
this
.
state
.
repeatDays
,
});
});
this
.
setState
({
isVisible
:
false
,
timer
:
new
Date
(),
active
:
false
,
power
:
false
,
repeatDays
:
[
{
day
:
'S'
,
isRepeat
:
false
},
{
day
:
'M'
,
isRepeat
:
false
},
{
day
:
'T'
,
isRepeat
:
false
},
{
day
:
'W'
,
isRepeat
:
false
},
{
day
:
'T'
,
isRepeat
:
false
},
{
day
:
'F'
,
isRepeat
:
false
},
{
day
:
'S'
,
isRepeat
:
false
},
],
});
}}
}}
>
>
<
Text
style
=
{{
color
:
color
.
white
}}
>
Confirm
<
/Text
>
<
Text
style
=
{{
color
:
color
.
white
}}
>
Confirm
<
/Text
>
...
@@ -409,11 +445,7 @@ export default class TimerScreen extends Component {
...
@@ -409,11 +445,7 @@ export default class TimerScreen extends Component {
<
Text
style
=
{[
theme
.
smallTitle
,
theme
.
textDark
]}
>
Filters
<
/Text
>
<
Text
style
=
{[
theme
.
smallTitle
,
theme
.
textDark
]}
>
Filters
<
/Text
>
<
Text
<
Text
style
=
{[
theme
.
smallTitle
,
theme
.
textDanger
]}
style
=
{[
theme
.
smallTitle
,
theme
.
textDanger
]}
onPress
=
{()
=>
onPress
=
{()
=>
this
.
setState
({
filterOpen
:
false
})}
this
.
setState
({
filterOpen
:
false
,
})
}
>
>
Done
Done
<
/Text
>
<
/Text
>
...
@@ -432,9 +464,7 @@ export default class TimerScreen extends Component {
...
@@ -432,9 +464,7 @@ export default class TimerScreen extends Component {
>
>
<
RNPickerSelect
<
RNPickerSelect
onValueChange
=
{(
value
,
index
)
=>
onValueChange
=
{(
value
,
index
)
=>
this
.
setState
({
this
.
setState
({
selectedBreaker
:
breaker
[
index
-
1
].
sub
})
selectedBreaker
:
breaker
[
index
-
1
].
sub
,
})
}
}
placeholder
=
{{
label
:
'Select Breaker'
,
value
:
null
}}
placeholder
=
{{
label
:
'Select Breaker'
,
value
:
null
}}
items
=
{
breaker
}
items
=
{
breaker
}
...
@@ -483,7 +513,7 @@ export default class TimerScreen extends Component {
...
@@ -483,7 +513,7 @@ export default class TimerScreen extends Component {
}
}
/
>
/
>
)}
)}
keyExtractor
=
{(
item
,
index
)
=>
`sub
${
index
}
`
}
keyExtractor
=
{(
item
,
index
)
=>
`sub
${
index
}
`
}
/
>
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
...
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