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
bbd9c246
Commit
bbd9c246
authored
Jul 25, 2019
by
Tonk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add limit current
parent
bd88268e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
6 deletions
+48
-6
screens/Private/SmartMeterScreen/SmartMeterDetailScreen.js
+48
-6
No files found.
screens/Private/SmartMeterScreen/SmartMeterDetailScreen.js
View file @
bbd9c246
...
...
@@ -76,6 +76,13 @@ const MainBreaker = {
},
],
};
const
LimitCurrent
=
[
{
name
:
'AC Volt'
,
limit
:
1000
},
{
name
:
'AC Current'
,
limit
:
1000
},
{
name
:
'Watt'
,
limit
:
1000
},
{
name
:
'Leakage Current'
,
limit
:
1000
},
{
name
:
'Watthour'
,
limit
:
1000
},
];
export
default
class
SmartMeterDetailScreen
extends
Component
{
static
navigationOptions
=
({
navigation
})
=>
{
...
...
@@ -143,14 +150,49 @@ export default class SmartMeterDetailScreen extends Component {
// Electric Current card
const
Current
=
props
=>
{
return
(
<
Card
style
=
{
styles
.
currentCard
}
>
<
Text
style
=
{
theme
.
smDescription
}
>
{
props
.
name
}
<
/Text
>
<
Card
style
=
{[
styles
.
currentCard
,
{
backgroundColor
:
props
.
number
>
LimitCurrent
[
props
.
index
].
limit
?
color
.
primary
:
color
.
white
,
},
]}
>
<
Text
style
=
{[
theme
.
smDescription
,
{
color
:
props
.
number
>
LimitCurrent
[
props
.
index
].
limit
?
color
.
white
:
color
.
grey
},
]}
>
{
props
.
name
}
<
/Text
>
<
Text
numberOfLines
=
{
1
}
style
=
{[
theme
.
smallTitle
,
theme
.
textDark
,
theme
.
mt1
,
{
textAlign
:
'right'
}]}
style
=
{[
theme
.
smallTitle
,
theme
.
textDark
,
theme
.
mt1
,
{
textAlign
:
'right'
,
color
:
props
.
number
>
LimitCurrent
[
props
.
index
].
limit
?
color
.
white
:
color
.
darkGrey
,
},
]}
>
{
props
.
number
}{
' '
}
<
Text
style
=
{[
theme
.
smDescription
,
theme
.
textDark
,
{
color
:
props
.
number
>
LimitCurrent
[
props
.
index
].
limit
?
color
.
white
:
color
.
darkGrey
,
},
]}
>
{
props
.
number
}
<
Text
style
=
{[
theme
.
smDescription
,
theme
.
textDark
]}
>
{
props
.
unit
}
<
/Text
>
{
props
.
unit
}
<
/Text
>
<
/Text
>
<
/Card
>
);
...
...
@@ -249,11 +291,11 @@ export default class SmartMeterDetailScreen extends Component {
{
/* Electric Current */
}
<
FlatList
data
=
{
this
.
formatGridData
(
MainBreaker
.
Ecurrent
)}
renderItem
=
{({
item
})
=>
{
renderItem
=
{({
item
,
index
})
=>
{
if
(
item
.
name
==
'empty'
)
{
return
<
Card
transparent
style
=
{{
flex
:
1
,
padding
:
10
}}
/>
;
}
else
{
return
<
Current
name
=
{
item
.
name
}
number
=
{
item
.
number
}
unit
=
{
item
.
unit
}
/>
;
return
<
Current
index
=
{
index
}
name
=
{
item
.
name
}
number
=
{
item
.
number
}
unit
=
{
item
.
unit
}
/>
;
}
}}
numColumns
=
{
3
}
...
...
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