@eohjsc/react-native-smart-city 0.3.88 → 0.3.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commons/Device/FlatListItems.js +1 -1
- package/src/commons/Device/HistoryChart.js +2 -2
- package/src/commons/Device/LinearChart.js +1 -0
- package/src/commons/Device/PMSensor/PMSensorIndicator.js +1 -5
- package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +2 -3
- package/src/commons/Device/ProgressBar/index.js +6 -4
- package/src/commons/Device/ProgressBar/styles.js +9 -6
- package/src/commons/Device/WindDirection/Compass/index.js +1 -0
- package/src/commons/SubUnit/OneTap/index.js +2 -1
- package/src/commons/UnitSummary/AirQuality/index.js +1 -1
- package/src/context/SCContext.tsx +1 -1
- package/src/screens/Automate/MultiUnits.js +1 -0
- package/src/screens/Automate/index.js +1 -2
- package/src/screens/Device/detail.js +1 -1
- package/src/screens/Unit/Station/index.js +2 -1
- package/src/screens/Unit/Summaries.js +5 -1
- package/src/utils/I18n/translations/en.json +1 -1
- package/src/utils/Utils.js +2 -0
package/package.json
CHANGED
|
@@ -46,7 +46,7 @@ const FlatListItems = memo(({ data, style, title, offsetTitle }) => {
|
|
|
46
46
|
}
|
|
47
47
|
return items.map((item, index) => (
|
|
48
48
|
<QualityIndicatorItem
|
|
49
|
-
key={item?.id}
|
|
49
|
+
key={(item?.id || index).toString()}
|
|
50
50
|
standard={item.standard}
|
|
51
51
|
value={item.value}
|
|
52
52
|
measure={item.unit}
|
|
@@ -162,7 +162,7 @@ const HistoryChart = memo(
|
|
|
162
162
|
return roundedSum.toFixed();
|
|
163
163
|
}, [configuration, datas, chartConfig]);
|
|
164
164
|
|
|
165
|
-
const renderChart =
|
|
165
|
+
const renderChart = useMemo(() => {
|
|
166
166
|
if (configuration.type === 'line_chart') {
|
|
167
167
|
return (
|
|
168
168
|
<View style={styles.chartContainer}>
|
|
@@ -228,7 +228,7 @@ const HistoryChart = memo(
|
|
|
228
228
|
</View>
|
|
229
229
|
</View>
|
|
230
230
|
)}
|
|
231
|
-
{renderChart
|
|
231
|
+
{renderChart}
|
|
232
232
|
{configuration.config === 'power_consumption' && !!chartConfig.price && (
|
|
233
233
|
<Text type="H4">
|
|
234
234
|
{t('total_power_price')} <Text bold>{formatMoney(totalPrice)}</Text>
|
|
@@ -3,12 +3,8 @@ import { View } from 'react-native';
|
|
|
3
3
|
import { FlatList } from 'react-native';
|
|
4
4
|
import QualityIndicatorItem from '../WaterQualitySensor/QualityIndicatorsItem';
|
|
5
5
|
import styles from './PMSensorIndicatorStyles';
|
|
6
|
-
import { roundNumber } from '../../../utils/Utils';
|
|
6
|
+
import { keyExtractor, roundNumber } from '../../../utils/Utils';
|
|
7
7
|
|
|
8
|
-
//using for PM2.5-10, CO, UV, Rainflow Sensor
|
|
9
|
-
const keyExtractor = (item, index) => {
|
|
10
|
-
return index;
|
|
11
|
-
};
|
|
12
8
|
const PMSensorIndicator = memo(({ data = [], style }) => {
|
|
13
9
|
const renderItem = useCallback(
|
|
14
10
|
({ item }) => {
|
|
@@ -36,14 +36,13 @@ describe('Test ProgressBar', () => {
|
|
|
36
36
|
configuration: { max_value: 100 },
|
|
37
37
|
value: 8,
|
|
38
38
|
};
|
|
39
|
-
const data = [{ value: 10 }];
|
|
39
|
+
const data = [{ value: 10, unit: 'oC' }];
|
|
40
40
|
await act(async () => {
|
|
41
41
|
tree = renderer.create(wrapComponent(item, data));
|
|
42
42
|
});
|
|
43
43
|
const instance = tree.root;
|
|
44
44
|
const texts = instance.findAllByType(Text);
|
|
45
45
|
expect(texts[0].props.children).toBe('Value bar');
|
|
46
|
-
expect(texts[1].props.children).toEqual(
|
|
47
|
-
expect(texts[2].props.children).toEqual([10, ' ', undefined]);
|
|
46
|
+
expect(texts[1].props.children).toEqual('Max value: 100 oC');
|
|
48
47
|
});
|
|
49
48
|
});
|
|
@@ -23,7 +23,7 @@ const ProgressBar = memo(({ data = [], item }) => {
|
|
|
23
23
|
</Text>
|
|
24
24
|
|
|
25
25
|
<Text size={16} style={styles.textMaxValue}>
|
|
26
|
-
{t('max_value')}: {maxValue}
|
|
26
|
+
{`${t('max_value')}: ${maxValue} ${unit || measure}`}
|
|
27
27
|
</Text>
|
|
28
28
|
|
|
29
29
|
<View style={styles.wrapProgressBar}>
|
|
@@ -36,9 +36,11 @@ const ProgressBar = memo(({ data = [], item }) => {
|
|
|
36
36
|
borderWidth={0}
|
|
37
37
|
borderRadius={10}
|
|
38
38
|
/>
|
|
39
|
-
<
|
|
40
|
-
{
|
|
41
|
-
|
|
39
|
+
<View>
|
|
40
|
+
<Text numberOfLines={1} style={styles.textValue}>
|
|
41
|
+
{value}
|
|
42
|
+
</Text>
|
|
43
|
+
</View>
|
|
42
44
|
</View>
|
|
43
45
|
</View>
|
|
44
46
|
);
|
|
@@ -6,29 +6,32 @@ export default StyleSheet.create({
|
|
|
6
6
|
container: {
|
|
7
7
|
flex: 1,
|
|
8
8
|
flexDirection: 'column', //column direction
|
|
9
|
-
|
|
10
|
-
marginLeft: 60,
|
|
9
|
+
marginHorizontal: 30,
|
|
11
10
|
borderWidth: 1,
|
|
12
|
-
padding:
|
|
11
|
+
padding: 16,
|
|
13
12
|
borderRadius: 8,
|
|
14
13
|
borderColor: Colors.Gray4,
|
|
15
14
|
marginBottom: 12,
|
|
16
15
|
},
|
|
17
16
|
textLabel: {
|
|
18
|
-
paddingHorizontal:
|
|
17
|
+
paddingHorizontal: 15,
|
|
19
18
|
paddingTop: 8,
|
|
20
19
|
},
|
|
21
20
|
textMaxValue: {
|
|
22
|
-
|
|
21
|
+
marginTop: 20,
|
|
22
|
+
marginLeft: 14,
|
|
23
|
+
textAlign: 'left',
|
|
24
|
+
fontWeight: 'bold',
|
|
25
|
+
textTransform: 'uppercase',
|
|
23
26
|
},
|
|
24
27
|
wrapProgressBar: {
|
|
25
28
|
flex: 1,
|
|
26
29
|
flexDirection: 'row',
|
|
27
30
|
justifyContent: 'center',
|
|
28
31
|
alignItems: 'center',
|
|
29
|
-
padding: 8,
|
|
30
32
|
},
|
|
31
33
|
textValue: {
|
|
32
34
|
marginLeft: 8,
|
|
35
|
+
width: 45,
|
|
33
36
|
},
|
|
34
37
|
});
|
|
@@ -49,6 +49,7 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
49
49
|
>
|
|
50
50
|
{listAutomate.map((item, index) => (
|
|
51
51
|
<TouchableOpacity
|
|
52
|
+
key={(item?.id || index).toString()}
|
|
52
53
|
style={
|
|
53
54
|
indexAutomate === index
|
|
54
55
|
? styles.borderSelection
|
|
@@ -79,7 +80,7 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
79
80
|
isOwner={isOwner}
|
|
80
81
|
automate={item}
|
|
81
82
|
unit={unit}
|
|
82
|
-
key={item.id}
|
|
83
|
+
key={item.id.toString()}
|
|
83
84
|
/>
|
|
84
85
|
))}
|
|
85
86
|
<ItemAddNew
|
|
@@ -146,7 +146,7 @@ const AirQuality = memo(({ summaryDetail }) => {
|
|
|
146
146
|
{!!advices &&
|
|
147
147
|
advices.map((item, index) => {
|
|
148
148
|
return (
|
|
149
|
-
<View key={index} style={styles.boxContentHealth}>
|
|
149
|
+
<View key={index.toString()} style={styles.boxContentHealth}>
|
|
150
150
|
<View
|
|
151
151
|
style={[styles.boxDot, { backgroundColor: outdoorColor }]}
|
|
152
152
|
/>
|
|
@@ -706,7 +706,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
706
706
|
return (
|
|
707
707
|
<SensorDisplayItem
|
|
708
708
|
accessibilityLabel={AccessibilityLabel.SENSOR_DISPLAY_ITEM}
|
|
709
|
-
key={index}
|
|
709
|
+
key={(item?.id || index).toString()}
|
|
710
710
|
item={item}
|
|
711
711
|
evaluate={evaluate}
|
|
712
712
|
emergency={onEmergencyButtonPress}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { memo, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { View, Text, TouchableOpacity, FlatList } from 'react-native';
|
|
3
3
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
4
|
+
import { keyExtractor } from '../../../utils/Utils';
|
|
4
5
|
import styles from './StationStyles';
|
|
5
6
|
|
|
6
7
|
const Station = ({ listStation = [], onSnapToItem, indexStation }) => {
|
|
@@ -63,10 +64,10 @@ const Station = ({ listStation = [], onSnapToItem, indexStation }) => {
|
|
|
63
64
|
return (
|
|
64
65
|
<View style={styles.container}>
|
|
65
66
|
<FlatList
|
|
67
|
+
keyExtractor={keyExtractor}
|
|
66
68
|
removeClippedSubviews={false}
|
|
67
69
|
onScroll={onScroll}
|
|
68
70
|
ref={flatListRef}
|
|
69
|
-
keyExtractor={(item) => item.id}
|
|
70
71
|
horizontal
|
|
71
72
|
data={data}
|
|
72
73
|
extraData={data}
|
|
@@ -107,7 +107,11 @@ const Summaries = memo(({ unit }) => {
|
|
|
107
107
|
accessibilityLabel={AccessibilityLabel.UNIT_DETAIL_UNIT_SUMMARY_VIEW}
|
|
108
108
|
>
|
|
109
109
|
{unitSummaries.map((item, index) => (
|
|
110
|
-
<SummaryItem
|
|
110
|
+
<SummaryItem
|
|
111
|
+
key={(item?.id || index).toString()}
|
|
112
|
+
item={item}
|
|
113
|
+
goToSummary={goToSummary}
|
|
114
|
+
/>
|
|
111
115
|
))}
|
|
112
116
|
</ScrollView>
|
|
113
117
|
)}
|
|
@@ -675,7 +675,7 @@
|
|
|
675
675
|
"text_notification_content_turbility_high": "The Turbility at **unit_name** is **status**. Water is not safe to drink.",
|
|
676
676
|
"text_notification_content_smoke": "Smoke appears in **unit_name**. Please check your home and call the rescue team if there is a fire.",
|
|
677
677
|
"text_notification_content_fire": "There is a fire at **unit_name**, Please move out of the house immediately and call the rescue team.",
|
|
678
|
-
"text_notification_content_active_sos": "**device_name** is activating at **unit_name** - **station_name
|
|
678
|
+
"text_notification_content_active_sos": "**device_name** is activating at **unit_name** - **station_name**. Please check it NOW.",
|
|
679
679
|
"text_notification_content_replace_water_filter": "Filter **config_name** of **device_name** in **station_name** has less than 10h remaining. Check and replace now.",
|
|
680
680
|
"text_notification_content_low_battery": "Battery of **device_name** in **unit_name**: **station_name** has less than 20%. Check and replace now.",
|
|
681
681
|
"text_notification_content_remove_unit_to_owner": "Unit **unit_name** has been removed successfully.",
|