@eohjsc/react-native-smart-city 0.3.71 → 0.3.73
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/index.js +0 -2
- package/package.json +4 -5
- package/src/Images/ThreeButton/buttonCircleBig.png +0 -0
- package/src/Images/ThreeButton/buttonCircleSmall.png +0 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -11
- package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -3
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +1 -0
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +52 -0
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +52 -0
- package/src/commons/ActionGroup/{__test__ → ThreeButtonTemplate/__test__}/ThreeButtonTemplate.test.js +21 -8
- package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonCircle.js +103 -0
- package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonCircleStyles.js +31 -0
- package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonDefault.js +96 -0
- package/src/commons/ActionGroup/{ThreeButtonTemplateStyle.js → ThreeButtonTemplate/components/ThreeButtonDefaultStyles.js} +11 -34
- package/src/commons/ActionGroup/{ThreeButtonTemplate.js → ThreeButtonTemplate/index.js} +48 -51
- package/src/commons/ActionGroup/ThreeButtonTemplate/styles.js +27 -0
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +1 -0
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +39 -34
- package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +19 -10
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +0 -1
- package/src/commons/ActionGroup/__test__/index.test.js +24 -16
- package/src/commons/ActionTemplate/__test__/index.test.js +5 -1
- package/src/commons/AlertAction/__test__/AlertAction.test.js +2 -2
- package/src/commons/Automate/__test__/ItemAutomate.test.js +1 -1
- package/src/commons/Calendar/__test__/Calendar.test.js +3 -5
- package/src/commons/CameraDevice/index.js +37 -22
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -3
- package/src/commons/Dashboard/MyUnit/index.js +1 -1
- package/src/commons/Device/ConnectedViewHeader.js +2 -1
- package/src/commons/Device/DeviceAlertStatus.js +1 -1
- package/src/commons/Device/DisconnectedView.js +10 -14
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
- package/src/commons/Device/HorizontalBarChart.js +1 -1
- package/src/commons/Device/LinearChart/LinearChart.test.js +10 -4
- package/src/commons/Device/LinearChart.js +5 -1
- package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +1 -1
- package/src/commons/Device/SonosSpeaker/index.js +1 -1
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +12 -27
- package/src/commons/Device/WindDirection/Compass/index.js +15 -23
- package/src/commons/Device/WindSpeed/__test__/Anemometer.test.js +4 -4
- package/src/commons/Device/WindSpeed/__test__/ChartInfo.test.js +2 -2
- package/src/commons/Device/__test__/ConnectedViewHeader.test.js +11 -8
- package/src/commons/Device/__test__/DisconnectedView.test.js +8 -45
- package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
- package/src/commons/DisplayChecking/index.js +4 -3
- package/src/commons/DisplayChecking/styles.js +2 -2
- package/src/commons/MediaPlayer/index.js +2 -1
- package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +0 -1
- package/src/commons/MediaPlayerDetail/index.js +2 -3
- package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +2 -1
- package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -1
- package/src/commons/MenuActionList/index.js +8 -70
- package/src/commons/MenuActionList/styles.js +68 -0
- package/src/commons/Modal/__test__/ModalBottom.test.js +1 -10
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +45 -31
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +15 -13
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +12 -9
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +19 -13
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -5
- package/src/commons/PreventAccess/index.js +3 -3
- package/src/commons/Sharing/__test__/MemberList.test.js +17 -6
- package/src/commons/Sharing/__test__/RowMember.test.js +0 -2
- package/src/commons/SubUnit/OneTap/index.js +6 -1
- package/src/commons/Today/__test__/Today.test.js +3 -3
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
- package/src/configs/IOPinConstants.js +285 -0
- package/src/configs/SCConfig.js +3 -0
- package/src/hooks/IoT/useBluetoothConnection.js +2 -1
- package/src/libs/react-native-parallax-scroll-view/index.js +2 -1
- package/src/navigations/AllGatewayStack.js +3 -3
- package/src/navigations/UnitStack.js +0 -6
- package/src/screens/ActivityLog/__test__/index.test.js +16 -22
- package/src/screens/ActivityLog/index.js +2 -3
- package/src/screens/AddLocationMaps/index.js +1 -1
- package/src/screens/AddNewAction/SelectAction.js +3 -0
- package/src/screens/AddNewAction/SetupSensor.js +3 -3
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +12 -0
- package/src/screens/AddNewAction/__test__/SetupSensor.test.js +11 -24
- package/src/screens/AddNewGateway/ConnectingWifiGuide.js +4 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +0 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +0 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +0 -1
- package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +2 -2
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +22 -7
- package/src/screens/AllCamera/__test__/index.test.js +1 -1
- package/src/screens/AllCamera/index.js +1 -1
- package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +82 -0
- package/src/screens/AllGateway/DetailConfigActionInternal/index.js +84 -5
- package/src/screens/AllGateway/DetailConfigActionModbus/index.js +6 -4
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +63 -57
- package/src/screens/AllGateway/DeviceInternalDetail/index.js +32 -32
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +40 -79
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -42
- package/src/screens/AllGateway/DeviceZigbeeDetail/index.js +4 -4
- package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +4 -1
- package/src/screens/AllGateway/GatewayConnectionMethods/index.js +4 -2
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +49 -61
- package/src/screens/AllGateway/GatewayDetail/index.js +2 -1
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +2 -1
- package/src/screens/AllGateway/components/Information/__test__/index.test.js +2 -1
- package/src/screens/AllGateway/components/Information/index.js +4 -2
- 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/hooks/useGateway.js +1 -0
- package/src/screens/AllGateway/test-utils.js +20 -0
- package/src/screens/Device/__test__/detail.test.js +8 -3
- package/src/screens/Device/components/SensorDisplayItem.js +1 -5
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -4
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +32 -4
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -5
- package/src/screens/EmergencyContacts/__test__/hooks.test.js +1 -1
- package/src/screens/GuestInfo/__test__/index.test.js +26 -14
- package/src/screens/GuestInfo/index.js +2 -2
- package/src/screens/HanetCamera/CaptureFaceID.js +1 -1
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +1 -5
- package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +1 -1
- package/src/screens/PlayBackCamera/Timer.js +2 -3
- package/src/screens/PlayBackCamera/__test__/index.test.js +69 -48
- package/src/screens/ScanChipQR/components/QRScan/index.js +8 -8
- package/src/screens/SharedUnit/__test__/ShareUnit.test.js +20 -10
- package/src/screens/SharedUnit/index.js +19 -17
- package/src/screens/Sharing/InfoMemberUnit.js +2 -2
- package/src/screens/SmartAccount/Connecting/index.js +2 -2
- package/src/screens/SmartAccount/ListDevice/__test__/DeviceItem.test.js +4 -2
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +17 -8
- package/src/screens/SmartAccount/ListDevice/index.js +1 -1
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +9 -6
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +1 -0
- package/src/screens/SmartAccount/__test__/Connecting.test.js +2 -1
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +17 -6
- package/src/screens/SubUnit/EditSubUnit.js +6 -6
- package/src/screens/SubUnit/EditSubUnitStyles.js +2 -2
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +5 -6
- package/src/screens/SubUnit/__test__/Detail.test.js +2 -3
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +25 -10
- package/src/screens/Template/EditTemplate.js +13 -3
- package/src/screens/Template/__test__/EditTemplate.test.js +21 -15
- package/src/screens/Unit/Detail.js +157 -121
- package/src/screens/Unit/ManageUnit.js +3 -3
- package/src/screens/Unit/ManageUnitStyles.js +1 -1
- package/src/screens/Unit/SelectAddress.js +1 -1
- package/src/screens/Unit/__test__/Detail.test.js +40 -20
- package/src/screens/Unit/__test__/ManageUnit.test.js +18 -15
- package/src/screens/Unit/components/AutomateScript/index.js +9 -8
- package/src/screens/Unit/components/Header/index.js +1 -14
- package/src/screens/Unit/components/__test__/AutomateScript.test.js +10 -36
- package/src/screens/Unit/components/__test__/Header.test.js +14 -9
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +4 -5
- package/src/utils/I18n/translations/en.json +13 -12
- package/src/utils/I18n/translations/vi.json +12 -11
- package/src/utils/Route/index.js +1 -2
- package/src/utils/Utils.js +62 -2
- package/src/commons/Explore/ActivityIndicator/index.js +0 -49
- package/src/commons/Explore/CityItem/index.js +0 -116
- package/src/commons/Explore/HeaderExplore/index.js +0 -44
- package/src/commons/Explore/HeaderLabel/index.js +0 -46
- package/src/commons/Explore/LocationItem/index.js +0 -71
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +0 -58
- package/src/commons/Explore/SearchBox/index.js +0 -59
- package/src/commons/Explore/__test__/CityItem.test.js +0 -156
- package/src/commons/Explore/__test__/HeaderExplore.test.js +0 -25
- package/src/commons/Explore/__test__/HeaderLabel.test.js +0 -33
- package/src/commons/Explore/__test__/LocationItem.test.js +0 -31
- package/src/screens/Explore/__test__/Explore.test.js +0 -43
- package/src/screens/Explore/index.js +0 -201
- package/src/screens/Unit/MyAllUnit/index.js +0 -44
- package/src/screens/Unit/__test__/MyAllUnit.test.js +0 -87
- package/src/screens/Unit/components/ListMyAllUnit/index.js +0 -162
- package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +0 -117
- package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +0 -36
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -54
- package/src/screens/Unit/components/MyAllUnit/index.js +0 -44
package/index.js
CHANGED
|
@@ -9,7 +9,6 @@ import { UnitStack } from './src/navigations/UnitStack';
|
|
|
9
9
|
import { EmergencyContactsStack } from './src/navigations/EmergencyContactsStack';
|
|
10
10
|
import { AddUnitStack } from './src/navigations/AddUnitStack';
|
|
11
11
|
import SharedStack from './src/navigations/SharedStack';
|
|
12
|
-
import Explore from './src/screens/Explore';
|
|
13
12
|
import { AddLGDeviceStack } from './src/navigations/AddLGDeviceStack';
|
|
14
13
|
import { initSCConfig } from './src/configs';
|
|
15
14
|
import AutomateStack from './src/navigations/AutomateStack';
|
|
@@ -34,7 +33,6 @@ export {
|
|
|
34
33
|
UnitStack,
|
|
35
34
|
AddUnitStack,
|
|
36
35
|
SharedStack,
|
|
37
|
-
Explore,
|
|
38
36
|
SCProvider,
|
|
39
37
|
SCContext,
|
|
40
38
|
AddLGDeviceStack,
|
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.3.
|
|
4
|
+
"version": "0.3.73",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -119,7 +119,6 @@
|
|
|
119
119
|
"@react-native-community/segmented-control": "^2.1.1",
|
|
120
120
|
"@react-native-community/slider": "^3.0.3",
|
|
121
121
|
"@react-native-community/toolbar-android": "^0.1.0-rc.2",
|
|
122
|
-
"@react-native-community/viewpager": "^4.1.4",
|
|
123
122
|
"@react-native-picker/picker": "^1.16.7",
|
|
124
123
|
"@react-navigation/bottom-tabs": "^5.8.0",
|
|
125
124
|
"@react-navigation/drawer": "^5.9.0",
|
|
@@ -129,6 +128,7 @@
|
|
|
129
128
|
"@testing-library/react-hooks": "^6.0.0",
|
|
130
129
|
"apisauce": "^2.1.5",
|
|
131
130
|
"axios": "^0.19.2",
|
|
131
|
+
"deprecated-react-native-prop-types": "^2.3.0",
|
|
132
132
|
"dotenv": "^8.2.0",
|
|
133
133
|
"google-libphonenumber": "^3.2.10",
|
|
134
134
|
"home-assistant-js-websocket": "^5.7.0",
|
|
@@ -153,7 +153,6 @@
|
|
|
153
153
|
"react-native-android-keyboard-adjust": "^1.2.0",
|
|
154
154
|
"react-native-android-location-enabler": "^1.2.2",
|
|
155
155
|
"react-native-android-wifi": "^0.0.41",
|
|
156
|
-
"react-native-animated-ellipsis": "^2.0.0",
|
|
157
156
|
"react-native-appearance": "^0.3.4",
|
|
158
157
|
"react-native-base64": "^0.1.0",
|
|
159
158
|
"react-native-ble-plx": "^2.0.3",
|
|
@@ -174,11 +173,13 @@
|
|
|
174
173
|
"react-native-input-credit-card": "^0.5.5",
|
|
175
174
|
"react-native-iphone-x-helper": "^1.2.1",
|
|
176
175
|
"react-native-linear-gradient": "^2.5.6",
|
|
176
|
+
"react-native-loading-dots": "^1.3.2",
|
|
177
177
|
"react-native-localize": "^1.4.1",
|
|
178
178
|
"react-native-maps": "0.27.1",
|
|
179
179
|
"react-native-maps-directions": "^1.8.0",
|
|
180
180
|
"react-native-modal": "^11.5.6",
|
|
181
181
|
"react-native-modal-datetime-picker": "^8.9.3",
|
|
182
|
+
"react-native-new-snap-carousel": "^3.9.3",
|
|
182
183
|
"react-native-onesignal": "^4.3.1",
|
|
183
184
|
"react-native-pager-view": "^5.4.1",
|
|
184
185
|
"react-native-parallax-scroll-view": "^0.21.3",
|
|
@@ -190,8 +191,6 @@
|
|
|
190
191
|
"react-native-responsive-fontsize": "^0.5.1",
|
|
191
192
|
"react-native-safe-area-context": "^3.1.1",
|
|
192
193
|
"react-native-screens": "^2.9.0",
|
|
193
|
-
"react-native-slider": "^0.11.0",
|
|
194
|
-
"react-native-snap-carousel": "4.0.0-beta.5",
|
|
195
194
|
"react-native-super-grid": "^4.0.3",
|
|
196
195
|
"react-native-svg": "^12.1.0",
|
|
197
196
|
"react-native-toast-message": "^2.1.1",
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo, useCallback, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import Slider from 'react-native-slider';
|
|
3
|
+
import Slider from '@react-native-community/slider';
|
|
4
4
|
import Text from '../../../Text';
|
|
5
5
|
import { HeaderCustom } from '../../../Header';
|
|
6
6
|
import ButtonWrapper from './ButtonWrapper';
|
|
@@ -56,7 +56,7 @@ const OnOffSmartLock = memo(({ actionGroup = {}, doAction, sensor = {} }) => {
|
|
|
56
56
|
}, [config, configValues, configuration, is_on_value]);
|
|
57
57
|
|
|
58
58
|
return (
|
|
59
|
-
|
|
59
|
+
<View style={styles.wrap}>
|
|
60
60
|
<View>
|
|
61
61
|
<TouchableOpacity
|
|
62
62
|
onPress={handleActionSmartLock}
|
|
@@ -78,7 +78,7 @@ const OnOffSmartLock = memo(({ actionGroup = {}, doAction, sensor = {} }) => {
|
|
|
78
78
|
{t(isUnlock ? 'door_is_open' : 'door_is_close')}
|
|
79
79
|
</Text>
|
|
80
80
|
</View>
|
|
81
|
-
|
|
81
|
+
</View>
|
|
82
82
|
);
|
|
83
83
|
});
|
|
84
84
|
|
|
@@ -5,6 +5,7 @@ import SetupGeneratePasscode from '../index';
|
|
|
5
5
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
6
6
|
import { AccessibilityLabel } from '../../../../../configs/Constants';
|
|
7
7
|
import { SCProvider } from '../../../../../context';
|
|
8
|
+
import WheelDateTimePicker from '../../../../WheelDateTimePicker';
|
|
8
9
|
|
|
9
10
|
const mockNavigate = jest.fn();
|
|
10
11
|
jest.mock('@react-navigation/native', () => {
|
|
@@ -66,17 +67,17 @@ describe('Test SetupGeneratePasscode', () => {
|
|
|
66
67
|
expect(changeTime[0]).toBeDefined();
|
|
67
68
|
expect(changeDuration[0]).toBeDefined();
|
|
68
69
|
|
|
69
|
-
await
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
await act(async () => {
|
|
71
|
+
await changeDuration[0].props.onPressSetMinute();
|
|
72
|
+
});
|
|
73
|
+
await act(async () => {
|
|
74
|
+
await changeDuration[0].props.onPressSelectCircle();
|
|
75
|
+
});
|
|
76
|
+
await act(async () => {
|
|
77
|
+
await changeTime[0].props.onPressSetTime();
|
|
78
|
+
});
|
|
72
79
|
|
|
73
|
-
const wheelDateTimePicker = instance.
|
|
74
|
-
|
|
75
|
-
item.props.accessibilityLabel ===
|
|
76
|
-
`${AccessibilityLabel.WHEEL_DATE_TIME_PICKER_BUTTON}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
77
|
-
);
|
|
78
|
-
await wheelDateTimePicker[5].props.onClick();
|
|
79
|
-
await wheelDateTimePicker[11].props.onClick();
|
|
80
|
-
await wheelDateTimePicker[17].props.onClick();
|
|
80
|
+
const wheelDateTimePicker = instance.findAllByType(WheelDateTimePicker);
|
|
81
|
+
expect(wheelDateTimePicker).toHaveLength(3);
|
|
81
82
|
});
|
|
82
83
|
});
|
|
@@ -5,7 +5,7 @@ import styles from './SliderRangeTemplateStyles';
|
|
|
5
5
|
import Text from '../Text';
|
|
6
6
|
import { Colors } from '../../configs';
|
|
7
7
|
import SvgBrightness from '../../../assets/images/brightness.svg';
|
|
8
|
-
import
|
|
8
|
+
import Slider from '@react-native-community/slider';
|
|
9
9
|
import { useConfigGlobalState } from '../../iot/states';
|
|
10
10
|
import { DEVICE_TYPE } from '../../configs/Constants';
|
|
11
11
|
|
|
@@ -75,7 +75,7 @@ const SliderRangeTemplate = memo(({ actionGroup = {}, doAction, sensor }) => {
|
|
|
75
75
|
</Text>
|
|
76
76
|
</View>
|
|
77
77
|
<View style={styles.RightBrightness}>
|
|
78
|
-
<
|
|
78
|
+
<Slider
|
|
79
79
|
style={styles.slider}
|
|
80
80
|
value={valueBrightness}
|
|
81
81
|
onSlidingComplete={onChangeBrightness}
|
|
@@ -89,7 +89,6 @@ const SliderRangeTemplate = memo(({ actionGroup = {}, doAction, sensor }) => {
|
|
|
89
89
|
trackStyle={styles.trackSlider}
|
|
90
90
|
thumbStyle={styles.thumbSlider}
|
|
91
91
|
/>
|
|
92
|
-
|
|
93
92
|
<View style={styles.valuePercent}>
|
|
94
93
|
<Text type="Label" style={styles.textValuePercent}>
|
|
95
94
|
{`${valueBrightness}%`}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer, { act } from 'react-test-renderer';
|
|
3
|
+
import { TouchableOpacity } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { SCProvider } from '../../../../context';
|
|
6
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
|
+
import ThreeButtonCircle from '../components/ThreeButtonCircle';
|
|
8
|
+
|
|
9
|
+
const mockOnButton1Press = jest.fn();
|
|
10
|
+
const mockOnButton2Press = jest.fn();
|
|
11
|
+
const mockOnButton3Press = jest.fn();
|
|
12
|
+
|
|
13
|
+
const wrapComponent = (props) => (
|
|
14
|
+
<SCProvider initState={mockSCStore({})}>
|
|
15
|
+
<ThreeButtonCircle {...props} />
|
|
16
|
+
</SCProvider>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
describe('Test ThreeButtonCircle', () => {
|
|
20
|
+
let props = {
|
|
21
|
+
icon1: 'icon1',
|
|
22
|
+
text1: 'text1',
|
|
23
|
+
icon2: 'icon2',
|
|
24
|
+
text2: 'text2',
|
|
25
|
+
icon3: 'icon3',
|
|
26
|
+
text3: 'text3',
|
|
27
|
+
onButton1Press: mockOnButton1Press,
|
|
28
|
+
onButton2Press: mockOnButton2Press,
|
|
29
|
+
onButton3Press: mockOnButton3Press,
|
|
30
|
+
};
|
|
31
|
+
let wrapper;
|
|
32
|
+
|
|
33
|
+
it('render ThreeButtonCircle', async () => {
|
|
34
|
+
await act(async () => {
|
|
35
|
+
wrapper = renderer.create(wrapComponent(props));
|
|
36
|
+
});
|
|
37
|
+
const instance = wrapper.root;
|
|
38
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
39
|
+
expect(touchableOpacities).toHaveLength(3);
|
|
40
|
+
});
|
|
41
|
+
it('render ThreeButtonCircle onPressButton', async () => {
|
|
42
|
+
await act(async () => {
|
|
43
|
+
wrapper = renderer.create(wrapComponent(props));
|
|
44
|
+
});
|
|
45
|
+
const instance = wrapper.root;
|
|
46
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
47
|
+
await act(async () => {
|
|
48
|
+
touchableOpacities[0].props.onPress();
|
|
49
|
+
});
|
|
50
|
+
expect(mockOnButton1Press).toBeCalled();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer, { act } from 'react-test-renderer';
|
|
3
|
+
import { TouchableOpacity } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { SCProvider } from '../../../../context';
|
|
6
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
|
+
import ThreeButtonDefault from '../components/ThreeButtonDefault';
|
|
8
|
+
|
|
9
|
+
const mockOnButton1Press = jest.fn();
|
|
10
|
+
const mockOnButton2Press = jest.fn();
|
|
11
|
+
const mockOnButton3Press = jest.fn();
|
|
12
|
+
|
|
13
|
+
const wrapComponent = (props) => (
|
|
14
|
+
<SCProvider initState={mockSCStore({})}>
|
|
15
|
+
<ThreeButtonDefault {...props} />
|
|
16
|
+
</SCProvider>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
describe('Test ThreeButtonDefault', () => {
|
|
20
|
+
let props = {
|
|
21
|
+
icon1: 'icon1',
|
|
22
|
+
text1: 'text1',
|
|
23
|
+
icon2: 'icon2',
|
|
24
|
+
text2: 'text2',
|
|
25
|
+
icon3: 'icon3',
|
|
26
|
+
text3: 'text3',
|
|
27
|
+
onButton1Press: mockOnButton1Press,
|
|
28
|
+
onButton2Press: mockOnButton2Press,
|
|
29
|
+
onButton3Press: mockOnButton3Press,
|
|
30
|
+
};
|
|
31
|
+
let wrapper;
|
|
32
|
+
|
|
33
|
+
it('render ThreeButtonDefault', async () => {
|
|
34
|
+
await act(async () => {
|
|
35
|
+
wrapper = renderer.create(wrapComponent(props));
|
|
36
|
+
});
|
|
37
|
+
const instance = wrapper.root;
|
|
38
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
39
|
+
expect(touchableOpacities).toHaveLength(3);
|
|
40
|
+
});
|
|
41
|
+
it('render ThreeButtonDefault onPressButton', async () => {
|
|
42
|
+
await act(async () => {
|
|
43
|
+
wrapper = renderer.create(wrapComponent(props));
|
|
44
|
+
});
|
|
45
|
+
const instance = wrapper.root;
|
|
46
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
47
|
+
await act(async () => {
|
|
48
|
+
touchableOpacities[0].props.onPress();
|
|
49
|
+
});
|
|
50
|
+
expect(mockOnButton1Press).toBeCalled();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import { TouchableOpacity } from 'react-native';
|
|
4
3
|
|
|
5
|
-
import ThreeButtonTemplate from '
|
|
6
|
-
import { SCProvider } from '
|
|
7
|
-
import { mockSCStore } from '
|
|
4
|
+
import ThreeButtonTemplate from '..';
|
|
5
|
+
import { SCProvider } from '../../../../context';
|
|
6
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
|
+
import ThreeButtonDefault from '../components/ThreeButtonDefault';
|
|
8
|
+
import ThreeButtonCircle from '../components/ThreeButtonCircle';
|
|
8
9
|
|
|
9
10
|
const wrapComponent = (actionGroup) => (
|
|
10
11
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -13,7 +14,7 @@ const wrapComponent = (actionGroup) => (
|
|
|
13
14
|
);
|
|
14
15
|
|
|
15
16
|
describe('Test ThreeButtonTemplate', () => {
|
|
16
|
-
|
|
17
|
+
let actionGroup = {
|
|
17
18
|
configuration: {
|
|
18
19
|
action1: '2b949045-8e03-4c07-a855-7794ade2e69c',
|
|
19
20
|
action1_data: {
|
|
@@ -61,12 +62,24 @@ describe('Test ThreeButtonTemplate', () => {
|
|
|
61
62
|
|
|
62
63
|
let wrapper;
|
|
63
64
|
|
|
64
|
-
it('render
|
|
65
|
+
it('render ThreeButtonDefault', async () => {
|
|
65
66
|
await act(async () => {
|
|
66
67
|
wrapper = renderer.create(wrapComponent(actionGroup));
|
|
67
68
|
});
|
|
68
69
|
const instance = wrapper.root;
|
|
69
|
-
const
|
|
70
|
-
expect(
|
|
70
|
+
const ThreeButtonDefaults = instance.findAllByType(ThreeButtonDefault);
|
|
71
|
+
expect(ThreeButtonDefaults).toHaveLength(1);
|
|
72
|
+
});
|
|
73
|
+
it('render ThreeButtonCircle', async () => {
|
|
74
|
+
const actionGroupCT = {
|
|
75
|
+
...actionGroup,
|
|
76
|
+
configuration: { ...actionGroup?.configuration, layout: 'circle' },
|
|
77
|
+
};
|
|
78
|
+
await act(async () => {
|
|
79
|
+
wrapper = renderer.create(wrapComponent(actionGroupCT));
|
|
80
|
+
});
|
|
81
|
+
const instance = wrapper.root;
|
|
82
|
+
const ThreeButtonCircles = instance.findAllByType(ThreeButtonCircle);
|
|
83
|
+
expect(ThreeButtonCircles).toHaveLength(1);
|
|
71
84
|
});
|
|
72
85
|
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import styles from './ThreeButtonCircleStyles';
|
|
4
|
+
import Text from '../../../Text';
|
|
5
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
6
|
+
import IconComponent from '../../../IconComponent';
|
|
7
|
+
import buttonCircleSmall from '../../../../Images/ThreeButton/buttonCircleSmall.png';
|
|
8
|
+
import buttonCircleBig from '../../../../Images/ThreeButton/buttonCircleBig.png';
|
|
9
|
+
import FImage from '../../../FImage';
|
|
10
|
+
|
|
11
|
+
const ThreeButtonCircle = memo(
|
|
12
|
+
({
|
|
13
|
+
icon1,
|
|
14
|
+
text1,
|
|
15
|
+
icon2,
|
|
16
|
+
text2,
|
|
17
|
+
icon3,
|
|
18
|
+
text3,
|
|
19
|
+
onButton1Press,
|
|
20
|
+
onButton2Press,
|
|
21
|
+
onButton3Press,
|
|
22
|
+
}) => {
|
|
23
|
+
const listButton = useMemo(() => {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
id: 1,
|
|
27
|
+
button: {
|
|
28
|
+
accessibilityLabel: AccessibilityLabel.BUTTON_CIRCLE_TEMPLATE_1,
|
|
29
|
+
onPress: onButton1Press,
|
|
30
|
+
},
|
|
31
|
+
fimage: {
|
|
32
|
+
source: buttonCircleSmall,
|
|
33
|
+
style: styles.iconSmall,
|
|
34
|
+
text: text1,
|
|
35
|
+
icon: icon1,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 2,
|
|
40
|
+
button: {
|
|
41
|
+
accessibilityLabel: AccessibilityLabel.BUTTON_CIRCLE_TEMPLATE_2,
|
|
42
|
+
onPress: onButton2Press,
|
|
43
|
+
},
|
|
44
|
+
fimage: {
|
|
45
|
+
source: buttonCircleBig,
|
|
46
|
+
style: styles.iconBig,
|
|
47
|
+
text: text2,
|
|
48
|
+
icon: icon2,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 3,
|
|
53
|
+
button: {
|
|
54
|
+
accessibilityLabel: AccessibilityLabel.BUTTON_CIRCLE_TEMPLATE_3,
|
|
55
|
+
onPress: onButton3Press,
|
|
56
|
+
},
|
|
57
|
+
fimage: {
|
|
58
|
+
source: buttonCircleSmall,
|
|
59
|
+
style: styles.iconSmall,
|
|
60
|
+
text: text3,
|
|
61
|
+
icon: icon3,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}, [
|
|
66
|
+
icon1,
|
|
67
|
+
icon2,
|
|
68
|
+
icon3,
|
|
69
|
+
onButton1Press,
|
|
70
|
+
onButton2Press,
|
|
71
|
+
onButton3Press,
|
|
72
|
+
text1,
|
|
73
|
+
text2,
|
|
74
|
+
text3,
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<View style={styles.threeButtonCircle}>
|
|
79
|
+
{listButton.map((item, index) => {
|
|
80
|
+
return (
|
|
81
|
+
<TouchableOpacity
|
|
82
|
+
accessibilityLabel={item?.button?.accessibilityLabel}
|
|
83
|
+
onPress={item?.button?.onPress}
|
|
84
|
+
key={item?.id || index}
|
|
85
|
+
>
|
|
86
|
+
<View style={styles.buttonAction}>
|
|
87
|
+
<FImage
|
|
88
|
+
source={item?.fimage.source}
|
|
89
|
+
style={[styles.center, item?.fimage?.style]}
|
|
90
|
+
>
|
|
91
|
+
<IconComponent icon={item?.fimage?.icon} />
|
|
92
|
+
<Text style={styles.text}>{item?.fimage?.text}</Text>
|
|
93
|
+
</FImage>
|
|
94
|
+
</View>
|
|
95
|
+
</TouchableOpacity>
|
|
96
|
+
);
|
|
97
|
+
})}
|
|
98
|
+
</View>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
export default ThreeButtonCircle;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export default StyleSheet.create({
|
|
4
|
+
threeButtonCircle: {
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'space-around',
|
|
8
|
+
},
|
|
9
|
+
iconSmall: {
|
|
10
|
+
height: 102,
|
|
11
|
+
width: 102,
|
|
12
|
+
marginBottom: 12,
|
|
13
|
+
},
|
|
14
|
+
iconBig: {
|
|
15
|
+
height: 170,
|
|
16
|
+
width: 170,
|
|
17
|
+
paddingBottom: 10,
|
|
18
|
+
},
|
|
19
|
+
center: {
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
},
|
|
23
|
+
buttonAction: {
|
|
24
|
+
flex: 1,
|
|
25
|
+
aspectRatio: 1,
|
|
26
|
+
marginHorizontal: 4,
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
resizeMode: 'contain',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import styles from './ThreeButtonDefaultStyles';
|
|
4
|
+
import Text from '../../../Text';
|
|
5
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
6
|
+
import IconComponent from '../../../IconComponent';
|
|
7
|
+
|
|
8
|
+
const ThreeButtonDefault = memo(
|
|
9
|
+
({
|
|
10
|
+
icon1,
|
|
11
|
+
text1,
|
|
12
|
+
icon2,
|
|
13
|
+
text2,
|
|
14
|
+
icon3,
|
|
15
|
+
text3,
|
|
16
|
+
onButton1Press,
|
|
17
|
+
onButton2Press,
|
|
18
|
+
onButton3Press,
|
|
19
|
+
}) => {
|
|
20
|
+
const Icon2CT = () => {
|
|
21
|
+
return icon2 === 'stop' ? (
|
|
22
|
+
<View style={styles.squareStop} />
|
|
23
|
+
) : (
|
|
24
|
+
<IconComponent icon={icon2} iconSize={30} />
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const listButton = useMemo(() => {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
id: 1,
|
|
32
|
+
button: {
|
|
33
|
+
accessibilityLabel: AccessibilityLabel.BUTTON_TEMPLATE_1,
|
|
34
|
+
onPress: onButton1Press,
|
|
35
|
+
},
|
|
36
|
+
icon: icon1,
|
|
37
|
+
text: text1,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 2,
|
|
41
|
+
button: {
|
|
42
|
+
accessibilityLabel: AccessibilityLabel.BUTTON_TEMPLATE_2,
|
|
43
|
+
onPress: onButton2Press,
|
|
44
|
+
},
|
|
45
|
+
icon: icon2,
|
|
46
|
+
text: text2,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 3,
|
|
50
|
+
button: {
|
|
51
|
+
accessibilityLabel: AccessibilityLabel.BUTTON_TEMPLATE_3,
|
|
52
|
+
onPress: onButton3Press,
|
|
53
|
+
},
|
|
54
|
+
icon: icon3,
|
|
55
|
+
text: text3,
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}, [
|
|
59
|
+
icon1,
|
|
60
|
+
icon2,
|
|
61
|
+
icon3,
|
|
62
|
+
onButton1Press,
|
|
63
|
+
onButton2Press,
|
|
64
|
+
onButton3Press,
|
|
65
|
+
text1,
|
|
66
|
+
text2,
|
|
67
|
+
text3,
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<View style={styles.threeButtonDefault}>
|
|
72
|
+
{listButton.map((item, index) => {
|
|
73
|
+
return (
|
|
74
|
+
<TouchableOpacity
|
|
75
|
+
accessibilityLabel={item?.button?.accessibilityLabel}
|
|
76
|
+
style={styles.buttonAction}
|
|
77
|
+
onPress={item?.button?.onPress}
|
|
78
|
+
key={item?.id || index}
|
|
79
|
+
>
|
|
80
|
+
<View style={styles.imageButton}>
|
|
81
|
+
{item?.id === 2 ? (
|
|
82
|
+
<Icon2CT />
|
|
83
|
+
) : (
|
|
84
|
+
<IconComponent icon={item?.icon} iconSize={30} />
|
|
85
|
+
)}
|
|
86
|
+
</View>
|
|
87
|
+
<Text style={styles.text}>{item?.text}</Text>
|
|
88
|
+
</TouchableOpacity>
|
|
89
|
+
);
|
|
90
|
+
})}
|
|
91
|
+
</View>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
export default ThreeButtonDefault;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { Colors } from '
|
|
2
|
+
import { Colors } from '../../../../configs';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
|
-
|
|
6
|
-
flex: 1,
|
|
7
|
-
marginBottom: 16,
|
|
8
|
-
},
|
|
9
|
-
threeButton: {
|
|
5
|
+
threeButtonDefault: {
|
|
10
6
|
flexDirection: 'row',
|
|
11
7
|
justifyContent: 'space-around',
|
|
12
8
|
padding: 16,
|
|
@@ -15,15 +11,7 @@ export default StyleSheet.create({
|
|
|
15
11
|
borderColor: Colors.Gray4,
|
|
16
12
|
borderRadius: 10,
|
|
17
13
|
},
|
|
18
|
-
|
|
19
|
-
height: 32,
|
|
20
|
-
marginBottom: 7,
|
|
21
|
-
},
|
|
22
|
-
text: {
|
|
23
|
-
fontSize: 14,
|
|
24
|
-
lineHeight: 22,
|
|
25
|
-
},
|
|
26
|
-
buttonActionDoor: {
|
|
14
|
+
buttonAction: {
|
|
27
15
|
flex: 1,
|
|
28
16
|
aspectRatio: 1,
|
|
29
17
|
marginHorizontal: 4,
|
|
@@ -34,6 +22,14 @@ export default StyleSheet.create({
|
|
|
34
22
|
borderColor: Colors.Gray3,
|
|
35
23
|
borderRadius: 10,
|
|
36
24
|
},
|
|
25
|
+
imageButton: {
|
|
26
|
+
height: 32,
|
|
27
|
+
marginBottom: 7,
|
|
28
|
+
},
|
|
29
|
+
text: {
|
|
30
|
+
fontSize: 14,
|
|
31
|
+
lineHeight: 22,
|
|
32
|
+
},
|
|
37
33
|
squareStop: {
|
|
38
34
|
marginHorizontal: 8,
|
|
39
35
|
marginVertical: 8,
|
|
@@ -44,23 +40,4 @@ export default StyleSheet.create({
|
|
|
44
40
|
backgroundColor: Colors.Primary,
|
|
45
41
|
borderRadius: 1,
|
|
46
42
|
},
|
|
47
|
-
lockSwitch: {
|
|
48
|
-
flexDirection: 'row',
|
|
49
|
-
justifyContent: 'space-between',
|
|
50
|
-
marginBottom: 7,
|
|
51
|
-
},
|
|
52
|
-
iconLock: {
|
|
53
|
-
paddingBottom: 7,
|
|
54
|
-
},
|
|
55
|
-
textLockDoor: {
|
|
56
|
-
paddingLeft: 12,
|
|
57
|
-
height: 24,
|
|
58
|
-
fontSize: 16,
|
|
59
|
-
lineHeight: 24,
|
|
60
|
-
},
|
|
61
|
-
lockDoor: {
|
|
62
|
-
flexDirection: 'row',
|
|
63
|
-
alignItems: 'flex-end',
|
|
64
|
-
paddingLeft: 5,
|
|
65
|
-
},
|
|
66
43
|
});
|