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
e1f1d4b7
Commit
e1f1d4b7
authored
Aug 19, 2019
by
Tonk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get setting data from redux
parent
ae1efc0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
screens/Private/SettingScreen/SettingScreen.js
+23
-12
No files found.
screens/Private/SettingScreen/SettingScreen.js
View file @
e1f1d4b7
...
...
@@ -2,31 +2,29 @@ import React from 'react';
import
{
View
,
StyleSheet
}
from
'react-native'
;
import
{
ListItem
,
Body
,
Text
,
Icon
,
Right
,
Switch
,
List
}
from
'native-base'
;
import
{
theme
,
color
}
from
'../../../constants/Styles'
;
import
{
connect
}
from
'react-redux'
;
const
data
=
{
breaker
:
'Main Breaker'
,
name
:
'Main Breaker'
,
description
:
'Lorem ipsum dolorsit amet,consectetur adipiscing elit. Cras sagitti.'
,
rcbo
:
10
,
notification
:
true
,
};
export
default
class
SettingScreen
extends
React
.
Component
{
class
SettingScreen
extends
React
.
Component
{
static
navigationOptions
=
({
navigation
})
=>
({
title
:
'Setting'
,
});
state
=
{
data
:
this
.
props
.
allDeviceInfo
[
0
],
};
render
()
{
const
{
data
}
=
this
.
state
;
return
(
<
View
style
=
{[
theme
.
container
]}
>
<
List
style
=
{
styles
.
ListItemContainer
}
>
<
ListItem
itemDivider
>
<
Body
>
<
Text
style
=
{
theme
.
description
}
>
{
data
.
breaker
.
toUpperCase
()}
<
/Text
>
<
Text
style
=
{
theme
.
description
}
>
{
data
.
type
.
toUpperCase
()}
<
/Text
>
<
/Body
>
<
/ListItem
>
<
ListItem
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'SettingData'
,
{
breaker
:
data
.
breaker
,
breaker
:
data
.
type
,
field
:
'Name'
,
data
:
data
.
name
,
})
...
...
@@ -45,7 +43,7 @@ export default class SettingScreen extends React.Component {
<
ListItem
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'SettingData'
,
{
breaker
:
data
.
breaker
,
breaker
:
data
.
type
,
field
:
'Description'
,
data
:
data
.
description
,
})
...
...
@@ -61,7 +59,15 @@ export default class SettingScreen extends React.Component {
<
Icon
name
=
"arrow-forward"
/>
<
/Right
>
<
/ListItem
>
<
ListItem
>
<
ListItem
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'SettingData'
,
{
breaker
:
data
.
type
,
field
:
'RCBO'
,
data
:
data
.
rcbo
,
})
}
>
<
Body
>
<
Text
style
=
{[
theme
.
normalText
,
theme
.
textDark
]}
>
RCBO
<
/Text
>
<
Text
note
numberOfLines
=
{
1
}
style
=
{
theme
.
description
}
>
...
...
@@ -92,6 +98,11 @@ export default class SettingScreen extends React.Component {
);
}
}
const
mapStateToProps
=
state
=>
({
allDeviceInfo
:
state
.
allDataReducer
.
allDeviceInfo
,
});
export
default
connect
(
mapStateToProps
)(
SettingScreen
);
const
styles
=
StyleSheet
.
create
({
ListItemContainer
:
{
...
...
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