Commit 1e69a248 by Tonk

.

parent 309f8333
......@@ -22,7 +22,7 @@ let checkedTimes = 0;
class McbLinkScreen extends React.Component {
static navigationOptions = ({ navigation }) => {
return {
title: navigation.getParam('mcbLink').name,
title: navigation.getParam('mcbLink').name || `MCB Link ${navigation.getParam('mcbIndex') + 1}`,
headerLeft: (
<HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}>
<Item title="back" iconName="ios-arrow-back" onPress={() => navigation.pop()} />
......@@ -136,14 +136,16 @@ class McbLinkScreen extends React.Component {
<View style={[theme.container, theme.containerWithPadding]}>
<Card style={{ borderRadius: 10, padding: 10, paddingHorizontal: 15, borderColor: 'transparent' }}>
<View style={[theme.rowContainer, { justifyContent: 'space-between' }]}>
<Text style={[theme.smallTitle, theme.textDark]}>{item.name}</Text>
<Text style={[theme.smallTitle, theme.textDark]}>
{item.name || `Sub Breaker ${index + 1}`}
</Text>
<Switch
disabled={isWaiting ? true : false}
value={subStatus}
onValueChange={value => handleOnPressSubBreakerSwitch(value)}
/>
</View>
<Text style={[theme.description, theme.mt1]}>{item.description}</Text>
<Text style={[theme.description, theme.mt1]}>{item.description || 'No description'}</Text>
</Card>
{this.renderData(item)}
......@@ -158,6 +160,7 @@ class McbLinkScreen extends React.Component {
};
renderData = item => {
const data = item.data;
if (data) {
return (
<View style={{ flexDirection: 'row' }}>
{Object.keys(data).map((key, index) => (
......@@ -167,12 +170,15 @@ class McbLinkScreen extends React.Component {
</Text>
<Text style={styles.dataCurrent}>
{data[key]}{' '}
{key === 'ARC' ? null : <Text style={styles.dataUnit}>{key === 'AMP' ? 'A' : 'mA'}</Text>}
{key === 'ARC' ? null : (
<Text style={styles.dataUnit}>{key === 'AMP' ? 'A' : 'mA'}</Text>
)}
</Text>
</Card>
))}
</View>
);
}
};
renderElectronic = item => {
const { toggleDel } = this.state;
......@@ -410,7 +416,7 @@ class McbLinkScreen extends React.Component {
}}
>
{subBreakersInfo.map((item, index) => (
<Tab heading={item.name} {...TabStyle} key={`tab${index}`}>
<Tab heading={item.name || `Sub Breaker ${index + 1}`} {...TabStyle} key={`tab${index}`}>
{this.renderSubbreaker(item, index)}
</Tab>
))}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment