@eohjsc/react-native-smart-city 0.4.99 → 0.5.1
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/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplateStyle.js +0 -1
- package/src/commons/ActionGroup/OnOffTemplate/SwitchButtonTemplate.js +60 -48
- package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -32
- package/src/commons/ActionGroup/SliderRangeTemplate.js +53 -64
- package/src/commons/ActionGroup/SliderRangeTemplateStyles.js +2 -4
- package/src/commons/ActionGroup/TerminalBoxTemplate.js +11 -11
- package/src/commons/ActionGroup/TerminalBoxTemplateStyle.js +3 -0
- package/src/commons/ActionGroup/TextBoxTemplate.js +24 -22
- package/src/commons/ActionGroup/TextBoxTemplateStyle.js +3 -0
- package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +69 -17
- package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +33 -25
- package/src/commons/ActionGroup/__test__/TextBoxTemplate.test.js +19 -0
- package/src/commons/Device/PMSensor/PMSensorIndicator.js +3 -5
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +50 -45
- package/src/commons/Form/TextInput.js +2 -0
- package/src/commons/Header/Styles/HeaderCustomStyles.js +1 -1
- package/src/commons/HeaderAni/index.js +2 -2
- package/src/commons/Sharing/WrapHeaderScrollable.js +1 -2
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +2 -0
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +1 -0
- package/src/hooks/IoT/useWatchConfigs.js +3 -1
- package/src/iot/mqtt.js +23 -9
- package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +1 -1
- package/src/screens/Automate/Components/InputName.js +8 -2
- package/src/screens/Automate/EditActionsList/index.js +5 -5
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +17 -3
- package/src/screens/Device/__test__/mqttDetail.test.js +33 -20
- package/src/screens/Device/components/SensorDisplayItem.js +7 -3
- package/src/screens/Device/detail.js +3 -2
- package/src/screens/Device/hooks/useDeviceWatchConfigControl.js +4 -10
- package/src/screens/Unit/ManageUnitStyles.js +1 -1
- package/src/utils/I18n/translations/en.js +2 -0
- package/src/utils/I18n/translations/vi.js +2 -0
- package/src/commons/ActionGroup/OnOffTemplate/styles.js +0 -7
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.
|
|
4
|
+
"version": "0.5.01",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"react-native-toast-message": "^2.1.1",
|
|
199
199
|
"react-native-udp": "4.1.3",
|
|
200
200
|
"react-native-version-check": "^3.4.2",
|
|
201
|
-
"react-native-vlc-media-player": "^1.0.
|
|
201
|
+
"react-native-vlc-media-player": "^1.0.67",
|
|
202
202
|
"react-native-webview": "11.22.7",
|
|
203
203
|
"react-native-wheel-color-picker": "^1.2.0",
|
|
204
204
|
"react-native-wheel-scrollview-picker": "^1.2.2",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
1
|
+
import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { Switch, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import Text from '../../Text';
|
|
@@ -7,10 +7,9 @@ import styles from './OnOffButtonTemplateStyle';
|
|
|
7
7
|
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
8
8
|
import { useConfigGlobalState } from '../../../iot/states';
|
|
9
9
|
|
|
10
|
-
const SwitchButtonTemplate = memo(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const {
|
|
10
|
+
const SwitchButtonTemplate = memo(({ item, doAction }) => {
|
|
11
|
+
const {
|
|
12
|
+
configuration: {
|
|
14
13
|
action_off_data,
|
|
15
14
|
action_on_data,
|
|
16
15
|
text_on,
|
|
@@ -18,54 +17,67 @@ const SwitchButtonTemplate = memo(
|
|
|
18
17
|
color_on,
|
|
19
18
|
color_off,
|
|
20
19
|
config,
|
|
21
|
-
|
|
20
|
+
is_on_value,
|
|
21
|
+
} = {},
|
|
22
|
+
id,
|
|
23
|
+
} = item;
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const [configValues] = useConfigGlobalState('configValues');
|
|
26
|
+
const configValue = configValues[config]?.value;
|
|
27
|
+
const [isOn, setIsOn] = useState();
|
|
28
|
+
const getIsOnValue = useCallback(() => {
|
|
29
|
+
if (is_on_value && is_on_value.length > 0) {
|
|
30
|
+
return is_on_value.includes(configValue);
|
|
31
|
+
}
|
|
32
|
+
return !!configValue;
|
|
33
|
+
}, [configValue, is_on_value]);
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setIsOn(getIsOnValue());
|
|
37
|
+
}, [getIsOnValue]);
|
|
38
|
+
|
|
39
|
+
const onValueChange = useCallback(() => {
|
|
40
|
+
setIsOn((prevIsOn) => {
|
|
41
|
+
const newState = !prevIsOn;
|
|
42
|
+
if (newState) {
|
|
43
|
+
doAction(action_on_data, null);
|
|
44
|
+
} else {
|
|
30
45
|
doAction(action_off_data, null);
|
|
31
|
-
return;
|
|
32
46
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
configValue && setIsOn(configValue?.value);
|
|
39
|
-
}, [configValue]);
|
|
47
|
+
return newState;
|
|
48
|
+
});
|
|
49
|
+
}, [action_off_data, action_on_data, doAction]);
|
|
40
50
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/>
|
|
50
|
-
<Text
|
|
51
|
-
style={[
|
|
52
|
-
styles.textBig,
|
|
53
|
-
{ color: _isOn ? Colors.Gray8 : Colors.Gray6 },
|
|
54
|
-
]}
|
|
55
|
-
accessibilityLabel={`${AccessibilityLabel.SENSOR_STATUS}-${id}`}
|
|
56
|
-
>
|
|
57
|
-
{_isOn ? text_on : text_off}
|
|
58
|
-
</Text>
|
|
59
|
-
</View>
|
|
51
|
+
const trackColor = useMemo(
|
|
52
|
+
() => ({ false: color_off, true: color_on }),
|
|
53
|
+
[color_off, color_on]
|
|
54
|
+
);
|
|
55
|
+
const backgroundColor = useMemo(
|
|
56
|
+
() => (isOn ? color_on : color_off),
|
|
57
|
+
[color_off, color_on, isOn]
|
|
58
|
+
);
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
<View style={styles.barrierControlContainer}>
|
|
63
|
+
<Switch
|
|
64
|
+
trackColor={trackColor}
|
|
65
|
+
ios_backgroundColor={backgroundColor}
|
|
66
|
+
onValueChange={onValueChange}
|
|
67
|
+
value={isOn}
|
|
68
|
+
/>
|
|
69
|
+
<Text
|
|
70
|
+
style={[
|
|
71
|
+
styles.textBig,
|
|
72
|
+
{ color: isOn ? Colors.Gray8 : Colors.Gray6 },
|
|
73
|
+
]}
|
|
74
|
+
accessibilityLabel={`${AccessibilityLabel.SENSOR_STATUS}-${id}`}
|
|
75
|
+
>
|
|
76
|
+
{isOn ? text_on : text_off}
|
|
77
|
+
</Text>
|
|
78
|
+
</View>
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
81
|
+
});
|
|
70
82
|
|
|
71
83
|
export default SwitchButtonTemplate;
|
|
@@ -7,7 +7,6 @@ import { useConfigGlobalState } from '../../../iot/states';
|
|
|
7
7
|
import { useUnwatchLGDeviceConfigControl } from '../../../hooks/IoT';
|
|
8
8
|
import OnOffButtonTemplate from './OnOffButtonTemplate';
|
|
9
9
|
import OnOffSimpleTemplate from './OnOffSimpleTemplate';
|
|
10
|
-
import styles from './styles';
|
|
11
10
|
|
|
12
11
|
const getComponent = (template) => {
|
|
13
12
|
switch (template) {
|
|
@@ -50,19 +49,9 @@ const OnOffTemplate = memo(({ item = {}, doAction, sensor = {} }) => {
|
|
|
50
49
|
}, [config, configValues, is_on_value]);
|
|
51
50
|
|
|
52
51
|
const [isOn, setIsOn] = useState(false);
|
|
53
|
-
const [tempIsOn, setTempIsOn] = useState(getIsOnValue());
|
|
54
|
-
const [timeoutId, setTimeoutId] = useState();
|
|
55
|
-
const [needUpdateTempIsOn, setNeedUpdateTempIsOn] = useState(false);
|
|
56
|
-
|
|
57
|
-
const refreshTempIsOn = useCallback(() => {
|
|
58
|
-
const timeout = setTimeout(() => {
|
|
59
|
-
setNeedUpdateTempIsOn(true);
|
|
60
|
-
}, 7000);
|
|
61
|
-
setTimeoutId(timeout);
|
|
62
|
-
}, []);
|
|
63
52
|
|
|
64
53
|
const triggerAction = useCallback(async () => {
|
|
65
|
-
const action_data =
|
|
54
|
+
const action_data = isOn ? action_off_data : action_on_data;
|
|
66
55
|
if (!action_data) {
|
|
67
56
|
return;
|
|
68
57
|
}
|
|
@@ -77,11 +66,7 @@ const OnOffTemplate = memo(({ item = {}, doAction, sensor = {} }) => {
|
|
|
77
66
|
config_value: isOn ? 0 : 1,
|
|
78
67
|
};
|
|
79
68
|
}
|
|
80
|
-
clearTimeout(timeoutId);
|
|
81
69
|
await doAction(action_data, data);
|
|
82
|
-
setTempIsOn((prev) => !prev);
|
|
83
|
-
setNeedUpdateTempIsOn(false);
|
|
84
|
-
refreshTempIsOn();
|
|
85
70
|
if (
|
|
86
71
|
is_managed_by_backend &&
|
|
87
72
|
config &&
|
|
@@ -90,17 +75,14 @@ const OnOffTemplate = memo(({ item = {}, doAction, sensor = {} }) => {
|
|
|
90
75
|
watchMultiConfigs([config]);
|
|
91
76
|
}
|
|
92
77
|
}, [
|
|
93
|
-
|
|
78
|
+
isOn,
|
|
94
79
|
action_off_data,
|
|
95
80
|
action_on_data,
|
|
96
81
|
allow_config_store_value,
|
|
97
82
|
config,
|
|
98
83
|
device_type,
|
|
99
|
-
timeoutId,
|
|
100
84
|
doAction,
|
|
101
|
-
refreshTempIsOn,
|
|
102
85
|
is_managed_by_backend,
|
|
103
|
-
isOn,
|
|
104
86
|
]);
|
|
105
87
|
|
|
106
88
|
useUnwatchLGDeviceConfigControl(sensor, [config]);
|
|
@@ -109,24 +91,14 @@ const OnOffTemplate = memo(({ item = {}, doAction, sensor = {} }) => {
|
|
|
109
91
|
setIsOn(getIsOnValue());
|
|
110
92
|
}, [getIsOnValue]);
|
|
111
93
|
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
needUpdateTempIsOn && setTempIsOn(getIsOnValue());
|
|
114
|
-
}, [getIsOnValue, needUpdateTempIsOn]);
|
|
115
|
-
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
if (device_type !== DEVICE_TYPE.LG_THINQ) {
|
|
118
|
-
setTempIsOn(getIsOnValue());
|
|
119
|
-
}
|
|
120
|
-
}, [getIsOnValue, device_type]);
|
|
121
|
-
|
|
122
94
|
const Component = useMemo(() => {
|
|
123
95
|
return getComponent(item.template);
|
|
124
96
|
}, [item.template]);
|
|
125
97
|
|
|
126
98
|
return (
|
|
127
|
-
<View
|
|
99
|
+
<View>
|
|
128
100
|
<Component
|
|
129
|
-
isOn={
|
|
101
|
+
isOn={isOn}
|
|
130
102
|
triggerAction={triggerAction}
|
|
131
103
|
actionGroup={configuration}
|
|
132
104
|
disabled={!action_on_data && !action_off_data}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
memo,
|
|
3
|
-
useCallback,
|
|
4
|
-
useState,
|
|
5
|
-
useEffect,
|
|
6
|
-
useMemo,
|
|
7
|
-
useRef,
|
|
8
|
-
} from 'react';
|
|
1
|
+
import React, { memo, useCallback, useState, useEffect } from 'react';
|
|
9
2
|
import { Slider } from '@miblanchard/react-native-slider';
|
|
10
3
|
|
|
11
4
|
import { View } from 'react-native';
|
|
12
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
13
5
|
import styles from './SliderRangeTemplateStyles';
|
|
14
6
|
import Text from '../Text';
|
|
15
7
|
import { Colors } from '../../configs';
|
|
@@ -18,101 +10,98 @@ import { DEVICE_TYPE } from '../../configs/Constants';
|
|
|
18
10
|
import _TextInput from '../Form/TextInput';
|
|
19
11
|
|
|
20
12
|
const SliderRangeTemplate = memo(
|
|
21
|
-
({ item
|
|
22
|
-
const
|
|
23
|
-
const { configuration = {} } = item;
|
|
13
|
+
({ item, doAction, sensor, isWidgetOrder }) => {
|
|
14
|
+
const { configuration, label = 'Slider range' } = item;
|
|
24
15
|
const [configValues] = useConfigGlobalState('configValues');
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
max_value = 100,
|
|
29
|
-
action_data,
|
|
30
|
-
} = configuration;
|
|
31
|
-
const timeout = useRef(null);
|
|
16
|
+
const { config, min_value, max_value, action_data } = configuration;
|
|
17
|
+
const [value, setValue] = useState();
|
|
18
|
+
const [processing, setProcessing] = useState(false);
|
|
32
19
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
}, [
|
|
20
|
+
const onSlidingStart = useCallback(() => {
|
|
21
|
+
setProcessing(true);
|
|
22
|
+
}, []);
|
|
36
23
|
|
|
37
|
-
const
|
|
24
|
+
const onSlidingChange = useCallback(async (number) => {
|
|
25
|
+
setValue(number[0]);
|
|
26
|
+
}, []);
|
|
38
27
|
|
|
39
|
-
const
|
|
40
|
-
async (
|
|
41
|
-
const value_brness = value[0];
|
|
28
|
+
const onSlidingComplete = useCallback(
|
|
29
|
+
async (number) => {
|
|
42
30
|
await doAction(
|
|
43
31
|
action_data,
|
|
44
|
-
JSON.stringify({ value_brness:
|
|
32
|
+
JSON.stringify({ value_brness: number[0], value: number[0] })
|
|
45
33
|
);
|
|
34
|
+
setProcessing(false);
|
|
46
35
|
},
|
|
47
36
|
[action_data, doAction]
|
|
48
37
|
);
|
|
49
38
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
setValueBrightness(value);
|
|
54
|
-
}
|
|
55
|
-
}, [config, configValues, sensor?.device_type]);
|
|
39
|
+
const onFocus = useCallback(() => {
|
|
40
|
+
setProcessing(true);
|
|
41
|
+
}, []);
|
|
56
42
|
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
const onEndEditing = useCallback(async () => {
|
|
44
|
+
if (value) {
|
|
45
|
+
const data = parseInt(value, 10);
|
|
46
|
+
await doAction(
|
|
47
|
+
action_data,
|
|
48
|
+
JSON.stringify({
|
|
49
|
+
value_brness: data,
|
|
50
|
+
value: data,
|
|
51
|
+
})
|
|
52
|
+
);
|
|
61
53
|
}
|
|
54
|
+
setProcessing(false);
|
|
55
|
+
}, [action_data, doAction, value]);
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!processing) {
|
|
59
|
+
if (sensor?.device_type !== DEVICE_TYPE.LG_THINQ) {
|
|
60
|
+
const configValue = configValues[config]?.value || 0;
|
|
61
|
+
setValue(configValue);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [config, configValues, processing, sensor?.device_type]);
|
|
67
65
|
|
|
68
|
-
const onInputChange = (
|
|
69
|
-
if (isNaN(
|
|
66
|
+
const onInputChange = (text) => {
|
|
67
|
+
if (text === '' || isNaN(text)) {
|
|
68
|
+
setValue(min_value);
|
|
70
69
|
return;
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
clearTimeout(timeout.current);
|
|
76
|
-
}
|
|
77
|
-
if (value !== '') {
|
|
78
|
-
timeout.current = setTimeout(() => {
|
|
79
|
-
doAction(
|
|
80
|
-
action_data,
|
|
81
|
-
JSON.stringify({
|
|
82
|
-
value_brness: parseInt(value, 10),
|
|
83
|
-
value: parseInt(value, 10),
|
|
84
|
-
})
|
|
85
|
-
);
|
|
86
|
-
}, 300);
|
|
87
|
-
}
|
|
71
|
+
|
|
72
|
+
const numericValue = Number(text);
|
|
73
|
+
setValue(Math.min(max_value, Math.max(min_value, numericValue)));
|
|
88
74
|
};
|
|
89
75
|
|
|
90
76
|
return (
|
|
91
77
|
<View
|
|
92
78
|
style={(isWidgetOrder && styles.wrapOrderItem) || styles.viewBrightness}
|
|
93
79
|
>
|
|
94
|
-
<Text type="H4">{
|
|
80
|
+
<Text type="H4">{label}</Text>
|
|
95
81
|
<View style={styles.wrap}>
|
|
96
82
|
<Slider
|
|
97
83
|
step={1}
|
|
98
84
|
minimumValue={min_value}
|
|
99
85
|
maximumValue={max_value}
|
|
100
|
-
value={
|
|
101
|
-
onValueChange={onValueChange}
|
|
102
|
-
onSlidingComplete={onChangeBrightness}
|
|
86
|
+
value={value}
|
|
103
87
|
minimumTrackTintColor={Colors.Primary}
|
|
104
88
|
maximumTrackTintColor={Colors.Gray3}
|
|
105
89
|
trackStyle={styles.trackSlider}
|
|
106
90
|
thumbStyle={styles.thumbSlider}
|
|
107
91
|
containerStyle={styles.slider}
|
|
92
|
+
onSlidingStart={onSlidingStart}
|
|
93
|
+
onValueChange={onSlidingChange}
|
|
94
|
+
onSlidingComplete={onSlidingComplete}
|
|
108
95
|
/>
|
|
109
96
|
<_TextInput
|
|
110
97
|
keyboardType="numeric"
|
|
111
98
|
style={styles.text}
|
|
112
99
|
wrapStyle={styles.wrapInputStyle}
|
|
113
100
|
textInputStyle={styles.textInputStyle}
|
|
114
|
-
value={
|
|
101
|
+
value={String(value)}
|
|
102
|
+
onFocus={onFocus}
|
|
115
103
|
onChange={onInputChange}
|
|
104
|
+
onEndEditing={onEndEditing}
|
|
116
105
|
/>
|
|
117
106
|
</View>
|
|
118
107
|
</View>
|
|
@@ -29,11 +29,11 @@ export default StyleSheet.create({
|
|
|
29
29
|
marginTop: 8,
|
|
30
30
|
},
|
|
31
31
|
slider: {
|
|
32
|
-
width: '
|
|
32
|
+
width: '75%',
|
|
33
33
|
},
|
|
34
34
|
wrapInputStyle: {
|
|
35
35
|
marginTop: 0,
|
|
36
|
-
width: '
|
|
36
|
+
width: '25%',
|
|
37
37
|
},
|
|
38
38
|
textInputStyle: {
|
|
39
39
|
marginTop: 0,
|
|
@@ -41,8 +41,6 @@ export default StyleSheet.create({
|
|
|
41
41
|
borderRadius: 4,
|
|
42
42
|
paddingTop: 5,
|
|
43
43
|
paddingBottom: 5,
|
|
44
|
-
paddingHorizontal: 20,
|
|
45
|
-
|
|
46
44
|
shadowColor: Colors.Gray13,
|
|
47
45
|
borderColor: Colors.Gray5,
|
|
48
46
|
borderWidth: 1,
|
|
@@ -68,14 +68,14 @@ const TerminalBoxTemplate = ({ item, doAction, isWidgetOrder }) => {
|
|
|
68
68
|
setValue(e);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
const fromValue = useMemo(() => {
|
|
72
|
-
return configValues[from_config?.id];
|
|
73
|
-
}, [configValues, from_config]);
|
|
74
|
-
|
|
75
71
|
const toValue = useMemo(() => {
|
|
76
72
|
return configValues[to_config?.id];
|
|
77
73
|
}, [configValues, to_config]);
|
|
78
74
|
|
|
75
|
+
const fromValue = useMemo(() => {
|
|
76
|
+
return configValues[from_config?.id];
|
|
77
|
+
}, [configValues, from_config]);
|
|
78
|
+
|
|
79
79
|
const configs = useMemo(() => {
|
|
80
80
|
if (!from_config || !to_config) {
|
|
81
81
|
return [];
|
|
@@ -96,8 +96,8 @@ const TerminalBoxTemplate = ({ item, doAction, isWidgetOrder }) => {
|
|
|
96
96
|
const type = configMessage.id === from_config.id ? 'from' : 'to';
|
|
97
97
|
messages = [
|
|
98
98
|
...messages,
|
|
99
|
-
...configMessage.data.map((
|
|
100
|
-
return { x:
|
|
99
|
+
...configMessage.data.map((object) => {
|
|
100
|
+
return { x: object.x, y: object.y, type };
|
|
101
101
|
}),
|
|
102
102
|
];
|
|
103
103
|
});
|
|
@@ -147,14 +147,14 @@ const TerminalBoxTemplate = ({ item, doAction, isWidgetOrder }) => {
|
|
|
147
147
|
}
|
|
148
148
|
style={styles.scrollView}
|
|
149
149
|
>
|
|
150
|
-
{allMessages.map((
|
|
150
|
+
{allMessages.map((object, index) => {
|
|
151
151
|
return (
|
|
152
152
|
<View
|
|
153
153
|
key={index}
|
|
154
|
-
style={
|
|
154
|
+
style={object.type === 'to' ? styles.to : styles.from}
|
|
155
155
|
>
|
|
156
|
-
<Text>{
|
|
157
|
-
<Text>{moment(
|
|
156
|
+
<Text>{object.y}</Text>
|
|
157
|
+
<Text>{moment(object.x).format('DD/MM/YYYY HH:mm:ss')}</Text>
|
|
158
158
|
</View>
|
|
159
159
|
);
|
|
160
160
|
})}
|
|
@@ -172,7 +172,7 @@ const TerminalBoxTemplate = ({ item, doAction, isWidgetOrder }) => {
|
|
|
172
172
|
accessibilityLabel={AccessibilityLabel.TERMINAL_BOX_BUTTON_SEND}
|
|
173
173
|
disabled={!value}
|
|
174
174
|
>
|
|
175
|
-
<IconOutline name="send" size={
|
|
175
|
+
<IconOutline name="send" size={25} />
|
|
176
176
|
</TouchableOpacity>
|
|
177
177
|
</View>
|
|
178
178
|
</View>
|
|
@@ -30,8 +30,8 @@ const TextBoxTemplate = ({ item, doAction, isWidgetOrder }) => {
|
|
|
30
30
|
setValue(e);
|
|
31
31
|
};
|
|
32
32
|
const valueText = useMemo(() => {
|
|
33
|
-
return configValues[config
|
|
34
|
-
}, [config
|
|
33
|
+
return configValues[config?.id]?.value || ''; // config undefined when is_configuration_ready = False
|
|
34
|
+
}, [config?.id, configValues]);
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
37
|
<View style={(isWidgetOrder && styles.wrapOrderItem) || styles.wrap}>
|
|
@@ -40,33 +40,35 @@ const TextBoxTemplate = ({ item, doAction, isWidgetOrder }) => {
|
|
|
40
40
|
</View>
|
|
41
41
|
|
|
42
42
|
<View style={styles.iconAndText}>
|
|
43
|
-
<Text type="H4">
|
|
43
|
+
<Text style={styles.textValue} type="H4">
|
|
44
|
+
{valueText}
|
|
45
|
+
</Text>
|
|
44
46
|
<TouchableOpacity
|
|
45
47
|
style={styles.iconAndTextOption}
|
|
46
48
|
onPress={onShowAlert}
|
|
47
49
|
accessibilityLabel={AccessibilityLabel.TEXT_BOX_BUTTON_EDIT}
|
|
48
50
|
>
|
|
49
|
-
<IconOutline name="edit" size={
|
|
51
|
+
<IconOutline name="edit" size={25} />
|
|
50
52
|
</TouchableOpacity>
|
|
51
|
-
<AlertAction
|
|
52
|
-
visible={stateAlert.visible}
|
|
53
|
-
hideModal={hideAlertAction}
|
|
54
|
-
title={t('enter_parameters')}
|
|
55
|
-
message={stateAlert.message}
|
|
56
|
-
leftButtonTitle={stateAlert.leftButton}
|
|
57
|
-
leftButtonClick={hideAlertAction}
|
|
58
|
-
rightButtonTitle={stateAlert.rightButton}
|
|
59
|
-
rightButtonClick={onDone}
|
|
60
|
-
rightDisabled={!value}
|
|
61
|
-
transY={transY}
|
|
62
|
-
>
|
|
63
|
-
<_TextInput
|
|
64
|
-
wrapStyle={styles.wrapInputStyle}
|
|
65
|
-
value={value}
|
|
66
|
-
onChange={onInputChange}
|
|
67
|
-
/>
|
|
68
|
-
</AlertAction>
|
|
69
53
|
</View>
|
|
54
|
+
<AlertAction
|
|
55
|
+
visible={stateAlert.visible}
|
|
56
|
+
hideModal={hideAlertAction}
|
|
57
|
+
title={t('enter_parameters')}
|
|
58
|
+
message={stateAlert.message}
|
|
59
|
+
leftButtonTitle={stateAlert.leftButton}
|
|
60
|
+
leftButtonClick={hideAlertAction}
|
|
61
|
+
rightButtonTitle={stateAlert.rightButton}
|
|
62
|
+
rightButtonClick={onDone}
|
|
63
|
+
rightDisabled={!value}
|
|
64
|
+
transY={transY}
|
|
65
|
+
>
|
|
66
|
+
<_TextInput
|
|
67
|
+
wrapStyle={styles.wrapInputStyle}
|
|
68
|
+
value={value}
|
|
69
|
+
onChange={onInputChange}
|
|
70
|
+
/>
|
|
71
|
+
</AlertAction>
|
|
70
72
|
</View>
|
|
71
73
|
);
|
|
72
74
|
};
|