@eohjsc/react-native-smart-city 0.3.85 → 0.3.87
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 +3 -2
- package/src/Images/Common/logo.png +0 -0
- package/src/Images/Common/logo@2x.png +0 -0
- package/src/Images/Common/logo@3x.png +0 -0
- package/src/Images/Common/unit_default_background.png +0 -0
- package/src/Images/Common/unit_default_background@2x.png +0 -0
- package/src/Images/Common/unit_default_background@3x.png +0 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +1 -1
- package/src/commons/ActionGroup/SliderRangeTemplate.js +7 -13
- package/src/commons/ActionGroup/SliderRangeTemplateStyles.js +0 -1
- package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +4 -4
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +30 -0
- package/src/commons/ActionGroup/__test__/index.test.js +1 -1
- package/src/commons/Automate/__test__/ItemAutomate.test.js +25 -3
- package/src/commons/{FourButtonFilterHistory → ChartAggregationOption}/__test__/FourButtonFilterHistory.test.js +2 -2
- package/src/commons/ChartAggregationOption/index.js +72 -0
- package/src/commons/{FourButtonFilterHistory → ChartAggregationOption}/styles.js +0 -0
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +19 -0
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +30 -9
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +49 -0
- package/src/commons/Dashboard/MyUnit/index.js +48 -16
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +3 -12
- package/src/commons/DateTimeRangeChange/index.js +113 -19
- package/src/commons/Device/HistoryChart.js +2 -2
- package/src/commons/Device/LinearChart.js +2 -2
- package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +1 -1
- package/src/commons/Device/ProgressBar/index.js +4 -2
- package/src/commons/Device/ProgressBar/styles.js +1 -0
- package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +1 -1
- package/src/commons/Device/SonosSpeaker/index.js +1 -1
- package/src/commons/Device/WindSpeed/Anemometer/index.js +101 -14
- package/src/commons/Device/WindSpeed/__test__/Anemometer.test.js +89 -2
- package/src/commons/ModalPopupCT/index.js +21 -2
- package/src/commons/ModalPopupCT/styles.js +7 -0
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +7 -7
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +40 -13
- package/src/commons/WrapParallaxScrollView/index.js +5 -4
- package/src/configs/API.js +4 -3
- package/src/configs/AccessibilityLabel.js +7 -0
- package/src/configs/Constants.js +1 -0
- package/src/configs/Images.js +1 -0
- package/src/context/actionType.ts +5 -0
- package/src/context/mockStore.ts +1 -0
- package/src/context/reducer.ts +29 -0
- package/src/hooks/Common/useTranslations.ts +1 -1
- package/src/hooks/IoT/useRemoteControl.js +0 -1
- package/src/screens/ActivityLog/__test__/FilterPopup.test.js +1 -1
- package/src/screens/ActivityLog/__test__/index.test.js +1 -1
- package/src/screens/AddNewAction/__test__/LoadingSelectAction.test.js +16 -0
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +15 -0
- package/src/screens/AllCamera/__test__/index.test.js +1 -1
- package/src/screens/AllCamera/index.js +2 -2
- package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +179 -111
- package/src/screens/AllGateway/DetailConfigActionInternal/index.js +48 -50
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +4 -0
- package/src/screens/AllGateway/DeviceInternalDetail/index.js +14 -1
- package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +25 -0
- package/src/screens/AllGateway/GatewayConnectionMethods/index.js +59 -35
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +14 -4
- package/src/screens/AllGateway/GatewayInfo/index.js +21 -2
- package/src/screens/AllGateway/components/Detail/__test__/index.test.js +28 -1
- package/src/screens/AllGateway/components/Detail/index.js +8 -2
- package/src/screens/AllGateway/components/Information/index.js +4 -1
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -1
- package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
- package/src/screens/AllGateway/components/TabPaneCT/styles.js +1 -1
- package/src/screens/ConfirmUnitDeletion/index.js +6 -2
- package/src/screens/Device/__test__/DetailHistoryChart.test.js +1 -0
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +150 -2
- package/src/screens/Device/components/ChartWrapper.js +39 -0
- package/src/screens/Device/components/ChartWrapperStyles.js +42 -0
- package/src/screens/Device/components/SensorDisplayItem.js +6 -2
- package/src/screens/Device/components/VisualChart.js +255 -0
- package/src/screens/Device/components/__test__/VisualChart.test.js +440 -0
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -6
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +3 -0
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +47 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +15 -2
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +52 -0
- package/src/screens/Unit/ManageUnit.js +7 -3
- package/src/screens/Unit/components/__test__/Header.test.js +9 -0
- package/src/utils/I18n/translations/en.json +4 -1
- package/src/utils/I18n/translations/vi.json +4 -1
- package/src/utils/Utils.js +6 -0
- package/src/commons/FourButtonFilterHistory/index.js +0 -72
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import moment from 'moment';
|
|
3
3
|
|
|
4
4
|
import { API } from '../../../configs';
|
|
@@ -23,6 +23,37 @@ const fetchDataS3 = async (url) => {
|
|
|
23
23
|
return data;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
export const useFetchConfigHistory = (configs, setChartData) => {
|
|
27
|
+
const fetchDataDisplayHistory = useCallback(
|
|
28
|
+
async (startDate, endDate) => {
|
|
29
|
+
if (!configs.length || !startDate || !endDate) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let params = new URLSearchParams();
|
|
34
|
+
let validConfigs = configs.filter((item) => item.id);
|
|
35
|
+
if (!validConfigs.length) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
validConfigs.forEach((item) => {
|
|
39
|
+
params.append('configs', item.id);
|
|
40
|
+
});
|
|
41
|
+
params.append('date_from', startDate.format('YYYY-MM-DDTHH:mm:ss'));
|
|
42
|
+
params.append('date_to', endDate.format('YYYY-MM-DDTHH:mm:ss'));
|
|
43
|
+
|
|
44
|
+
const { success, data } = await axiosGet(
|
|
45
|
+
API.CONFIG.DISPLAY_HISTORY_V3(),
|
|
46
|
+
{
|
|
47
|
+
params,
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
await updateConfigChart(success, data, configs, setChartData);
|
|
51
|
+
},
|
|
52
|
+
[configs, setChartData]
|
|
53
|
+
);
|
|
54
|
+
return fetchDataDisplayHistory;
|
|
55
|
+
};
|
|
56
|
+
|
|
26
57
|
export const updateConfigChart = async (
|
|
27
58
|
success,
|
|
28
59
|
data,
|
|
@@ -90,16 +121,9 @@ export const updateConfigChart = async (
|
|
|
90
121
|
});
|
|
91
122
|
};
|
|
92
123
|
|
|
93
|
-
const areEqual = ({ configs: oldConfigs }, { configs: newConfigs }) => {
|
|
94
|
-
return (
|
|
95
|
-
JSON.stringify(oldConfigs.map((config) => config.id).sort()) ===
|
|
96
|
-
JSON.stringify(newConfigs.map((config) => config.id).sort())
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
124
|
let timeoutId;
|
|
101
125
|
|
|
102
|
-
const ConfigHistoryChart =
|
|
126
|
+
const ConfigHistoryChart = ({ configs }) => {
|
|
103
127
|
const [chartData, setChartData] = useState(configs);
|
|
104
128
|
const [startDate, setStartDate] = useState(
|
|
105
129
|
moment().subtract(1, 'days').valueOf()
|
|
@@ -121,9 +145,12 @@ const ConfigHistoryChart = memo(({ configs }) => {
|
|
|
121
145
|
'date_to',
|
|
122
146
|
moment(endDate).utc().format('YYYY-MM-DD HH:mm:ss')
|
|
123
147
|
);
|
|
124
|
-
const { success, data } = await axiosGet(
|
|
125
|
-
|
|
126
|
-
|
|
148
|
+
const { success, data } = await axiosGet(
|
|
149
|
+
API.CONFIG.DISPLAY_HISTORY_V3(),
|
|
150
|
+
{
|
|
151
|
+
params,
|
|
152
|
+
}
|
|
153
|
+
);
|
|
127
154
|
updateConfigChart(success, data, configuration, setChartData);
|
|
128
155
|
};
|
|
129
156
|
|
|
@@ -145,6 +172,6 @@ const ConfigHistoryChart = memo(({ configs }) => {
|
|
|
145
172
|
setEndDate={setEndDate}
|
|
146
173
|
/>
|
|
147
174
|
);
|
|
148
|
-
}
|
|
175
|
+
};
|
|
149
176
|
|
|
150
177
|
export default ConfigHistoryChart;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import ParallaxScrollView from '../../libs/react-native-parallax-scroll-view';
|
|
2
|
+
import { StatusBar, View, StyleSheet } from 'react-native';
|
|
4
3
|
import LinearGradient from 'react-native-linear-gradient';
|
|
5
4
|
|
|
6
5
|
import { Colors, Device, Images } from '../../configs';
|
|
7
6
|
import Text from '../Text';
|
|
8
7
|
import HeaderUnit from '../Unit/HeaderUnit';
|
|
9
8
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
9
|
+
import FImage from '../FImage';
|
|
10
|
+
import ParallaxScrollView from '../../libs/react-native-parallax-scroll-view';
|
|
10
11
|
|
|
11
12
|
const stickyHeaderHeight =
|
|
12
13
|
Device.TopbarHeight + (Device.isIOS ? 0 : StatusBar.currentHeight);
|
|
@@ -62,9 +63,9 @@ const WrapParallaxScrollView = ({
|
|
|
62
63
|
const renderBackground = useCallback(
|
|
63
64
|
() => (
|
|
64
65
|
<View style={styles.image}>
|
|
65
|
-
<
|
|
66
|
+
<FImage
|
|
66
67
|
style={styles.image}
|
|
67
|
-
source={{ uri: uriImg }}
|
|
68
|
+
source={uriImg ? { uri: uriImg } : Images.unitDefaultBackground}
|
|
68
69
|
defaultSource={Images.BgUnit}
|
|
69
70
|
resizeMode="cover"
|
|
70
71
|
/>
|
package/src/configs/API.js
CHANGED
|
@@ -86,7 +86,7 @@ const API = {
|
|
|
86
86
|
ACCESS: (id) => `/property_manager/shared_sensors/${id}/access/`,
|
|
87
87
|
},
|
|
88
88
|
CONFIG: {
|
|
89
|
-
|
|
89
|
+
DISPLAY_HISTORY_V3: () => '/chip_manager/configs/value_history_v3/',
|
|
90
90
|
},
|
|
91
91
|
AUTOMATE: {
|
|
92
92
|
ACTION_ONE_TAP: (id) => `/property_manager/automate/${id}/action_one_tap/`,
|
|
@@ -222,6 +222,7 @@ const API = {
|
|
|
222
222
|
REBOOT: (id) => `/chip_manager/developer_mode_chips/${id}/reboot_chip/`,
|
|
223
223
|
},
|
|
224
224
|
ARDUINO: {
|
|
225
|
+
DETAIL: (id) => `/iot/modules/arduino/gateways/${id}/`,
|
|
225
226
|
DEVICE: (gatewayId) =>
|
|
226
227
|
`/iot/modules/arduino/gateways/${gatewayId}/devices/`,
|
|
227
228
|
DEVICE_DETAIL: (gatewayId, deviceId) =>
|
|
@@ -236,6 +237,7 @@ const API = {
|
|
|
236
237
|
`/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/actions/${actionId}/`,
|
|
237
238
|
},
|
|
238
239
|
ZIGBEE: {
|
|
240
|
+
DETAIL: (id) => `/iot/modules/zigbee/gateways/${id}/`,
|
|
239
241
|
SEARCH_DEVICE: (id) => `/iot/modules/zigbee/chips/${id}/search_device/`,
|
|
240
242
|
DEVICE_CONFIGURATION: (id, deviceId) =>
|
|
241
243
|
`/iot/modules/zigbee/chips/${id}/sensors/${deviceId}/configuration/`,
|
|
@@ -250,6 +252,7 @@ const API = {
|
|
|
250
252
|
`/iot/modules/zigbee/gateways/${gatewayId}/devices/${deviceId}/zigbee_actions/`,
|
|
251
253
|
},
|
|
252
254
|
MODBUS: {
|
|
255
|
+
DETAIL: (id) => `/iot/modules/modbus/gateways/${id}/`,
|
|
253
256
|
DEVICE: (gatewayId) =>
|
|
254
257
|
`/iot/modules/modbus/gateways/${gatewayId}/devices/`,
|
|
255
258
|
DEVICE_DETAIL: (gatewayId, deviceId) =>
|
|
@@ -260,8 +263,6 @@ const API = {
|
|
|
260
263
|
`/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/actions/`,
|
|
261
264
|
ACTION_DETAIL: (gatewayId, deviceId, actionId) =>
|
|
262
265
|
`/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/actions/${actionId}/`,
|
|
263
|
-
ACTION_ITEM_DETAIL: (actionId, actionItemId) =>
|
|
264
|
-
`/iot/modules/modbus/actions/${actionId}/items/${actionItemId}/`,
|
|
265
266
|
},
|
|
266
267
|
},
|
|
267
268
|
};
|
|
@@ -94,6 +94,10 @@ export default {
|
|
|
94
94
|
GROUP_BUTTON_TYPE: {
|
|
95
95
|
BUTTON_BOTTOM: 'BUTTON_BOTTOM',
|
|
96
96
|
},
|
|
97
|
+
HEADER_BUTTON_TYPE_RELOAD: 'HEADER_BUTTON_TYPE_RELOAD',
|
|
98
|
+
HEADER_BUTTON_TYPE_MORE: 'HEADER_BUTTON_TYPE_MORE',
|
|
99
|
+
ICON_OUTLINE_TYPE_RELOAD: 'ICON_OUTLINE_TYPE_RELOAD',
|
|
100
|
+
ICON_OUTLINE_TYPE_MORE: 'ICON_OUTLINE_TYPE_MORE',
|
|
97
101
|
|
|
98
102
|
// sub unit
|
|
99
103
|
SUB_UNIT_FULL_CAMERA: 'SUB_UNIT_FULL_CAMERA',
|
|
@@ -358,6 +362,9 @@ export default {
|
|
|
358
362
|
STATION_DEVICE_PERMISSIONS: 'STATION_DEVICE_PERMISSIONS',
|
|
359
363
|
TEXT_NO_DATA_STATIONS: 'TEXT_NO_DATA_STATIONS',
|
|
360
364
|
|
|
365
|
+
// Gauge widget
|
|
366
|
+
WRAP_TOOL_TIP: 'WRAP_TOOL_TIP',
|
|
367
|
+
|
|
361
368
|
// Manage Unit
|
|
362
369
|
MANAGE_UNIT_CHANGE_NAME: 'MANAGE_UNIT_CHANGE_NAME',
|
|
363
370
|
MANAGE_UNIT_CHANGE_LOCATION: 'MANAGE_UNIT_CHANGE_LOCATION',
|
package/src/configs/Constants.js
CHANGED
package/src/configs/Images.js
CHANGED
|
@@ -26,4 +26,5 @@ export default {
|
|
|
26
26
|
lg: require('../Images/SmartAccount/LG.png'),
|
|
27
27
|
inforCode: require('../Images/DevMode/inforCode.png'),
|
|
28
28
|
activeCurrentSensor: require('../Images/Common/Sunny.png'),
|
|
29
|
+
unitDefaultBackground: require('../Images/Common/unit_default_background.png'),
|
|
29
30
|
};
|
|
@@ -33,6 +33,9 @@ export const Action = {
|
|
|
33
33
|
REFRESH_PERCENT: 'REFRESH_PERCENT',
|
|
34
34
|
PROCESS_DONE: 'PROCESS_DONE',
|
|
35
35
|
IS_EMERGENCY_POPUP: 'IS_EMERGENCY_POPUP',
|
|
36
|
+
IS_CHECK_CLEAR_CACHE_UNITS: 'IS_CHECK_CLEAR_CACHE_UNITS',
|
|
37
|
+
DELETE_UNIT_SUCCESSFULLY: 'DELETE_UNIT_SUCCESSFULLY',
|
|
38
|
+
RESET_DELETE_UNIT_ACTION: 'RESET_DELETE_UNIT_ACTION',
|
|
36
39
|
// NOTE: DEV MODE
|
|
37
40
|
SET_WIDGET_DRAGGING: 'SET_WIDGET_DRAGGING',
|
|
38
41
|
SET_IS_EDITING_TEMPLATE: 'SET_IS_EDITING_TEMPLATE',
|
|
@@ -96,6 +99,8 @@ export type AppType = {
|
|
|
96
99
|
notificationData: any;
|
|
97
100
|
popoverAnimating: boolean;
|
|
98
101
|
isLockWhenPickColor: boolean;
|
|
102
|
+
isNeedUpdateCache: boolean;
|
|
103
|
+
isDeleteUnitSuccessFully: boolean;
|
|
99
104
|
};
|
|
100
105
|
|
|
101
106
|
export type IoTType = {
|
package/src/context/mockStore.ts
CHANGED
package/src/context/reducer.ts
CHANGED
|
@@ -69,6 +69,8 @@ export const initialState = {
|
|
|
69
69
|
popoverAnimating: false,
|
|
70
70
|
isLockWhenPickColor: false,
|
|
71
71
|
isEmergencyPopupScreen: false,
|
|
72
|
+
isNeedUpdateCache: false,
|
|
73
|
+
isDeleteUnitSuccessFully: false,
|
|
72
74
|
},
|
|
73
75
|
iot: {
|
|
74
76
|
bluetooth: {
|
|
@@ -443,6 +445,15 @@ export const reducer = (currentState: ContextData, action: Action) => {
|
|
|
443
445
|
},
|
|
444
446
|
};
|
|
445
447
|
|
|
448
|
+
case Action.IS_CHECK_CLEAR_CACHE_UNITS:
|
|
449
|
+
return {
|
|
450
|
+
...currentState,
|
|
451
|
+
app: {
|
|
452
|
+
...currentState.app,
|
|
453
|
+
isNeedUpdateCache: payload,
|
|
454
|
+
},
|
|
455
|
+
};
|
|
456
|
+
|
|
446
457
|
case Action.SET_POPOVER_ANIMATING:
|
|
447
458
|
return {
|
|
448
459
|
...currentState,
|
|
@@ -496,6 +507,24 @@ export const reducer = (currentState: ContextData, action: Action) => {
|
|
|
496
507
|
...currentState,
|
|
497
508
|
};
|
|
498
509
|
|
|
510
|
+
case Action.DELETE_UNIT_SUCCESSFULLY:
|
|
511
|
+
return {
|
|
512
|
+
...currentState,
|
|
513
|
+
app: {
|
|
514
|
+
...currentState.app,
|
|
515
|
+
isDeleteUnitSuccessFully: true,
|
|
516
|
+
},
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
case Action.RESET_DELETE_UNIT_ACTION:
|
|
520
|
+
return {
|
|
521
|
+
...currentState,
|
|
522
|
+
app: {
|
|
523
|
+
...currentState.app,
|
|
524
|
+
isDeleteUnitSuccessFully: false,
|
|
525
|
+
},
|
|
526
|
+
};
|
|
527
|
+
|
|
499
528
|
default:
|
|
500
529
|
return currentState;
|
|
501
530
|
}
|
|
@@ -9,7 +9,7 @@ import { useSCContextSelector } from '../../context';
|
|
|
9
9
|
import { getConfigGlobalState } from '../../iot/states.js';
|
|
10
10
|
|
|
11
11
|
export const useTranslations = () => {
|
|
12
|
-
const lang = useSCContextSelector((state) => state
|
|
12
|
+
const lang = useSCContextSelector((state) => state?.language || 'en');
|
|
13
13
|
|
|
14
14
|
const language: Language = lang as Language;
|
|
15
15
|
|
|
@@ -125,7 +125,7 @@ it('test date picker pick valid and invalid date', async () => {
|
|
|
125
125
|
});
|
|
126
126
|
const instance = tree.root;
|
|
127
127
|
const dateTimeRangeChange = instance.findByType(DateTimeRangeChange);
|
|
128
|
-
const datePicker = instance.
|
|
128
|
+
const datePicker = instance.findAllByType(DateTimePickerModal)[2];
|
|
129
129
|
|
|
130
130
|
expect(dateTimeRangeChange.props.startTime).toBe(dateFrom.valueOf());
|
|
131
131
|
expect(dateTimeRangeChange.props.endTime).toBe(dateTo.valueOf());
|
|
@@ -114,7 +114,7 @@ describe('Test Activity log', () => {
|
|
|
114
114
|
expect(filterPopup[0].props.isVisible).toBeTruthy();
|
|
115
115
|
|
|
116
116
|
const dateTimeRangeChange = instance.findByType(DateTimeRangeChange);
|
|
117
|
-
const datePicker = instance.
|
|
117
|
+
const datePicker = instance.findAllByType(DateTimePickerModal)[2];
|
|
118
118
|
|
|
119
119
|
// pick start date
|
|
120
120
|
await act(async () => {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { act, create } from 'react-test-renderer';
|
|
4
|
+
|
|
5
|
+
import LoadingSelectAction from '../Components/LoadingSelectAction';
|
|
6
|
+
describe('Test LoadingSelectAction', () => {
|
|
7
|
+
let tree;
|
|
8
|
+
it('Test render', async () => {
|
|
9
|
+
await act(async () => {
|
|
10
|
+
tree = await create(<LoadingSelectAction />);
|
|
11
|
+
});
|
|
12
|
+
const instance = tree.root;
|
|
13
|
+
const views = instance.findAllByType(View);
|
|
14
|
+
expect(views).toHaveLength(1);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -7,6 +7,7 @@ import { mockSCStore } from '../../../context/mockStore';
|
|
|
7
7
|
import QRScan from '../../ScanChipQR/components/QRScan';
|
|
8
8
|
import { getTranslate } from '../../../utils/I18n';
|
|
9
9
|
import Routes from '../../../utils/Route';
|
|
10
|
+
import ViewButtonBottom from '../../../commons/ViewButtonBottom';
|
|
10
11
|
|
|
11
12
|
const mockedGoBack = jest.fn();
|
|
12
13
|
const mockedNavigate = jest.fn();
|
|
@@ -41,6 +42,20 @@ describe('test scan modbus QR', () => {
|
|
|
41
42
|
expect(qrScanComponents).toHaveLength(1);
|
|
42
43
|
});
|
|
43
44
|
|
|
45
|
+
it('cancel scan modbus device', async () => {
|
|
46
|
+
const route = { params: {} };
|
|
47
|
+
await act(async () => {
|
|
48
|
+
tree = renderer.create(wrapComponent(route));
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const instance = tree.root;
|
|
52
|
+
const qrScanComponent = instance.findAllByType(ViewButtonBottom)[0];
|
|
53
|
+
await act(async () => {
|
|
54
|
+
qrScanComponent.props.onLeftClick();
|
|
55
|
+
});
|
|
56
|
+
expect(mockedGoBack).toHaveBeenCalled();
|
|
57
|
+
});
|
|
58
|
+
|
|
44
59
|
const scanQRCode = async (data) => {
|
|
45
60
|
const route = { params: {} };
|
|
46
61
|
await act(async () => {
|
|
@@ -4,7 +4,7 @@ import AllCamera from '..';
|
|
|
4
4
|
import { act, create } from 'react-test-renderer';
|
|
5
5
|
import { SCProvider } from '../../../context';
|
|
6
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import Carousel from 'react-native-snap-carousel';
|
|
7
|
+
import Carousel from 'react-native-new-snap-carousel';
|
|
8
8
|
|
|
9
9
|
const arrCameras = [
|
|
10
10
|
{
|
|
@@ -8,9 +8,9 @@ import React, {
|
|
|
8
8
|
import { View, Text, TouchableOpacity, Platform, Image } from 'react-native';
|
|
9
9
|
import { useRoute, useNavigation } from '@react-navigation/native';
|
|
10
10
|
import { chunk } from 'lodash';
|
|
11
|
-
import Carousel from 'react-native-snap-carousel';
|
|
12
|
-
|
|
11
|
+
import Carousel from 'react-native-new-snap-carousel';
|
|
13
12
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
13
|
+
|
|
14
14
|
import { Images, Colors } from '../../configs';
|
|
15
15
|
import { useHiddenStatusBar } from '../../hooks/Common/useStatusBar';
|
|
16
16
|
import { HeaderCustom } from '../../commons/Header';
|