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
28c3802d
Commit
28c3802d
authored
Aug 22, 2019
by
Tonk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update search notification
parent
f1b46072
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
10 deletions
+107
-10
screens/Private/NotificationScreen/NotificationScreen.js
+105
-9
screens/Private/NotificationScreen/notification.json
+2
-1
No files found.
screens/Private/NotificationScreen/NotificationScreen.js
View file @
28c3802d
import
React
from
'react'
;
import
{
Text
,
Tab
,
Tabs
,
ScrollableTab
,
Icon
}
from
'native-base'
;
import
{
View
,
StyleSheet
,
FlatList
,
ScrollView
}
from
'react-native'
;
import
{
View
,
StyleSheet
,
FlatList
,
ScrollView
,
Modal
}
from
'react-native'
;
import
{
color
,
theme
}
from
'../../../constants/Styles'
;
import
{
SearchBar
}
from
'react-native-elements'
;
import
{
format
,
isToday
,
isYesterday
,
isSameDay
}
from
'date-fns'
;
import
SlideUpModal
from
'../../../components/SlideUpModal'
;
import
FadeDimBG
from
'../../../components/FadeDimBG'
;
import
{
width
,
height
}
from
'../../../constants/Layout'
;
import
RNPickerSelect
from
'react-native-picker-select'
;
const
tabHeader
=
[
{
type
:
'all'
,
label
:
'All'
},
...
...
@@ -15,12 +19,26 @@ export default class NotificationScreen extends React.Component {
static
navigationOptions
=
({
navigation
})
=>
({
title
:
'Notifications'
,
});
state
=
{
search
:
''
,
data
:
[]
};
state
=
{
search
:
''
,
data
:
[],
initial
:
[],
isfilterVisible
:
false
,
};
componentDidMount
()
{
this
.
sortDate
();
}
updateSearch
=
search
=>
{
this
.
setState
({
search
});
updateSearch
=
text
=>
{
this
.
setState
({
search
:
text
});
const
newData
=
this
.
state
.
initial
.
filter
(
item
=>
{
const
itemData
=
`
${
item
.
user
.
toUpperCase
()}
${
item
.
action
.
toUpperCase
()}
${
item
.
device
.
toUpperCase
()}
`
;
const
textData
=
text
.
toUpperCase
();
return
itemData
.
indexOf
(
textData
)
>
-
1
;
});
this
.
setState
({
data
:
newData
,
});
};
renderActionCard
(
data
)
{
return
(
...
...
@@ -45,12 +63,14 @@ export default class NotificationScreen extends React.Component {
);
}
sortDate
()
{
this
.
setState
({
data
:
dt2
.
sort
(
function
(
a
,
b
)
{
const
sortData
=
dt2
.
sort
(
function
(
a
,
b
)
{
var
dateA
=
new
Date
(
a
.
time
),
dateB
=
new
Date
(
b
.
time
);
return
dateB
-
dateA
;
}),
});
this
.
setState
({
data
:
sortData
,
initial
:
sortData
,
});
}
renderDayList
(
type
)
{
...
...
@@ -103,7 +123,7 @@ export default class NotificationScreen extends React.Component {
renderTabBar
=
{()
=>
<
ScrollableTab
style
=
{{
backgroundColor
:
color
.
defaultBg
,
borderWidth
:
0
}}
/>
}
>
{
tabHeader
.
map
((
item
,
index
)
=>
(
<
Tab
heading
=
{
item
.
label
}
{...
TabStyle
}
key
=
{
index
}
>
<
Tab
heading
=
{
item
.
label
}
{...
TabStyle
}
key
=
{
`tab
${
index
}
`
}
>
<
View
style
=
{{
padding
:
15
,
...
...
@@ -118,7 +138,7 @@ export default class NotificationScreen extends React.Component {
round
lightTheme
placeholder
=
"Search..."
onChangeText
=
{
t
his
.
updateSearch
}
onChangeText
=
{
t
ext
=>
this
.
updateSearch
(
text
)
}
value
=
{
this
.
state
.
search
}
/
>
<
Icon
...
...
@@ -133,10 +153,64 @@ export default class NotificationScreen extends React.Component {
<
/Tab
>
))}
<
/Tabs
>
<
Modal
transparent
presentationStyle
=
{
'overFullScreen'
}
animationType
=
"fade"
visible
=
{
this
.
state
.
isfilterVisible
}
>
<
FadeDimBG
/>
<
SlideUpModal
ending
=
{
0.3
}
style
=
{
styles
.
filterModal
}
>
<
View
style
=
{[
theme
.
rowContainer
,
styles
.
filterHeader
]}
>
<
Text
style
=
{[
theme
.
smallTitle
,
theme
.
textDark
]}
>
Reset
<
/Text
>
<
Text
style
=
{[
theme
.
smallTitle
,
theme
.
textDark
]}
>
Filters
<
/Text
>
<
Text
style
=
{[
theme
.
smallTitle
,
theme
.
textDanger
]}
onPress
=
{()
=>
this
.
setState
({
isfilterVisible
:
false
})}
>
Done
<
/Text
>
<
/View
>
<
Text
style
=
{[
theme
.
smallTitle
,
theme
.
textDanger
,
theme
.
mt2
]}
>
Select
Date
<
/Text
>
<
View
style
=
{[
theme
.
mt2
,
styles
.
pickerContainer
]}
>
<
RNPickerSelect
onValueChange
=
{
value
=>
console
.
log
(
value
)}
items
=
{[
{
label
:
'Today'
,
value
:
'today'
},
{
label
:
'Yesterday'
,
value
:
'yesterday'
},
{
label
:
'Last 7 days'
,
value
:
'7days'
},
{
label
:
'Last 30days'
,
value
:
'30days'
},
{
label
:
'This month'
,
value
:
'month'
},
{
label
:
'Last month'
,
value
:
'lastMonth'
},
{
label
:
'Custom'
,
value
:
'custom'
},
]}
useNativeAndroidPickerStyle
=
{
false
}
style
=
{
pickerStyle
}
Icon
=
{()
=>
<
Icon
name
=
"ios-arrow-down"
style
=
{{
fontSize
:
14
,
color
:
'#c8c8c8'
}}
/>
}
/>
<
/View
>
<
/SlideUpModal
>
<
/Modal
>
<
/View
>
);
}
}
const
pickerStyle
=
{
inputIOS
:
{
color
:
color
.
darkGrey
,
fontFamily
:
'Avenir-Roman'
,
},
iconContainer
:
{
top
:
Platform
.
OS
===
'android'
?
5
:
undefined
,
right
:
0
,
},
inputAndroid
:
{
height
:
20
,
fontFamily
:
'Avenir-Roman'
,
fontSize
:
14
,
paddingVertical
:
0
,
},
};
const
styles
=
StyleSheet
.
create
({
searchBarContainer
:
{
...
...
@@ -177,4 +251,26 @@ const styles = StyleSheet.create({
alignItems
:
'center'
,
justifyContent
:
'center'
,
},
filterModal
:
{
flex
:
0.7
,
top
:
height
*
0.3
,
paddingTop
:
20
,
paddingBottom
:
18
,
paddingHorizontal
:
25
,
backgroundColor
:
color
.
white
,
borderTopLeftRadius
:
10
,
borderTopRightRadius
:
10
,
},
filterHeader
:
{
justifyContent
:
'space-between'
,
paddingBottom
:
10
,
borderBottomColor
:
'rgba(189, 192, 200, 0.3)'
,
borderBottomWidth
:
1
,
},
pickerContainer
:
{
borderWidth
:
1
,
borderColor
:
'#dcdcdc'
,
borderRadius
:
5
,
padding
:
10
,
},
});
screens/Private/NotificationScreen/notification.json
View file @
28c3802d
...
...
@@ -10,5 +10,6 @@
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566371305
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 1"
},
{
"type"
:
"log"
,
"user"
:
"Sukanya161"
,
"time"
:
1566374629
,
"action"
:
"Switched on"
,
"device"
:
"sub breaker 3"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566317460
,
"action"
:
"leaved"
,
"device"
:
"office"
}
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566317460
,
"action"
:
"Leaved"
,
"device"
:
"office"
},
{
"type"
:
"notification"
,
"user"
:
"Tonk"
,
"time"
:
1566438573
,
"action"
:
"Entered"
,
"device"
:
"office"
}
]
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