@eohjsc/react-native-smart-city 0.3.91 → 0.3.92
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/Images/Common/reorder.svg +3 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/AutoLockStyles.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +3 -1
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -10
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +1 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/SetupGeneratePasscodeStyles.js +1 -1
- package/src/commons/ActionGroup/OnOffTemplate/SwitchButtonTemplate.js +13 -5
- package/src/commons/ActionGroup/SliderRangeTemplate.js +100 -69
- package/src/commons/ActionGroup/SliderRangeTemplateStyles.js +27 -27
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +4 -1
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -1
- package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +56 -0
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +2 -2
- package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +45 -8
- package/src/commons/ActionGroup/__test__/index.test.js +0 -19
- package/src/commons/ActionGroup/index.js +0 -3
- package/src/commons/ActionTemplate/CurtainAction.js +3 -3
- package/src/commons/ActionTemplate/CurtainActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffButtonAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffSimpleAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffSimpleActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffSmartLockAction.js +2 -2
- package/src/commons/ActionTemplate/OnOffSmartLockActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OneButtonAction.js +1 -1
- package/src/commons/ActionTemplate/OneButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/ThreeButtonAction.js +3 -3
- package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +1 -1
- package/src/commons/Auth/AccountList.js +1 -1
- package/src/commons/Auth/__test__/OtpInputList.test.js +13 -17
- package/src/commons/Automate/ItemAutomate.js +10 -4
- package/src/commons/Automate/__test__/ItemAutomate.test.js +11 -11
- package/src/commons/Device/DeviceAlertStatus.js +2 -1
- package/src/commons/Device/ProgressBar/index.js +5 -11
- package/src/commons/Device/ProgressBar/styles.js +11 -3
- package/src/commons/Device/WindSpeed/Anemometer/index.js +2 -0
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +14 -1
- package/src/commons/Device/WindSpeed/LinearChart/index.js +4 -2
- package/src/commons/FlatListDnD/__test__/index.test.js +49 -0
- package/src/commons/FlatListDnD/index.js +37 -0
- package/src/commons/FlatListDnD/styles.js +12 -0
- package/src/commons/Form/__test__/TextInput.test.js +1 -1
- package/src/commons/Header/HeaderCustom.js +2 -1
- package/src/commons/HorizontalPicker/index.js +65 -38
- package/src/commons/IconComponent/index.js +3 -2
- package/src/commons/MediaPlayer/__test__/index.test.js +8 -3
- package/src/commons/MediaPlayer/index.js +11 -7
- package/src/commons/MenuActionMore/index.js +6 -4
- package/src/commons/Modal/ModalBottom.js +2 -3
- package/src/commons/Modal/ModalCustom.js +2 -3
- package/src/commons/NavBar/index.js +48 -50
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +1 -1
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +1 -1
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +1 -1
- package/src/commons/OneTapTemplate/StatesGridActionTemplateStyles.js +1 -1
- package/src/commons/PreventAccess/index.js +1 -1
- package/src/commons/Sharing/StationDevicePermissions.js +4 -4
- package/src/commons/Sharing/WrapHeaderScrollable.js +5 -5
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +2 -2
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +7 -11
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +11 -6
- package/src/commons/SubUnit/OneTap/index.js +19 -6
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +4 -0
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
- package/src/configs/API.js +6 -0
- package/src/configs/AccessibilityLabel.js +1 -0
- package/src/configs/Colors.js +1 -1
- package/src/configs/Constants.js +12 -18
- package/src/hooks/Common/__test__/useStatusbar.test.js +5 -5
- package/src/hooks/Common/index.js +0 -2
- package/src/hooks/Common/useKeyboardShow.js +4 -4
- package/src/hooks/Common/useStatusBar.js +2 -2
- package/src/hooks/Common/useTitleHeader.js +5 -7
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +11 -0
- package/src/hooks/IoT/useBluetoothConnection.js +6 -3
- package/src/hooks/index.js +1 -2
- package/src/navigations/UnitStack.js +33 -9
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +8 -31
- package/src/screens/AddNewAutoSmart/index.js +24 -60
- package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +1 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +5 -17
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +5 -13
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +9 -11
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -14
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -14
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +3 -2
- package/src/screens/AddNewGateway/index.js +1 -1
- package/src/screens/AllCamera/index.js +2 -3
- package/src/screens/AllGateway/DetailConfigActionZigbee/__test__/index.test.js +0 -18
- package/src/screens/AllGateway/DetailConfigActionZigbee/index.js +1 -1
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +5 -2
- package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/ChooseAction.js +78 -119
- package/src/screens/{AddNewAction → Automate/AddNewAction}/ChooseConfig.js +45 -73
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/LoadingSelectAction.js +1 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/SelectDevices.js +3 -3
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/DeviceStyles.js +5 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/__test__/index.test.js +3 -3
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/index.js +5 -4
- package/src/screens/{AddNewAction → Automate/AddNewAction}/NewActionWrapper.js +11 -10
- package/src/screens/{AddNewAction → Automate/AddNewAction}/SelectControlDevices.js +11 -49
- package/src/screens/{AddNewAction → Automate/AddNewAction}/SelectMonitorDevices.js +10 -42
- package/src/screens/{AddNewAction → Automate/AddNewAction}/SetupConfigCondition.js +52 -101
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SelectActionStyles.js +1 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SelectSensorDevicesStyles.js +1 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Styles/SetupSensorStyles.js +4 -2
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/ChooseAction.test.js +10 -11
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/ChooseConfig.test.js +26 -27
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/SelectControlDevices.test.js +9 -9
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/SelectMonitorDevices.test.js +5 -5
- package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/SetupSensor.test.js +43 -13
- package/src/screens/Automate/Components/InputName.js +64 -0
- package/src/screens/{AddNewOneTap/AddNewOneTapStyles.js → Automate/Components/InputNameStyles.js} +2 -2
- package/src/screens/{EditActionsList → Automate/EditActionsList}/Styles/indexStyles.js +5 -1
- package/src/screens/{EditActionsList → Automate/EditActionsList}/__tests__/index.test.js +6 -6
- package/src/screens/{EditActionsList → Automate/EditActionsList}/index.js +18 -19
- package/src/screens/Automate/MultiUnits.js +68 -66
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +134 -0
- package/src/screens/Automate/OneTap/index.js +16 -0
- package/src/screens/Automate/Scenario/ScenarioName.js +15 -0
- package/src/screens/{AddNewOneTap → Automate/Scenario}/__test__/AddNewOneTap.test.js +27 -45
- package/src/screens/Automate/ScriptDetail/Components/DeleteScript.js +45 -0
- package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +58 -0
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/Styles/indexStyles.js +1 -1
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/__test__/index.test.js +69 -72
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/__test__/useStarredScript.test.js +7 -6
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/hooks/useStarredScript.js +4 -4
- package/src/screens/Automate/ScriptDetail/index.js +346 -0
- package/src/screens/{ScriptDetail → Automate/ScriptDetail}/utils.js +32 -31
- package/src/screens/{SetSchedule → Automate/SetSchedule}/__test__/SelectWeekday.test.js +2 -2
- package/src/screens/{SetSchedule → Automate/SetSchedule}/__test__/index.test.js +21 -46
- package/src/screens/{SetSchedule → Automate/SetSchedule}/components/RepeatOptionsPopup.js +4 -4
- package/src/screens/{SetSchedule → Automate/SetSchedule}/components/RowItem.js +2 -2
- package/src/screens/{SetSchedule → Automate/SetSchedule}/components/SelectWeekday.js +3 -3
- package/src/screens/Automate/SetSchedule/index.js +140 -0
- package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/RepeatOptionsPopupStyles.js +1 -1
- package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/RowItemStyles.js +1 -1
- package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/SelectWeekdayStyles.js +1 -1
- package/src/screens/{SetSchedule → Automate/SetSchedule}/styles/indexStyles.js +1 -1
- package/src/screens/Automate/ValueChange/ValueChangeName.js +16 -0
- package/src/screens/Automate/__test__/MultiUnits.test.js +76 -120
- package/src/screens/Automate/__test__/index.test.js +2 -9
- package/src/screens/Automate/constants.js +0 -0
- package/src/screens/Automate/index.js +11 -22
- package/src/screens/ChangePosition/__test__/index.test.js +75 -0
- package/src/screens/ChangePosition/index.js +112 -0
- package/src/screens/ChangePosition/styles.js +87 -0
- package/src/screens/Device/__test__/detail.test.js +202 -257
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +4 -0
- package/src/screens/Device/components/SensorDisplayItem.js +2 -1
- package/src/screens/Device/components/VisualChart.js +55 -8
- package/src/screens/Device/detail.js +14 -0
- package/src/screens/Device/hooks/__test__/useEmergencyButton.test.js +35 -13
- package/src/screens/Device/hooks/useEvaluateValue.js +20 -2
- package/src/screens/Device/styles.js +7 -0
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +52 -0
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +18 -13
- package/src/screens/Notification/__test__/Notification.test.js +1 -1
- package/src/screens/PlayBackCamera/index.js +2 -3
- package/src/screens/SharedUnit/index.js +5 -4
- package/src/screens/Sharing/SelectUser.js +2 -2
- package/src/screens/Sharing/__test__/MemberList.test.js +9 -15
- package/src/screens/Sharing/__test__/MemberList2.test.js +10 -16
- package/src/screens/Sharing/__test__/SelectUser.test.js +8 -4
- package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +1 -1
- package/src/screens/SmartAccount/index.js +1 -0
- package/src/screens/SubUnit/ManageSubUnit.js +4 -4
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +9 -28
- package/src/screens/TDSGuide/index.js +1 -1
- package/src/screens/Template/GatewayList.js +4 -1
- package/src/screens/Template/__test__/detail.test.js +14 -20
- package/src/screens/Template/detail.js +1 -0
- package/src/screens/UVIndexGuide/index.js +2 -2
- package/src/screens/Unit/Detail.js +6 -5
- package/src/screens/Unit/SelectAddToFavorites.js +1 -1
- package/src/screens/Unit/__test__/ChooseLocation.test.js +8 -13
- package/src/screens/Unit/__test__/Detail.test.js +3 -1
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +1 -1
- package/src/screens/Unit/__test__/SmartAccount.test.js +8 -14
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +4 -0
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +6 -11
- package/src/screens/WaterQualityGuide/index.js +10 -5
- package/src/utils/I18n/translations/en.json +23 -18
- package/src/utils/I18n/translations/vi.json +21 -18
- package/src/utils/Route/index.js +3 -0
- package/src/utils/Utils.js +29 -0
- package/src/utils/__test__/Utils.test.js +6 -0
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +0 -130
- package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +0 -109
- package/src/commons/Auth/SocialButton.js +0 -54
- package/src/commons/Auth/__test__/SocialButton.test.js +0 -46
- package/src/commons/Sharing/__test__/StationDevicePermission.test.js +0 -85
- package/src/hooks/__test__/useInitDeepLink.test.js +0 -28
- package/src/hooks/useInitDeepLink.js +0 -25
- package/src/screens/AddNewOneTap/index.js +0 -156
- package/src/screens/ScriptDetail/hooks/index.js +0 -136
- package/src/screens/ScriptDetail/index.js +0 -446
- package/src/screens/SetSchedule/index.js +0 -200
- /package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/index.js +0 -0
- /package/src/screens/{AddNewAction → Automate/AddNewAction}/__test__/LoadingSelectAction.test.js +0 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef, useState
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, View } from 'react-native';
|
|
3
|
+
import { Colors, Constants } from '../../configs';
|
|
4
4
|
import Text from '../Text';
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
|
|
7
|
-
let isCanChangeValue = false;
|
|
8
|
-
|
|
9
7
|
const HorizontalPicker = ({
|
|
10
8
|
width = Constants.width,
|
|
11
9
|
onChangeValue,
|
|
@@ -24,14 +22,40 @@ const HorizontalPicker = ({
|
|
|
24
22
|
}) => {
|
|
25
23
|
const scrollViewRef = useRef();
|
|
26
24
|
const [scrollX] = useState(new Animated.Value(0));
|
|
25
|
+
const [max, setMax] = useState(maximum);
|
|
26
|
+
|
|
27
|
+
const data = useMemo(() => {
|
|
28
|
+
const array = [];
|
|
29
|
+
const numberOfSteps = Math.floor((max - minimum) / step);
|
|
30
|
+
for (let i = 0; i <= numberOfSteps; i++) {
|
|
31
|
+
array.push(minimum + i * step);
|
|
32
|
+
}
|
|
33
|
+
return array;
|
|
34
|
+
}, [max, minimum, step]);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (minimum >= maximum) {
|
|
38
|
+
setMax(minimum + 10 * step);
|
|
39
|
+
} else {
|
|
40
|
+
setMax(maximum);
|
|
41
|
+
}
|
|
42
|
+
}, [minimum, maximum, step]);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (maximum) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setMax((prev) => {
|
|
49
|
+
if (value + 10 * step > prev) {
|
|
50
|
+
return value + 10 * step;
|
|
51
|
+
}
|
|
52
|
+
return prev;
|
|
53
|
+
});
|
|
54
|
+
}, [maximum, value, setMax, step]);
|
|
27
55
|
|
|
28
56
|
const spacerWidth = (width - stepWidth) / 2;
|
|
29
|
-
let time = useMemo(() => minimum, [minimum]);
|
|
30
57
|
|
|
31
58
|
const renderTime = useMemo(() => {
|
|
32
|
-
const data = [...Array(maximum - minimum + 1).keys()].map(
|
|
33
|
-
(i) => i + minimum
|
|
34
|
-
);
|
|
35
59
|
return (
|
|
36
60
|
<View style={[styles.wrap]}>
|
|
37
61
|
<View
|
|
@@ -40,9 +64,9 @@ const HorizontalPicker = ({
|
|
|
40
64
|
}}
|
|
41
65
|
/>
|
|
42
66
|
{data.map((i, index) => {
|
|
43
|
-
const isStep =
|
|
67
|
+
const isStep = index % 10 === 0;
|
|
44
68
|
return (
|
|
45
|
-
<View key={index}>
|
|
69
|
+
<View key={index} accessibilityLabel={`x-${index}`}>
|
|
46
70
|
<View
|
|
47
71
|
key={i}
|
|
48
72
|
// eslint-disable-next-line react-native/no-inline-styles
|
|
@@ -51,15 +75,12 @@ const HorizontalPicker = ({
|
|
|
51
75
|
height: isStep ? stepHeight : normalHeight,
|
|
52
76
|
width: isStep ? stepWidth : normalWidth,
|
|
53
77
|
borderRadius: isStep ? stepWidth / 2 : normalWidth / 2,
|
|
54
|
-
marginRight: i ===
|
|
78
|
+
marginRight: i === data.length - 1 ? 0 : segmentSpacing,
|
|
55
79
|
}}
|
|
56
80
|
/>
|
|
57
81
|
{isStep && (
|
|
58
|
-
<Text
|
|
59
|
-
|
|
60
|
-
style={[styles.time, time < 10 && styles.time2]}
|
|
61
|
-
>
|
|
62
|
-
{time++}
|
|
82
|
+
<Text color={Colors.Gray7} style={[styles.time, styles.time2]}>
|
|
83
|
+
{i}
|
|
63
84
|
</Text>
|
|
64
85
|
)}
|
|
65
86
|
</View>
|
|
@@ -72,34 +93,40 @@ const HorizontalPicker = ({
|
|
|
72
93
|
/>
|
|
73
94
|
</View>
|
|
74
95
|
);
|
|
75
|
-
|
|
76
|
-
|
|
96
|
+
}, [
|
|
97
|
+
data,
|
|
98
|
+
normalColor,
|
|
99
|
+
normalHeight,
|
|
100
|
+
normalWidth,
|
|
101
|
+
segmentSpacing,
|
|
102
|
+
spacerWidth,
|
|
103
|
+
stepColor,
|
|
104
|
+
stepHeight,
|
|
105
|
+
stepWidth,
|
|
106
|
+
width,
|
|
107
|
+
]);
|
|
77
108
|
|
|
78
109
|
useEffect(() => {
|
|
79
110
|
const scrollListener = scrollX.addListener(({ value: scrollValue }) => {
|
|
80
|
-
|
|
111
|
+
if (!onChangeValue) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const newValue = Math.round(scrollValue / step / 12.8) * step;
|
|
115
|
+
onChangeValue(newValue + minimum);
|
|
81
116
|
});
|
|
82
117
|
return () => scrollX.removeListener(scrollListener);
|
|
83
|
-
|
|
84
|
-
}, []);
|
|
118
|
+
}, [minimum, onChangeValue, scrollX, step]);
|
|
85
119
|
|
|
86
120
|
useEffect(() => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
scrollViewRef.current.scrollTo({
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
clearTimeout(to2);
|
|
95
|
-
}, 1000);
|
|
96
|
-
}
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
scrollViewRef.current &&
|
|
123
|
+
scrollViewRef.current.scrollTo({
|
|
124
|
+
x: value * step * 12.8,
|
|
125
|
+
animated: false,
|
|
126
|
+
});
|
|
127
|
+
}, 10);
|
|
97
128
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
|
-
}, [
|
|
99
|
-
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
return () => (isCanChangeValue = false);
|
|
102
|
-
}, []);
|
|
129
|
+
}, [scrollViewRef.current]); // this is preload default data, run only once
|
|
103
130
|
|
|
104
131
|
return (
|
|
105
132
|
<View style={[styles.container, style]}>
|
|
@@ -131,4 +158,4 @@ const HorizontalPicker = ({
|
|
|
131
158
|
);
|
|
132
159
|
};
|
|
133
160
|
|
|
134
|
-
export default
|
|
161
|
+
export default HorizontalPicker;
|
|
@@ -12,6 +12,7 @@ const IconComponent = memo(
|
|
|
12
12
|
size = 30,
|
|
13
13
|
iconSize = 30,
|
|
14
14
|
style,
|
|
15
|
+
antIconStyle,
|
|
15
16
|
color,
|
|
16
17
|
colorInActive,
|
|
17
18
|
active,
|
|
@@ -70,7 +71,7 @@ const IconComponent = memo(
|
|
|
70
71
|
name={displayIcon}
|
|
71
72
|
color={colorIcon}
|
|
72
73
|
size={iconSize}
|
|
73
|
-
style={[extraStyle, style]}
|
|
74
|
+
style={[extraStyle, antIconStyle || style]}
|
|
74
75
|
/>
|
|
75
76
|
);
|
|
76
77
|
} else {
|
|
@@ -84,7 +85,7 @@ const IconComponent = memo(
|
|
|
84
85
|
name={iconCT}
|
|
85
86
|
color={colorIcon}
|
|
86
87
|
size={iconSize}
|
|
87
|
-
style={[extraStyle, style]}
|
|
88
|
+
style={[extraStyle, antIconStyle || style]}
|
|
88
89
|
/>
|
|
89
90
|
);
|
|
90
91
|
}
|
|
@@ -4,6 +4,7 @@ import { SCProvider } from '../../../context';
|
|
|
4
4
|
import { mockSCStore } from '../../../context/mockStore';
|
|
5
5
|
import { TouchableOpacity } from 'react-native';
|
|
6
6
|
import MediaPlay from '../index';
|
|
7
|
+
import VLCPlayer from 'react-native-vlc-media-player/VLCPlayer';
|
|
7
8
|
|
|
8
9
|
const wrapComponent = (props) => (
|
|
9
10
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -17,9 +18,9 @@ describe('Test MediaPlayer', () => {
|
|
|
17
18
|
beforeAll(() => {
|
|
18
19
|
jest.useFakeTimers();
|
|
19
20
|
props = {
|
|
20
|
-
uri: 'uri',
|
|
21
|
+
uri: 'http://uri',
|
|
21
22
|
previewUri: 'previewUri',
|
|
22
|
-
thumbnail: 'thumbnail',
|
|
23
|
+
thumbnail: { uri: 'thumbnail' },
|
|
23
24
|
background: 'background',
|
|
24
25
|
};
|
|
25
26
|
});
|
|
@@ -28,11 +29,15 @@ describe('Test MediaPlayer', () => {
|
|
|
28
29
|
await act(async () => {
|
|
29
30
|
tree = await create(wrapComponent(props));
|
|
30
31
|
});
|
|
32
|
+
await act(async () => {
|
|
33
|
+
jest.runOnlyPendingTimers();
|
|
34
|
+
});
|
|
31
35
|
const instance = tree.root;
|
|
32
36
|
const pauseButton = instance.findByType(TouchableOpacity);
|
|
33
37
|
await act(async () => {
|
|
34
38
|
await pauseButton.props.onPress();
|
|
35
39
|
});
|
|
36
|
-
|
|
40
|
+
const player = instance.findByType(VLCPlayer);
|
|
41
|
+
expect(player.props.paused).toBeFalsy();
|
|
37
42
|
});
|
|
38
43
|
});
|
|
@@ -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 { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import VLCPlayer from 'react-native-vlc-media-player/VLCPlayer';
|
|
4
4
|
|
|
@@ -117,12 +117,16 @@ const MediaPlayer = memo(
|
|
|
117
117
|
setPaused((p) => !p);
|
|
118
118
|
}, []);
|
|
119
119
|
|
|
120
|
-
const imageSource =
|
|
121
|
-
thumbnail
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
const imageSource = useMemo(() => {
|
|
121
|
+
if (thumbnail) {
|
|
122
|
+
return thumbnail;
|
|
123
|
+
}
|
|
124
|
+
if (background) {
|
|
125
|
+
return background;
|
|
126
|
+
}
|
|
127
|
+
return Images.BgDevice;
|
|
128
|
+
}, [background, thumbnail]);
|
|
129
|
+
|
|
126
130
|
return (
|
|
127
131
|
<View style={styles.wrap}>
|
|
128
132
|
<View style={styles.loadingWrap}>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { TouchableOpacity, ScrollView } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { PopoverMode } from 'react-native-popover-view';
|
|
4
4
|
|
|
5
|
+
import Popover from '../Popover';
|
|
5
6
|
import styles from './MenuActionMoreStyles';
|
|
6
7
|
import Text from '../Text';
|
|
7
8
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
8
|
-
import {
|
|
9
|
+
import { setStatusBarPreview } from '../../hooks/Common/useStatusBar';
|
|
9
10
|
import { Colors } from '../../configs';
|
|
10
11
|
|
|
11
12
|
const MenuActionMore = memo(
|
|
@@ -20,6 +21,7 @@ const MenuActionMore = memo(
|
|
|
20
21
|
idLabelPopover,
|
|
21
22
|
idLabelScrollView,
|
|
22
23
|
idLabelItem = AccessibilityLabel.SUB_UNIT_NAME,
|
|
24
|
+
mode = PopoverMode.RN_MODAL,
|
|
23
25
|
}) => {
|
|
24
26
|
const [isDisable, setIsDisable] = useState(false);
|
|
25
27
|
const onPress = useCallback(
|
|
@@ -36,8 +38,7 @@ const MenuActionMore = memo(
|
|
|
36
38
|
);
|
|
37
39
|
|
|
38
40
|
useEffect(() => {
|
|
39
|
-
|
|
40
|
-
useStatusBarPreview(
|
|
41
|
+
setStatusBarPreview(
|
|
41
42
|
isVisible ? Colors.BlackTransparent5 : Colors.TextTransparent
|
|
42
43
|
);
|
|
43
44
|
}, [isVisible]);
|
|
@@ -51,6 +52,7 @@ const MenuActionMore = memo(
|
|
|
51
52
|
isVisible={isVisible}
|
|
52
53
|
arrowStyle={styles.wrap}
|
|
53
54
|
accessibilityLabel={idLabelPopover}
|
|
55
|
+
mode={mode}
|
|
54
56
|
>
|
|
55
57
|
<ScrollView
|
|
56
58
|
scrollIndicatorInsets={{ right: 1 }}
|
|
@@ -5,7 +5,7 @@ import styles from './Styles/ModalBottomStyles';
|
|
|
5
5
|
import Text from '../Text';
|
|
6
6
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
7
7
|
import { Colors } from '../../configs';
|
|
8
|
-
import {
|
|
8
|
+
import { setStatusBarPreview } from '../../hooks/Common/useStatusBar';
|
|
9
9
|
|
|
10
10
|
const ModalBottom = ({
|
|
11
11
|
isVisible,
|
|
@@ -21,8 +21,7 @@ const ModalBottom = ({
|
|
|
21
21
|
const t = useTranslations();
|
|
22
22
|
|
|
23
23
|
useEffect(() => {
|
|
24
|
-
|
|
25
|
-
useStatusBarPreview(
|
|
24
|
+
setStatusBarPreview(
|
|
26
25
|
isVisible ? Colors.BlackTransparent5 : Colors.TextTransparent
|
|
27
26
|
);
|
|
28
27
|
}, [isVisible]);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import Modal from 'react-native-modal';
|
|
3
3
|
import { Colors } from '../../configs';
|
|
4
|
-
import {
|
|
4
|
+
import { setStatusBarPreview } from '../../hooks/Common/useStatusBar';
|
|
5
5
|
|
|
6
6
|
const ModalCustom = (props) => {
|
|
7
7
|
useEffect(() => {
|
|
8
|
-
|
|
9
|
-
useStatusBarPreview(
|
|
8
|
+
setStatusBarPreview(
|
|
10
9
|
props.isVisible ? Colors.BlackTransparent3_5 : Colors.TextTransparent
|
|
11
10
|
);
|
|
12
11
|
}, [props.isVisible]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import { Icon } from '@ant-design/react-native';
|
|
3
3
|
import { View, TouchableOpacity } from 'react-native';
|
|
4
4
|
|
|
@@ -9,55 +9,53 @@ import { AccessibilityLabel } from '../../configs/Constants';
|
|
|
9
9
|
import Station from '../../screens/Unit/Station';
|
|
10
10
|
import MenuActionMore from '../MenuActionMore';
|
|
11
11
|
|
|
12
|
-
const NavBar =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const handleShowMenuAction = () => showPopoverWithRef(refMenuAction);
|
|
12
|
+
const NavBar = ({
|
|
13
|
+
listMenuItem,
|
|
14
|
+
listStation,
|
|
15
|
+
onSnapToItem,
|
|
16
|
+
indexStation,
|
|
17
|
+
style,
|
|
18
|
+
idLabelScrollView,
|
|
19
|
+
idLabelItem,
|
|
20
|
+
idLabelIconBars,
|
|
21
|
+
}) => {
|
|
22
|
+
const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
|
|
23
|
+
usePopover();
|
|
24
|
+
const refMenuAction = useRef();
|
|
25
|
+
const handleShowMenuAction = () => showPopoverWithRef(refMenuAction);
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</View>
|
|
38
|
-
<TouchableOpacity
|
|
39
|
-
style={styles.btnBack}
|
|
40
|
-
onPress={handleShowMenuAction}
|
|
41
|
-
ref={refMenuAction}
|
|
42
|
-
accessibilityLabel={idLabelIconBars}
|
|
43
|
-
>
|
|
44
|
-
<Icon name={'bars'} size={19} color={Colors.Black} />
|
|
45
|
-
</TouchableOpacity>
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<View style={[styles.wrap, style]}>
|
|
30
|
+
<View style={styles.wrapTitle}>
|
|
31
|
+
<Station
|
|
32
|
+
listStation={listStation}
|
|
33
|
+
onSnapToItem={onSnapToItem}
|
|
34
|
+
indexStation={indexStation}
|
|
35
|
+
/>
|
|
46
36
|
</View>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
37
|
+
<TouchableOpacity
|
|
38
|
+
style={styles.btnBack}
|
|
39
|
+
onPress={handleShowMenuAction}
|
|
40
|
+
ref={refMenuAction}
|
|
41
|
+
accessibilityLabel={idLabelIconBars}
|
|
42
|
+
>
|
|
43
|
+
<Icon name={'bars'} size={19} color={Colors.Black} />
|
|
44
|
+
</TouchableOpacity>
|
|
45
|
+
</View>
|
|
46
|
+
<MenuActionMore
|
|
47
|
+
isVisible={showingPopover}
|
|
48
|
+
hideMore={hidePopover}
|
|
49
|
+
listMenuItem={listMenuItem}
|
|
50
|
+
childRef={childRef}
|
|
51
|
+
onItemClick={onSnapToItem}
|
|
52
|
+
isTextCenter={false}
|
|
53
|
+
idLabelPopover={AccessibilityLabel.NAVBAR_MENU_ACTION_MORE}
|
|
54
|
+
wrapStyle={styles.wrapStyle}
|
|
55
|
+
idLabelScrollView={idLabelScrollView}
|
|
56
|
+
idLabelItem={idLabelItem}
|
|
57
|
+
/>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
63
61
|
export default NavBar;
|
|
@@ -106,7 +106,7 @@ const NumberUpDownActionTemplate = ({ device, item = {}, onSelectAction }) => {
|
|
|
106
106
|
>
|
|
107
107
|
<View style={styles.popoverStyle}>
|
|
108
108
|
<View>
|
|
109
|
-
<Text type="H4" bold style={styles.
|
|
109
|
+
<Text type="H4" bold style={styles.textWithLine}>
|
|
110
110
|
{t('set_temperature')}
|
|
111
111
|
</Text>
|
|
112
112
|
<View style={styles.modalContent}>
|
|
@@ -77,7 +77,7 @@ const OptionsDropdownActionTemplate = ({ device, item, onSelectAction }) => {
|
|
|
77
77
|
>
|
|
78
78
|
<View style={styles.popoverStyle}>
|
|
79
79
|
<View>
|
|
80
|
-
<Text type="H4" bold style={styles.
|
|
80
|
+
<Text type="H4" bold style={styles.textWithLine}>
|
|
81
81
|
{title ? title : t('options')}
|
|
82
82
|
</Text>
|
|
83
83
|
<View style={styles.wrapContent}>
|
|
@@ -37,7 +37,7 @@ const ActionItem = ({
|
|
|
37
37
|
onPress={handleSelectAction}
|
|
38
38
|
accessibilityLabel={AccessibilityLabel.STATES_GRID_ACTION_GRID_ITEM}
|
|
39
39
|
>
|
|
40
|
-
<Text type="H4" style={styles.
|
|
40
|
+
<Text type="H4" style={styles.textWithLine}>
|
|
41
41
|
{item.text}
|
|
42
42
|
</Text>
|
|
43
43
|
</TouchableOpacity>
|
|
@@ -15,7 +15,7 @@ const PreventAccess = memo(({ headerBodyText, visible, hidePreventAccess }) => {
|
|
|
15
15
|
const dataText = useMemo(() => {
|
|
16
16
|
return {
|
|
17
17
|
headerText: t('note'),
|
|
18
|
-
bodyText: t('
|
|
18
|
+
bodyText: t('This_name_was_removed', {
|
|
19
19
|
name: headerBodyText ? headerBodyText : '',
|
|
20
20
|
}),
|
|
21
21
|
endOfText: t('back'),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import { View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
@@ -13,7 +13,7 @@ import DoorInactive from '../../../assets/images/Device/door-inactive.svg';
|
|
|
13
13
|
|
|
14
14
|
import DevicePermissionsCheckbox from './DevicePermissionsCheckbox';
|
|
15
15
|
|
|
16
|
-
const StationDevicePermissions =
|
|
16
|
+
const StationDevicePermissions = ({ dataStation, onselectSensor }) => {
|
|
17
17
|
const t = useTranslations();
|
|
18
18
|
const [listChosen, setListChosen] = useState({}); // { sensorId : indexConfigChoosen , ...}
|
|
19
19
|
const [expandedIndex, setExpandedIndex] = useState(-1);
|
|
@@ -122,12 +122,12 @@ const StationDevicePermissions = memo(({ dataStation, onselectSensor }) => {
|
|
|
122
122
|
<Text style={styles.textEmpty}>{t('no_device')}</Text>
|
|
123
123
|
)}
|
|
124
124
|
{dataStation.sensors.map((device, index) => (
|
|
125
|
-
<RowDevice sensor={device} index={index} />
|
|
125
|
+
<RowDevice sensor={device} index={index} key={device.id} />
|
|
126
126
|
))}
|
|
127
127
|
</View>
|
|
128
128
|
</>
|
|
129
129
|
);
|
|
130
|
-
}
|
|
130
|
+
};
|
|
131
131
|
|
|
132
132
|
const styles = StyleSheet.create({
|
|
133
133
|
box: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
RefreshControl,
|
|
4
|
-
StyleSheet,
|
|
5
3
|
Animated,
|
|
6
|
-
View,
|
|
7
4
|
Platform,
|
|
5
|
+
RefreshControl,
|
|
8
6
|
SafeAreaView,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
View,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import { ActivityIndicator } from '@ant-design/react-native';
|
|
11
11
|
import { isIphoneX } from 'react-native-iphone-x-helper';
|
|
@@ -109,7 +109,7 @@ const WrapHeaderScrollable = ({
|
|
|
109
109
|
);
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
export default
|
|
112
|
+
export default WrapHeaderScrollable;
|
|
113
113
|
|
|
114
114
|
const styles = StyleSheet.create({
|
|
115
115
|
container: {
|
|
@@ -20,8 +20,8 @@ describe('Test DevicePermissionsCheckbox', () => {
|
|
|
20
20
|
let sensor = {
|
|
21
21
|
icon: 'caret-down',
|
|
22
22
|
id: 10,
|
|
23
|
-
read_configs: [1],
|
|
24
|
-
actions: [13],
|
|
23
|
+
read_configs: [{ id: 1 }],
|
|
24
|
+
actions: [{ id: 13 }],
|
|
25
25
|
};
|
|
26
26
|
const mockFunction = jest.fn();
|
|
27
27
|
it('test create DevicePermissionsCheckbox', async () => {
|
|
@@ -89,21 +89,17 @@ const ItemOneTap = memo(
|
|
|
89
89
|
const iconKit = script?.icon_kit;
|
|
90
90
|
if (iconKit) {
|
|
91
91
|
return <FImage source={{ uri: iconKit }} style={styles.iconSensor} />;
|
|
92
|
-
}
|
|
92
|
+
}
|
|
93
|
+
if (type === AUTOMATE_TYPE.ONE_TAP) {
|
|
93
94
|
return <OneTap />;
|
|
94
|
-
}
|
|
95
|
+
}
|
|
96
|
+
if (type === AUTOMATE_TYPE.VALUE_CHANGE) {
|
|
95
97
|
return <ValueChange />;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
AUTOMATE_TYPE.EVENT,
|
|
99
|
-
AUTOMATE_TYPE.EVENT_ACTION,
|
|
100
|
-
AUTOMATE_TYPE.EVENT_SENSOR,
|
|
101
|
-
].includes(type)
|
|
102
|
-
) {
|
|
98
|
+
}
|
|
99
|
+
if ([AUTOMATE_TYPE.EVENT].includes(type)) {
|
|
103
100
|
return <Event />;
|
|
104
|
-
} else {
|
|
105
|
-
return <Schedule />;
|
|
106
101
|
}
|
|
102
|
+
return <Schedule />;
|
|
107
103
|
};
|
|
108
104
|
const activateAt = activate_at
|
|
109
105
|
? timeDifference(new Date(), moment(activate_at), true)
|
|
@@ -8,6 +8,7 @@ import SubUnitAutomate from '..';
|
|
|
8
8
|
import {
|
|
9
9
|
AUTOMATE_TYPE,
|
|
10
10
|
AccessibilityLabel,
|
|
11
|
+
AUTOMATE_TABS,
|
|
11
12
|
} from '../../../../configs/Constants';
|
|
12
13
|
import { SCProvider } from '../../../../context';
|
|
13
14
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
@@ -50,7 +51,7 @@ let data = {
|
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
],
|
|
53
|
-
type:
|
|
54
|
+
type: AUTOMATE_TABS.SCENARIO,
|
|
54
55
|
},
|
|
55
56
|
],
|
|
56
57
|
};
|
|
@@ -78,7 +79,11 @@ describe('test Item', () => {
|
|
|
78
79
|
await item[0].props.onPress();
|
|
79
80
|
});
|
|
80
81
|
expect(mockedNavigate).toHaveBeenCalledWith(Routes.AddNewOneTap, {
|
|
81
|
-
|
|
82
|
+
automate: {
|
|
83
|
+
type: 'one_tap',
|
|
84
|
+
unit: undefined,
|
|
85
|
+
},
|
|
86
|
+
closeScreen: undefined,
|
|
82
87
|
});
|
|
83
88
|
mockedNavigate.mockClear();
|
|
84
89
|
|
|
@@ -198,8 +203,8 @@ describe('test Item', () => {
|
|
|
198
203
|
data.type = 'schedule';
|
|
199
204
|
data.listAutomate = [
|
|
200
205
|
{
|
|
201
|
-
text:
|
|
202
|
-
type:
|
|
206
|
+
text: AUTOMATE_TABS.AUTOMATION,
|
|
207
|
+
type: AUTOMATE_TABS.AUTOMATION,
|
|
203
208
|
data: [
|
|
204
209
|
{
|
|
205
210
|
id: 1,
|
|
@@ -233,8 +238,8 @@ describe('test Item', () => {
|
|
|
233
238
|
await item[0].props.onPress();
|
|
234
239
|
});
|
|
235
240
|
expect(mockedNavigate).toHaveBeenCalledWith(Routes.AddNewAutoSmart, {
|
|
236
|
-
type: AUTOMATE_TYPE.VALUE_CHANGE,
|
|
237
|
-
|
|
241
|
+
automate: { type: AUTOMATE_TYPE.VALUE_CHANGE, unit: undefined },
|
|
242
|
+
closeScreen: undefined,
|
|
238
243
|
});
|
|
239
244
|
mockedNavigate.mockClear();
|
|
240
245
|
|