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
dc862415
Commit
dc862415
authored
Sep 06, 2019
by
Tonk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
increase font size, add smart device search
parent
dedcc765
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
24 deletions
+42
-24
screens/Private/SettingScreen/SettingScreen.js
+1
-1
screens/Private/SmartMeterScreen/SmartMeterDetailScreen.js
+25
-19
screens/Private/SmartMeterScreen/SmartMeterScreen.js
+16
-4
No files found.
screens/Private/SettingScreen/SettingScreen.js
View file @
dc862415
...
...
@@ -58,7 +58,7 @@ class SettingScreen extends React.Component {
const
{
data
}
=
this
.
state
;
return
(
<
View
style
=
{[
theme
.
container
]}
>
<
Text
style
=
{[
theme
.
description
,
theme
.
mt2
,
{
marginLeft
:
25
,
color
:
'#a8a8a8'
}]}
>
<
Text
style
=
{[
theme
.
description
,
theme
.
mt2
,
{
marginLeft
:
25
,
color
:
'#a8a8a8'
,
fontSize
:
14
}]}
>
{
data
.
type
===
'main'
&&
'Main Breaker'
}
<
/Text
>
...
...
screens/Private/SmartMeterScreen/SmartMeterDetailScreen.js
View file @
dc862415
...
...
@@ -106,7 +106,7 @@ class SmartMeterDetailScreen extends Component {
<
Switch
value
=
{
isPowerOn
}
/
>
<
/Right
>
<
/Row
>
<
Text
numberOfLines
=
{
2
}
style
=
{[
theme
.
description
,
theme
.
mt1
]}
>
<
Text
numberOfLines
=
{
2
}
style
=
{[
theme
.
description
,
theme
.
mt1
,
{
fontSize
:
14
}
]}
>
{
description
||
''
}
<
/Text
>
<
Row
style
=
{
theme
.
mt1
}
>
...
...
@@ -223,7 +223,12 @@ class SmartMeterDetailScreen extends Component {
};
return
(
<
View
>
<
Card
style
=
{{
borderColor
:
color
.
white
,
borderRadius
:
8
,
}}
>
<
Row
style
=
{{
paddingVertical
:
7
,
paddingLeft
:
7
,
paddingRight
:
Platform
.
OS
===
'android'
?
12
:
7
}}
onPress
=
{
handleOnPressMcbLink
}
...
...
@@ -249,7 +254,7 @@ class SmartMeterDetailScreen extends Component {
renderItem
=
{({
item
,
index
})
=>
renderSubBreaker
(
item
,
index
)}
/
>
)}
<
/
View
>
<
/
Card
>
);
};
...
...
@@ -285,22 +290,23 @@ class SmartMeterDetailScreen extends Component {
<
ActivityIndicator
color
=
{
color
.
primary
}
/
>
<
/View
>
)
:
(
<
Card
style
=
{{
borderColor
:
color
.
white
,
borderRadius
:
8
,
marginTop
:
20
,
marginBottom
:
isIphoneX
()
?
115
:
75
,
}}
>
<
FlatList
data
=
{
mcbLinksInfo
}
extraData
=
{
this
.
state
}
contentContainerStyle
=
{{
overflow
:
'hidden'
}}
keyExtractor
=
{(
item
,
index
)
=>
`mcbLinkItem
${
item
.
name
}
`
}
renderItem
=
{({
item
,
index
})
=>
this
.
renderMCBLinksList
(
item
,
index
)}
/
>
<
/Card
>
// <Card
// style={{
// borderColor: color.white,
// borderRadius: 8,
// marginTop: 20,
// marginBottom: isIphoneX() ? 115 : 75,
// }}
// >
<
FlatList
data
=
{
mcbLinksInfo
}
extraData
=
{
this
.
state
}
contentContainerStyle
=
{{
overflow
:
'hidden'
}}
keyExtractor
=
{(
item
,
index
)
=>
`mcbLinkItem
${
item
.
name
}
`
}
renderItem
=
{({
item
,
index
})
=>
this
.
renderMCBLinksList
(
item
,
index
)}
style
=
{{
marginBottom
:
isIphoneX
()
?
115
:
75
,
marginTop
:
20
}}
/
>
// </Card>
)}
<
/ScrollView
>
);
...
...
screens/Private/SmartMeterScreen/SmartMeterScreen.js
View file @
dc862415
...
...
@@ -22,12 +22,16 @@ class SmartMeterScreen extends PureComponent {
state
=
{
search
:
''
,
data
:
[],
};
_isMounted
=
false
;
componentDidMount
=
async
()
=>
{
await
this
.
getData
();
this
.
_isMounted
=
true
;
this
.
setState
({
data
:
this
.
props
.
allMainDeviceInfo
,
});
};
renderItem
=
({
item
,
index
})
=>
{
...
...
@@ -44,14 +48,22 @@ class SmartMeterScreen extends PureComponent {
await
this
.
props
.
getAllMainDeviceInfo
();
};
updateSearch
=
text
=>
{
updateSearch
=
search
=>
{
this
.
setState
({
search
});
const
newData
=
this
.
props
.
allMainDeviceInfo
.
filter
(
item
=>
{
const
itemData
=
`
${
item
.
name
.
toUpperCase
()}
`
;
const
textData
=
search
.
toUpperCase
();
return
itemData
.
indexOf
(
textData
)
>
-
1
;
});
this
.
setState
({
search
:
text
,
data
:
newData
,
});
};
render
()
{
const
{
allMainDeviceInfo
,
isLoading
,
error
}
=
this
.
props
;
const
{
isLoading
,
error
}
=
this
.
props
;
const
{
data
}
=
this
.
state
;
return
!
error
?
(
<>
...
...
@@ -87,7 +99,7 @@ class SmartMeterScreen extends PureComponent {
}
style
=
{[
theme
.
container
]}
contentContainerStyle
=
{[
theme
.
containerWithPadding
,
{
paddingBottom
:
isIphoneX
()
?
90
:
55
}]}
//iPhoneX BottomSpace = 34
data
=
{
allMainDeviceInfo
}
data
=
{
data
}
keyExtractor
=
{(
item
,
index
)
=>
item
.
deviceId
}
ItemSeparatorComponent
=
{()
=>
<
View
style
=
{
theme
.
mt1
}
/>
}
ListEmptyComponent
=
{()
=>
(
...
...
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