@eohjsc/react-native-smart-city 0.2.88 → 0.2.91
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 +2 -2
- package/src/screens/Device/detail.js +46 -29
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eohjsc/react-native-smart-city",
|
|
3
3
|
"title": "React Native Smart Home",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.91",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"@ant-design/icons-react-native": "^2.2.1",
|
|
99
99
|
"@ant-design/react-native": "^4.0.5",
|
|
100
100
|
"@eohjsc/highcharts": "^1.0.6",
|
|
101
|
+
"@eohjsc/react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
101
102
|
"@formatjs/intl-getcanonicallocales": "^1.4.5",
|
|
102
103
|
"@formatjs/intl-numberformat": "^5.6.2",
|
|
103
104
|
"@formatjs/intl-pluralrules": "^3.4.7",
|
|
@@ -161,7 +162,6 @@
|
|
|
161
162
|
"react-native-image-resizer": "^1.4.5",
|
|
162
163
|
"react-native-input-credit-card": "^0.5.5",
|
|
163
164
|
"react-native-iphone-x-helper": "^1.2.1",
|
|
164
|
-
"react-native-keyboard-aware-scroll-view": "https://github.com/hinh-eoh/react-native-keyboard-aware-scroll-view.git",
|
|
165
165
|
"react-native-linear-gradient": "^2.5.6",
|
|
166
166
|
"react-native-localize": "^1.4.1",
|
|
167
167
|
"react-native-maps": "0.27.1",
|
|
@@ -8,7 +8,6 @@ import React, {
|
|
|
8
8
|
import { View, TouchableOpacity } from 'react-native';
|
|
9
9
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
10
10
|
import moment from 'moment';
|
|
11
|
-
import _ from 'lodash';
|
|
12
11
|
import { get } from 'lodash';
|
|
13
12
|
import { useSelector } from 'react-redux';
|
|
14
13
|
import { IconFill, IconOutline } from '@ant-design/icons-react-native';
|
|
@@ -463,10 +462,14 @@ const DeviceDetail = ({ route }) => {
|
|
|
463
462
|
setDisplayValues((currentDisplayValues) => {
|
|
464
463
|
for (const [configId, value] of Object.entries(configValues)) {
|
|
465
464
|
const intId = parseInt(configId);
|
|
466
|
-
const index =
|
|
465
|
+
const index = currentDisplayValues.findIndex(
|
|
466
|
+
(element) => element.id === intId
|
|
467
|
+
);
|
|
468
|
+
|
|
469
|
+
const item = currentDisplayValues[index];
|
|
467
470
|
if (index !== -1) {
|
|
468
471
|
currentDisplayValues[index].value = value;
|
|
469
|
-
currentDisplayValues[index].evaluate =
|
|
472
|
+
currentDisplayValues[index].evaluate = item.evaluate;
|
|
470
473
|
} else {
|
|
471
474
|
currentDisplayValues.push({
|
|
472
475
|
id: intId,
|
|
@@ -496,7 +499,19 @@ const DeviceDetail = ({ route }) => {
|
|
|
496
499
|
params: { unitId: unit?.id, group },
|
|
497
500
|
});
|
|
498
501
|
}, [navigation, unit?.group, unit?.id]);
|
|
499
|
-
|
|
502
|
+
const isHaveColorSliderTemplate = useMemo(() => {
|
|
503
|
+
let isFlag = false;
|
|
504
|
+
display?.items.some((item) => {
|
|
505
|
+
switch (item?.configuration?.template) {
|
|
506
|
+
case 'color_picker_template':
|
|
507
|
+
case 'slider_range_template':
|
|
508
|
+
return (isFlag = true);
|
|
509
|
+
default:
|
|
510
|
+
return (isFlag = false);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
return isFlag;
|
|
514
|
+
}, [display]);
|
|
500
515
|
// replace isConnected=True to see template
|
|
501
516
|
const renderSensorConnected = () => {
|
|
502
517
|
return (
|
|
@@ -536,31 +551,33 @@ const DeviceDetail = ({ route }) => {
|
|
|
536
551
|
);
|
|
537
552
|
}
|
|
538
553
|
})}
|
|
539
|
-
|
|
540
|
-
{
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
554
|
+
{!!isHaveColorSliderTemplate && (
|
|
555
|
+
<Card title={t('controller')}>
|
|
556
|
+
{display.items.map((item) => {
|
|
557
|
+
switch (item?.configuration?.template) {
|
|
558
|
+
case 'color_picker_template':
|
|
559
|
+
case 'slider_range_template':
|
|
560
|
+
return (
|
|
561
|
+
<SensorDisplayItem
|
|
562
|
+
testID={TESTID.SENSOR_DISPLAY_ITEM}
|
|
563
|
+
key={item.id.toString()}
|
|
564
|
+
item={item}
|
|
565
|
+
emergency={onEmergencyButtonPress}
|
|
566
|
+
sensor={sensor}
|
|
567
|
+
getData={getData}
|
|
568
|
+
maxValue={maxValue}
|
|
569
|
+
offsetTitle={offsetTitle}
|
|
570
|
+
setOffsetTitle={setOffsetTitle}
|
|
571
|
+
setShowWindDirection={setShowWindDirection}
|
|
572
|
+
background={station?.background}
|
|
573
|
+
/>
|
|
574
|
+
);
|
|
575
|
+
default:
|
|
576
|
+
return <></>;
|
|
577
|
+
}
|
|
578
|
+
})}
|
|
579
|
+
</Card>
|
|
580
|
+
)}
|
|
564
581
|
</SensorConnectStatusViewHeader>
|
|
565
582
|
);
|
|
566
583
|
};
|