@eohjsc/react-native-smart-city 0.3.90 → 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__/NumberUpDownTemplate.test.js +1 -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 +5 -5
- package/src/commons/ActionTemplate/CurtainActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffButtonAction.js +4 -4
- package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffSimpleAction.js +4 -4
- package/src/commons/ActionTemplate/OnOffSimpleActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OnOffSmartLockAction.js +4 -4
- package/src/commons/ActionTemplate/OnOffSmartLockActionStyles.js +1 -1
- package/src/commons/ActionTemplate/OneButtonAction.js +3 -3
- package/src/commons/ActionTemplate/OneButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/ThreeButtonAction.js +5 -5
- package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +1 -1
- package/src/commons/ActionTemplate/__test__/CurtainAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffSimpleAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OnOffSmartLockAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/index.test.js +21 -70
- package/src/commons/ActionTemplate/index.js +19 -55
- package/src/commons/Alert/__test__/Alert.test.js +1 -1
- package/src/commons/Auth/AccountList.js +1 -1
- package/src/commons/Auth/__test__/OtpInputList.test.js +17 -19
- package/src/commons/Automate/ItemAutomate.js +10 -4
- package/src/commons/Automate/__test__/ItemAutomate.test.js +11 -11
- package/src/commons/BackDefault/__test__/BackDefault.test.js +1 -1
- package/src/commons/Button/__test__/Button.test.js +1 -1
- package/src/commons/ButtonPopup/__test__/ButtonPopup.test.js +1 -1
- package/src/commons/Calendar/__test__/Calendar.test.js +1 -1
- package/src/commons/ChartLoading/__test__/ChartLoading.test.js +1 -1
- package/src/commons/CircleButton/__test__/CircleButton.test.js +1 -1
- package/src/commons/CircleView/__test__/CircleView.test.js +1 -1
- package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -2
- package/src/commons/DateTimeRangeChange/index.js +31 -48
- package/src/commons/Device/DeviceAlertStatus.js +2 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +2 -2
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +1 -1
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +2 -2
- package/src/commons/Device/HistoryChart.js +6 -49
- package/src/commons/Device/LinearChart/LinearChart.test.js +1 -1
- package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +1 -1
- package/src/commons/Device/ProgressBar/index.js +5 -11
- package/src/commons/Device/ProgressBar/styles.js +11 -3
- package/src/commons/Device/RainningSensor/__test__/CurrentRainSensor.test.js +5 -5
- package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +3 -3
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +2 -2
- 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 +5 -3
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +3 -3
- package/src/commons/Device/__test__/DisconnectedView.test.js +2 -2
- package/src/commons/Device/__test__/FlatListItems.test.js +1 -1
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +1 -1
- package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
- 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__/CurrencyInput.test.js +2 -2
- package/src/commons/Form/__test__/TextInput.test.js +3 -3
- package/src/commons/Form/__test__/TextInputPassword.test.js +2 -2
- package/src/commons/FullLoading/__test__/index.test.js +2 -2
- 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/ImageButton/__test__/ImageButton.test.js +1 -1
- 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 +3 -3
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +5 -5
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +5 -5
- package/src/commons/OneTapTemplate/StatesGridActionTemplateStyles.js +1 -1
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +2 -2
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +1 -1
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +2 -2
- package/src/commons/PreventAccess/index.js +1 -1
- package/src/commons/RowItem/__test__/RowItem.test.js +1 -1
- package/src/commons/RowUser/__test__/RowUser.test.js +1 -1
- package/src/commons/Section/Section.test.js +2 -2
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -1
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +3 -3
- package/src/commons/Sharing/StationDevicePermissions.js +4 -4
- package/src/commons/Sharing/WrapHeaderScrollable.js +5 -5
- package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +1 -1
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +3 -3
- package/src/commons/Sharing/__test__/MemberList.test.js +6 -4
- package/src/commons/Sharing/__test__/RowMember.test.js +2 -2
- package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +4 -2
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +7 -11
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +13 -16
- package/src/commons/SubUnit/OneTap/index.js +22 -7
- package/src/commons/TextButton/__test__/TextButton.test.js +2 -2
- package/src/commons/Today/__test__/Today.test.js +1 -1
- package/src/commons/TouchableScale/__test__/TouchableScale.test.js +1 -1
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +4 -0
- package/src/commons/UnitSummary/AirQuality/index.js +2 -2
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +0 -6
- package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +1 -1
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +1 -1
- package/src/commons/ViewButtonBottom/__test__/ViewButtonBottom.test.js +1 -1
- package/src/configs/API.js +14 -31
- package/src/configs/AccessibilityLabel.js +1 -0
- package/src/configs/Colors.js +1 -1
- package/src/configs/Constants.js +14 -48
- package/src/context/reducer.ts +3 -1
- package/src/hoc/__test__/withRemoteControl.test.js +1 -1
- 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 +51 -17
- package/src/screens/ActivityLog/FilterPopup.js +4 -4
- package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +2 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +3 -3
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +5 -5
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +9 -33
- package/src/screens/AddNewAutoSmart/index.js +33 -89
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +1 -1
- package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +1 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +5 -17
- package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +1 -1
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +2 -2
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +3 -3
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +2 -2
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +8 -16
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +10 -12
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -14
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -14
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +1 -1
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +3 -2
- package/src/screens/AddNewGateway/index.js +1 -1
- package/src/screens/AllCamera/__test__/index.test.js +18 -57
- package/src/screens/AllCamera/index.js +100 -33
- 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/Automate/AddNewAction/ChooseAction.js +139 -0
- package/src/screens/Automate/AddNewAction/ChooseConfig.js +179 -0
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Components/LoadingSelectAction.js +1 -1
- package/src/screens/Automate/AddNewAction/Components/SelectDevices.js +75 -0
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/DeviceStyles.js +5 -1
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/__test__/index.test.js +4 -4
- package/src/screens/{AddNewAction → Automate/AddNewAction}/Device/index.js +5 -4
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +56 -0
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +69 -0
- package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +110 -0
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +196 -0
- 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 +5 -3
- package/src/screens/{AddNewAction/__test__/SelectAction.test.js → Automate/AddNewAction/__test__/ChooseAction.test.js} +101 -122
- package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +210 -0
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +130 -0
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +92 -0
- package/src/screens/Automate/AddNewAction/__test__/SetupSensor.test.js +131 -0
- 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 +20 -12
- package/src/screens/{EditActionsList → Automate/EditActionsList}/index.js +18 -19
- package/src/screens/Automate/MultiUnits.js +70 -68
- 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 +67 -76
- 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/Automate/ScriptDetail/utils.js +113 -0
- 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 +78 -122
- package/src/screens/Automate/__test__/index.test.js +21 -47
- package/src/screens/Automate/constants.js +0 -0
- package/src/screens/Automate/index.js +18 -24
- 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__/DetailHistoryChart.test.js +2 -2
- package/src/screens/Device/__test__/EmergencyCountdown.test.js +4 -2
- package/src/screens/Device/__test__/detail.test.js +202 -257
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +14 -10
- package/src/screens/Device/components/ChartWrapper.js +3 -3
- package/src/screens/Device/components/SensorDisplayItem.js +2 -1
- package/src/screens/Device/components/VisualChart.js +56 -9
- package/src/screens/Device/components/__test__/VisualChart.test.js +1 -1
- 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 +28 -2
- package/src/screens/Device/styles.js +7 -0
- package/src/screens/DeviceInfo/__test__/index.test.js +16 -18
- package/src/screens/DeviceInfo/index.js +6 -5
- 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 +64 -73
- package/src/screens/Notification/index.js +14 -14
- package/src/screens/PlayBackCamera/index.js +2 -3
- package/src/screens/SelectUnit/__test__/index.test.js +0 -5
- package/src/screens/SelectUnit/index.js +1 -2
- package/src/screens/SharedUnit/index.js +5 -4
- package/src/screens/Sharing/Components/TitleCheckBox.js +2 -2
- 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/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +3 -3
- package/src/screens/SmartAccount/__test__/Connecting.test.js +1 -1
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +3 -3
- package/src/screens/SmartAccount/index.js +1 -0
- package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +1 -1
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +5 -5
- package/src/screens/SmartIr/__test__/SelectBrand.test.js +2 -2
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +2 -2
- package/src/screens/SmartIr/__test__/SmartIr.test.js +2 -2
- 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 +24 -22
- 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 +10 -14
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +1 -1
- package/src/screens/Unit/__test__/SmartAccount.test.js +8 -14
- package/src/screens/Unit/components/__test__/Header.test.js +4 -4
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +14 -6
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/Temperature/index.js +2 -2
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +4 -0
- package/src/screens/UnitSummary/components/UvIndex/index.js +2 -2
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +6 -11
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +1 -1
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +1 -1
- package/src/screens/UnitSummary/components/__test__/index.test.js +2 -2
- package/src/screens/WaterQualityGuide/index.js +10 -5
- package/src/utils/Apis/axios.js +3 -0
- package/src/utils/I18n/translations/en.json +24 -18
- package/src/utils/I18n/translations/vi.json +22 -18
- package/src/utils/Route/index.js +9 -3
- 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 -44
- 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/AddNewAction/SelectAction.js +0 -570
- package/src/screens/AddNewAction/SelectSensorDevices.js +0 -236
- package/src/screens/AddNewAction/SetupSensor.js +0 -263
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +0 -181
- package/src/screens/AddNewAction/__test__/SetupSensor.test.js +0 -114
- package/src/screens/AddNewOneTap/index.js +0 -147
- package/src/screens/ScriptDetail/hooks/index.js +0 -136
- package/src/screens/ScriptDetail/index.js +0 -525
- 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
|
@@ -7,20 +7,17 @@ import { mockSCStore } from '../../../context/mockStore';
|
|
|
7
7
|
import Text from '../../Text';
|
|
8
8
|
import ItemAutomate from '../ItemAutomate';
|
|
9
9
|
|
|
10
|
-
const wrapComponent = (
|
|
10
|
+
const wrapComponent = (props) => (
|
|
11
11
|
<SCProvider initState={mockSCStore({})}>
|
|
12
|
-
<ItemAutomate {...
|
|
12
|
+
<ItemAutomate {...props} />
|
|
13
13
|
</SCProvider>
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
describe('Test ItemAutomate', () => {
|
|
17
17
|
let tree;
|
|
18
|
-
let defaultProps = {
|
|
19
|
-
type: 'one_tap',
|
|
20
|
-
};
|
|
21
18
|
it('Test render', async () => {
|
|
22
19
|
await act(async () => {
|
|
23
|
-
tree = await create(wrapComponent(
|
|
20
|
+
tree = await create(wrapComponent({ automate: { type: 'one_tap' } }));
|
|
24
21
|
});
|
|
25
22
|
const instance = tree.root;
|
|
26
23
|
const texts = instance.findAllByType(Text);
|
|
@@ -29,12 +26,15 @@ describe('Test ItemAutomate', () => {
|
|
|
29
26
|
|
|
30
27
|
it('Test render TouchableOpacity', async () => {
|
|
31
28
|
const mockOnPress = jest.fn();
|
|
32
|
-
defaultProps = {
|
|
33
|
-
type: 'one_tap',
|
|
34
|
-
onPress: mockOnPress,
|
|
35
|
-
};
|
|
36
29
|
await act(async () => {
|
|
37
|
-
tree = await create(
|
|
30
|
+
tree = await create(
|
|
31
|
+
wrapComponent({
|
|
32
|
+
automate: {
|
|
33
|
+
type: 'one_tap',
|
|
34
|
+
},
|
|
35
|
+
onPress: mockOnPress,
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
38
|
});
|
|
39
39
|
const instance = tree.root;
|
|
40
40
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
@@ -10,7 +10,7 @@ describe('Test BackDefault', () => {
|
|
|
10
10
|
let color = { color: 'fff' };
|
|
11
11
|
let fixedHeight = { Height: 50 };
|
|
12
12
|
await act(async () => {
|
|
13
|
-
tree = renderer.create(
|
|
13
|
+
tree = await renderer.create(
|
|
14
14
|
<BackDefault goBack={goBack} color={color} fixedHeight={fixedHeight} />
|
|
15
15
|
);
|
|
16
16
|
});
|
|
@@ -22,7 +22,7 @@ describe('Test Calendar component', () => {
|
|
|
22
22
|
|
|
23
23
|
it('create Calendar', async () => {
|
|
24
24
|
await act(async () => {
|
|
25
|
-
tree = renderer.create(wrapComponent({ isVisible: true }));
|
|
25
|
+
tree = await renderer.create(wrapComponent({ isVisible: true }));
|
|
26
26
|
});
|
|
27
27
|
const instance = tree.root;
|
|
28
28
|
const calendar = instance.findAllByType(Calendar);
|
|
@@ -16,7 +16,7 @@ describe('Test chart loading', () => {
|
|
|
16
16
|
|
|
17
17
|
it('create chart message null', async () => {
|
|
18
18
|
await act(async () => {
|
|
19
|
-
tree = renderer.create(wrapComponent());
|
|
19
|
+
tree = await renderer.create(wrapComponent());
|
|
20
20
|
});
|
|
21
21
|
const instance = tree.root;
|
|
22
22
|
const textInputs = instance.findAllByType(Text);
|
|
@@ -7,7 +7,7 @@ describe('Test circle button', () => {
|
|
|
7
7
|
let tree;
|
|
8
8
|
it('create circle button', async () => {
|
|
9
9
|
await act(async () => {
|
|
10
|
-
tree = renderer.create(<CircleButton size={5} />);
|
|
10
|
+
tree = await renderer.create(<CircleButton size={5} />);
|
|
11
11
|
});
|
|
12
12
|
const instance = tree.root;
|
|
13
13
|
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
@@ -7,7 +7,7 @@ describe('Test circle view', () => {
|
|
|
7
7
|
let tree;
|
|
8
8
|
it('create circle view', async () => {
|
|
9
9
|
await act(async () => {
|
|
10
|
-
tree = renderer.create(<CircleView size={5} />);
|
|
10
|
+
tree = await renderer.create(<CircleView size={5} />);
|
|
11
11
|
});
|
|
12
12
|
const instance = tree.root;
|
|
13
13
|
const Views = instance.findAllByType(View);
|
|
@@ -10,7 +10,7 @@ describe('Test DateTimeButton', () => {
|
|
|
10
10
|
|
|
11
11
|
it('render DateTimeButton formatType = "date"', async () => {
|
|
12
12
|
await act(async () => {
|
|
13
|
-
tree = renderer.create(
|
|
13
|
+
tree = await renderer.create(
|
|
14
14
|
<DateTimeButton onPress={() => {}} time={time} formatType="date" />
|
|
15
15
|
);
|
|
16
16
|
});
|
|
@@ -21,7 +21,9 @@ describe('Test DateTimeButton', () => {
|
|
|
21
21
|
|
|
22
22
|
it('render DateTimeButton formatType is undefined', async () => {
|
|
23
23
|
await act(async () => {
|
|
24
|
-
tree = renderer.create(
|
|
24
|
+
tree = await renderer.create(
|
|
25
|
+
<DateTimeButton onPress={() => {}} time={time} />
|
|
26
|
+
);
|
|
25
27
|
});
|
|
26
28
|
const instance = tree.root;
|
|
27
29
|
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React, { memo, useCallback, useState } from 'react';
|
|
2
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
1
|
+
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
3
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import moment from 'moment/moment';
|
|
4
|
+
import DateTimePickerModal from 'react-native-modal-datetime-picker';
|
|
4
5
|
|
|
5
|
-
import { Colors } from '../../configs';
|
|
6
6
|
import Text from '../Text';
|
|
7
|
+
import { Colors } from '../../configs';
|
|
7
8
|
import DateTimeButton from './DateTimeButton';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
9
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
10
|
+
import { DATE_TIME_FORMAT } from '../../configs/Constants';
|
|
10
11
|
|
|
11
12
|
const DateTimeRangeChange = memo(
|
|
12
13
|
({
|
|
@@ -18,11 +19,12 @@ const DateTimeRangeChange = memo(
|
|
|
18
19
|
selectEnd,
|
|
19
20
|
inline = true,
|
|
20
21
|
}) => {
|
|
21
|
-
const format = showTime ?
|
|
22
|
+
const format = showTime ? DATE_TIME_FORMAT.DMY_HM : DATE_TIME_FORMAT.DMY;
|
|
22
23
|
const mode = showTime ? 'datetime' : 'date';
|
|
23
24
|
const t = useTranslations();
|
|
24
|
-
|
|
25
|
-
const
|
|
25
|
+
|
|
26
|
+
const [startDate, setStartDate] = useState(moment(startTime));
|
|
27
|
+
const [endDate, setEndDate] = useState(moment(endTime));
|
|
26
28
|
|
|
27
29
|
const [eventPicker, setEventPicker] = useState({
|
|
28
30
|
showModalEnd: false,
|
|
@@ -30,34 +32,18 @@ const DateTimeRangeChange = memo(
|
|
|
30
32
|
});
|
|
31
33
|
|
|
32
34
|
const onStart = useCallback(() => {
|
|
33
|
-
setEventPicker(
|
|
34
|
-
...state,
|
|
35
|
-
showModalStart: true,
|
|
36
|
-
showModalEnd: false,
|
|
37
|
-
}));
|
|
35
|
+
setEventPicker({ showModalStart: true });
|
|
38
36
|
}, []);
|
|
37
|
+
|
|
39
38
|
const onEnd = useCallback(() => {
|
|
40
|
-
setEventPicker(
|
|
41
|
-
...state,
|
|
42
|
-
showModalStart: false,
|
|
43
|
-
showModalEnd: true,
|
|
44
|
-
}));
|
|
39
|
+
setEventPicker({ showModalEnd: true });
|
|
45
40
|
}, []);
|
|
41
|
+
|
|
46
42
|
const onConfirmStart = useCallback(
|
|
47
43
|
(date) => {
|
|
48
44
|
const selectedDate = date ? moment(date) : moment().valueOf();
|
|
49
|
-
setEventPicker((state) => {
|
|
50
|
-
if (typeof date === 'number') {
|
|
51
|
-
onCancel();
|
|
52
|
-
return state;
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
...state,
|
|
56
|
-
showModalStart: false,
|
|
57
|
-
showModalEnd: true,
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
45
|
selectStart(selectedDate);
|
|
46
|
+
onCancel();
|
|
61
47
|
},
|
|
62
48
|
[onCancel, selectStart]
|
|
63
49
|
);
|
|
@@ -65,30 +51,27 @@ const DateTimeRangeChange = memo(
|
|
|
65
51
|
const onConfirmEnd = useCallback(
|
|
66
52
|
(date) => {
|
|
67
53
|
const selectedDate = date ? moment(date) : moment().valueOf();
|
|
68
|
-
setEventPicker((state) => {
|
|
69
|
-
if (typeof date === 'number') {
|
|
70
|
-
onCancel();
|
|
71
|
-
return state;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
...state,
|
|
76
|
-
showModalEnd: false,
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
54
|
selectEnd(selectedDate);
|
|
55
|
+
onCancel();
|
|
80
56
|
},
|
|
81
57
|
[onCancel, selectEnd]
|
|
82
58
|
);
|
|
83
59
|
|
|
84
60
|
const onCancel = useCallback(() => {
|
|
85
|
-
setEventPicker(
|
|
86
|
-
...state,
|
|
61
|
+
setEventPicker({
|
|
87
62
|
showModalEnd: false,
|
|
88
63
|
showModalStart: false,
|
|
89
|
-
})
|
|
64
|
+
});
|
|
90
65
|
}, []);
|
|
91
66
|
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
setStartDate(moment(startTime));
|
|
69
|
+
}, [startTime]);
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
setEndDate(moment(endTime));
|
|
73
|
+
}, [endTime]);
|
|
74
|
+
|
|
92
75
|
return (
|
|
93
76
|
<View
|
|
94
77
|
style={[styles.dateTimeView, !inline && styles.spaceBetween, style]}
|
|
@@ -99,7 +82,7 @@ const DateTimeRangeChange = memo(
|
|
|
99
82
|
</Text>
|
|
100
83
|
<DateTimeButton onPress={onStart} style={!inline && styles.button}>
|
|
101
84
|
<Text type={'Label'} color={Colors.Gray8} style={styles.txtTime}>
|
|
102
|
-
{
|
|
85
|
+
{startDate.format(format)}
|
|
103
86
|
</Text>
|
|
104
87
|
</DateTimeButton>
|
|
105
88
|
</View>
|
|
@@ -109,13 +92,13 @@ const DateTimeRangeChange = memo(
|
|
|
109
92
|
</Text>
|
|
110
93
|
<DateTimeButton onPress={onEnd} style={!inline && styles.button}>
|
|
111
94
|
<Text type={'Label'} color={Colors.Gray8} style={styles.txtTime}>
|
|
112
|
-
{
|
|
95
|
+
{endDate.format(format)}
|
|
113
96
|
</Text>
|
|
114
97
|
</DateTimeButton>
|
|
115
98
|
</View>
|
|
116
99
|
<DateTimePickerModal
|
|
117
100
|
isVisible={eventPicker.showModalStart}
|
|
118
|
-
date={
|
|
101
|
+
date={startDate.valueOf()}
|
|
119
102
|
mode={mode}
|
|
120
103
|
onConfirm={onConfirmStart}
|
|
121
104
|
onCancel={onCancel}
|
|
@@ -128,7 +111,7 @@ const DateTimeRangeChange = memo(
|
|
|
128
111
|
/>
|
|
129
112
|
<DateTimePickerModal
|
|
130
113
|
isVisible={eventPicker.showModalEnd}
|
|
131
|
-
date={
|
|
114
|
+
date={endDate.valueOf()}
|
|
132
115
|
mode={mode}
|
|
133
116
|
onConfirm={onConfirmEnd}
|
|
134
117
|
onCancel={onCancel}
|
|
@@ -138,7 +121,7 @@ const DateTimeRangeChange = memo(
|
|
|
138
121
|
cancelTextIOS={t('cancel')}
|
|
139
122
|
confirmTextIOS={t('confirm')}
|
|
140
123
|
maximumDate={new Date()}
|
|
141
|
-
minimumDate={
|
|
124
|
+
minimumDate={startDate.valueOf()}
|
|
142
125
|
/>
|
|
143
126
|
</View>
|
|
144
127
|
);
|
|
@@ -72,8 +72,9 @@ const DeviceAlertStatus = memo(
|
|
|
72
72
|
return (
|
|
73
73
|
<View style={[style, stylesOffset.moveDownOffset]}>
|
|
74
74
|
{listStatus &&
|
|
75
|
-
listStatus.map((status) => (
|
|
75
|
+
listStatus.map((status, index) => (
|
|
76
76
|
<AlertStatusMachine
|
|
77
|
+
key={index}
|
|
77
78
|
accessibilityLabel={AccessibilityLabel.ALERT_STATUS_MACHINE}
|
|
78
79
|
message={
|
|
79
80
|
(status.standard && t(status.standard)) ||
|
|
@@ -18,7 +18,7 @@ describe('Test EmergencyButton', () => {
|
|
|
18
18
|
let tree;
|
|
19
19
|
it('create EmergencyButton', async () => {
|
|
20
20
|
await act(async () => {
|
|
21
|
-
tree = renderer.create(wrapComponent());
|
|
21
|
+
tree = await renderer.create(wrapComponent());
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const instance = tree.root;
|
|
@@ -29,7 +29,7 @@ describe('Test EmergencyButton', () => {
|
|
|
29
29
|
it('long press EmergencyButton', async () => {
|
|
30
30
|
const mockFunction = jest.fn();
|
|
31
31
|
await act(async () => {
|
|
32
|
-
tree = renderer.create(wrapComponent(mockFunction));
|
|
32
|
+
tree = await renderer.create(wrapComponent(mockFunction));
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
const instance = tree.root;
|
|
@@ -39,7 +39,7 @@ describe('Test EmergencyDetail', () => {
|
|
|
39
39
|
};
|
|
40
40
|
useIsFocused.mockImplementation(() => true);
|
|
41
41
|
await act(async () => {
|
|
42
|
-
tree = renderer.create(wrapComponent(item));
|
|
42
|
+
tree = await renderer.create(wrapComponent(item));
|
|
43
43
|
});
|
|
44
44
|
const instance = tree.root;
|
|
45
45
|
const button = instance.findAllByType(VLCPlayer);
|
|
@@ -36,7 +36,7 @@ describe('Test ItemHanetDevice', () => {
|
|
|
36
36
|
|
|
37
37
|
it('render ItemHanetDevice', async () => {
|
|
38
38
|
await act(async () => {
|
|
39
|
-
tree = renderer.create(wrapComponent(props));
|
|
39
|
+
tree = await renderer.create(wrapComponent(props));
|
|
40
40
|
});
|
|
41
41
|
const instance = tree.root;
|
|
42
42
|
const touches = instance.findAllByType(TouchableWithoutFeedback);
|
|
@@ -49,7 +49,7 @@ describe('Test ItemHanetDevice', () => {
|
|
|
49
49
|
it('render ItemHanetDevice sensor has icon', async () => {
|
|
50
50
|
props.sensor.icon_kit = 'icon';
|
|
51
51
|
await act(async () => {
|
|
52
|
-
tree = renderer.create(wrapComponent(props));
|
|
52
|
+
tree = await renderer.create(wrapComponent(props));
|
|
53
53
|
});
|
|
54
54
|
const instance = tree.root;
|
|
55
55
|
const touches = instance.findAllByType(TouchableWithoutFeedback);
|
|
@@ -9,17 +9,10 @@ import Button from '../../commons/Button';
|
|
|
9
9
|
import CurrencyInput from '../../commons/Form/CurrencyInput';
|
|
10
10
|
import DateTimeRangeChange from '../DateTimeRangeChange';
|
|
11
11
|
import HorizontalBarChart from './HorizontalBarChart';
|
|
12
|
-
import DateTimePickerModal from 'react-native-modal-datetime-picker';
|
|
13
12
|
import LinearChart from './LinearChart';
|
|
14
13
|
import ChartAggregationOption from '../ChartAggregationOption';
|
|
15
14
|
import { formatMoney } from '../../utils/Utils';
|
|
16
15
|
|
|
17
|
-
export const dateTimeType = {
|
|
18
|
-
date: 'date',
|
|
19
|
-
time: 'time',
|
|
20
|
-
dateTime: 'datetime',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
16
|
const { width } = Dimensions.get('window');
|
|
24
17
|
|
|
25
18
|
const HistoryChart = memo(
|
|
@@ -50,25 +43,10 @@ const HistoryChart = memo(
|
|
|
50
43
|
});
|
|
51
44
|
const [price, setPrice] = useState(null);
|
|
52
45
|
|
|
53
|
-
const
|
|
54
|
-
setEventPicker((state) => ({
|
|
55
|
-
...state,
|
|
56
|
-
showModalStart: true,
|
|
57
|
-
showModalEnd: false,
|
|
58
|
-
}));
|
|
59
|
-
}, []);
|
|
60
|
-
const onEnd = useCallback(() => {
|
|
61
|
-
setEventPicker((state) => ({
|
|
62
|
-
...state,
|
|
63
|
-
showModalStart: false,
|
|
64
|
-
showModalEnd: true,
|
|
65
|
-
}));
|
|
66
|
-
}, []);
|
|
67
|
-
const onConfirmStart = useCallback(
|
|
46
|
+
const selectStart = useCallback(
|
|
68
47
|
(date) => {
|
|
69
48
|
setEventPicker((state) => {
|
|
70
49
|
if (typeof date === 'number') {
|
|
71
|
-
onCancel();
|
|
72
50
|
return state;
|
|
73
51
|
}
|
|
74
52
|
if (moment(date) < state.endTime) {
|
|
@@ -89,15 +67,15 @@ const HistoryChart = memo(
|
|
|
89
67
|
};
|
|
90
68
|
}
|
|
91
69
|
});
|
|
70
|
+
onCancel();
|
|
92
71
|
},
|
|
93
72
|
[onCancel, setStartDate, setEndDate]
|
|
94
73
|
);
|
|
95
74
|
|
|
96
|
-
const
|
|
75
|
+
const selectEnd = useCallback(
|
|
97
76
|
(date) => {
|
|
98
77
|
setEventPicker((state) => {
|
|
99
78
|
if (typeof date === 'number') {
|
|
100
|
-
onCancel();
|
|
101
79
|
return state;
|
|
102
80
|
}
|
|
103
81
|
if (moment(date).add(1, 'day') > state.startTime) {
|
|
@@ -120,6 +98,7 @@ const HistoryChart = memo(
|
|
|
120
98
|
};
|
|
121
99
|
}
|
|
122
100
|
});
|
|
101
|
+
onCancel();
|
|
123
102
|
},
|
|
124
103
|
[onCancel, setStartDate, setEndDate]
|
|
125
104
|
);
|
|
@@ -197,8 +176,8 @@ const HistoryChart = memo(
|
|
|
197
176
|
) && (
|
|
198
177
|
<DateTimeRangeChange
|
|
199
178
|
startTime={eventPicker.startTime}
|
|
200
|
-
|
|
201
|
-
|
|
179
|
+
selectStart={selectStart}
|
|
180
|
+
selectEnd={selectEnd}
|
|
202
181
|
endTime={eventPicker.endTime}
|
|
203
182
|
formatType={formatType}
|
|
204
183
|
/>
|
|
@@ -234,28 +213,6 @@ const HistoryChart = memo(
|
|
|
234
213
|
{t('total_power_price')} <Text bold>{formatMoney(totalPrice)}</Text>
|
|
235
214
|
</Text>
|
|
236
215
|
)}
|
|
237
|
-
<DateTimePickerModal
|
|
238
|
-
isVisible={eventPicker.showModalStart}
|
|
239
|
-
date={eventPicker.startTime?._d}
|
|
240
|
-
mode={formatType || 'datetime'}
|
|
241
|
-
onConfirm={onConfirmStart}
|
|
242
|
-
onCancel={onCancel}
|
|
243
|
-
display="spinner"
|
|
244
|
-
headerTextIOS={t('pick_a_date')}
|
|
245
|
-
cancelTextIOS={t('cancel')}
|
|
246
|
-
confirmTextIOS={t('confirm')}
|
|
247
|
-
/>
|
|
248
|
-
<DateTimePickerModal
|
|
249
|
-
isVisible={eventPicker.showModalEnd}
|
|
250
|
-
date={eventPicker.endTime?._d}
|
|
251
|
-
mode={formatType || 'datetime'}
|
|
252
|
-
onConfirm={onConfirmEnd}
|
|
253
|
-
onCancel={onCancel}
|
|
254
|
-
display="spinner"
|
|
255
|
-
headerTextIOS={t('pick_a_date')}
|
|
256
|
-
cancelTextIOS={t('cancel')}
|
|
257
|
-
confirmTextIOS={t('confirm')}
|
|
258
|
-
/>
|
|
259
216
|
</View>
|
|
260
217
|
);
|
|
261
218
|
}
|
|
@@ -18,7 +18,7 @@ describe('Test LinearChart', () => {
|
|
|
18
18
|
},
|
|
19
19
|
];
|
|
20
20
|
await act(async () => {
|
|
21
|
-
tree = renderer.create(<LinearChart datas={data} />);
|
|
21
|
+
tree = await renderer.create(<LinearChart datas={data} />);
|
|
22
22
|
});
|
|
23
23
|
const instance = tree.root;
|
|
24
24
|
const views = instance.findAllByType(View);
|
|
@@ -38,7 +38,7 @@ describe('Test ProgressBar', () => {
|
|
|
38
38
|
};
|
|
39
39
|
const data = [{ value: 10, unit: 'oC' }];
|
|
40
40
|
await act(async () => {
|
|
41
|
-
tree = renderer.create(wrapComponent(item, data));
|
|
41
|
+
tree = await renderer.create(wrapComponent(item, data));
|
|
42
42
|
});
|
|
43
43
|
const instance = tree.root;
|
|
44
44
|
const texts = instance.findAllByType(Text);
|
|
@@ -15,7 +15,7 @@ const ProgressBar = memo(({ data = [], item }) => {
|
|
|
15
15
|
}, [item?.configuration?.max_value]);
|
|
16
16
|
const { value = 0, measure, unit } = data.length ? data[0] : {};
|
|
17
17
|
const percent = value / maxValue; // a number between 0 and 1
|
|
18
|
-
|
|
18
|
+
const isNotValue = ['', null, undefined, NaN].includes(value);
|
|
19
19
|
return (
|
|
20
20
|
<View style={styles.container}>
|
|
21
21
|
<Text size={16} style={styles.textLabel}>
|
|
@@ -28,19 +28,13 @@ const ProgressBar = memo(({ data = [], item }) => {
|
|
|
28
28
|
|
|
29
29
|
<View style={styles.wrapProgressBar}>
|
|
30
30
|
<Progress.Bar
|
|
31
|
+
style={styles.processBar}
|
|
31
32
|
progress={percent}
|
|
32
|
-
height={40}
|
|
33
|
-
width={200}
|
|
34
|
-
color={Colors.Blue16}
|
|
35
33
|
unfilledColor={Colors.Blue15}
|
|
36
|
-
borderWidth={0}
|
|
37
|
-
borderRadius={10}
|
|
38
34
|
/>
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</Text>
|
|
43
|
-
</View>
|
|
35
|
+
<Text numberOfLines={1} style={styles.textValue}>
|
|
36
|
+
{isNotValue ? '--' : value}
|
|
37
|
+
</Text>
|
|
44
38
|
</View>
|
|
45
39
|
</View>
|
|
46
40
|
);
|
|
@@ -14,20 +14,28 @@ export default StyleSheet.create({
|
|
|
14
14
|
marginBottom: 12,
|
|
15
15
|
},
|
|
16
16
|
textLabel: {
|
|
17
|
-
|
|
17
|
+
marginLeft: 8,
|
|
18
18
|
paddingTop: 8,
|
|
19
19
|
},
|
|
20
20
|
textMaxValue: {
|
|
21
21
|
marginTop: 20,
|
|
22
|
-
|
|
22
|
+
marginBottom: 2,
|
|
23
23
|
textAlign: 'left',
|
|
24
24
|
fontWeight: 'bold',
|
|
25
25
|
textTransform: 'uppercase',
|
|
26
26
|
},
|
|
27
|
+
processBar: {
|
|
28
|
+
flex: 1,
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: 40,
|
|
31
|
+
color: Colors.Blue16,
|
|
32
|
+
borderWidth: 0,
|
|
33
|
+
borderRadius: 10,
|
|
34
|
+
},
|
|
27
35
|
wrapProgressBar: {
|
|
28
36
|
flex: 1,
|
|
29
37
|
flexDirection: 'row',
|
|
30
|
-
justifyContent: '
|
|
38
|
+
justifyContent: 'flex-start',
|
|
31
39
|
alignItems: 'center',
|
|
32
40
|
},
|
|
33
41
|
textValue: {
|
|
@@ -19,7 +19,7 @@ describe('Test CurrentRainSensor', () => {
|
|
|
19
19
|
},
|
|
20
20
|
];
|
|
21
21
|
await act(async () => {
|
|
22
|
-
tree = renderer.create(<CurrentRainSensor data={data} />);
|
|
22
|
+
tree = await renderer.create(<CurrentRainSensor data={data} />);
|
|
23
23
|
});
|
|
24
24
|
const instance = tree.root;
|
|
25
25
|
const Views = instance.findAllByType(View);
|
|
@@ -38,7 +38,7 @@ describe('Test CurrentRainSensor', () => {
|
|
|
38
38
|
},
|
|
39
39
|
];
|
|
40
40
|
await act(async () => {
|
|
41
|
-
tree = renderer.create(<CurrentRainSensor data={data} />);
|
|
41
|
+
tree = await renderer.create(<CurrentRainSensor data={data} />);
|
|
42
42
|
});
|
|
43
43
|
const instance = tree.root;
|
|
44
44
|
const Views = instance.findAllByType(View);
|
|
@@ -47,7 +47,7 @@ describe('Test CurrentRainSensor', () => {
|
|
|
47
47
|
|
|
48
48
|
it('render CurrentRainSensor data empty', async () => {
|
|
49
49
|
await act(async () => {
|
|
50
|
-
tree = renderer.create(<CurrentRainSensor data={[]} />);
|
|
50
|
+
tree = await renderer.create(<CurrentRainSensor data={[]} />);
|
|
51
51
|
});
|
|
52
52
|
const instance = tree.root;
|
|
53
53
|
const Views = instance.findAllByType(View);
|
|
@@ -66,7 +66,7 @@ describe('Test CurrentRainSensor', () => {
|
|
|
66
66
|
},
|
|
67
67
|
];
|
|
68
68
|
await act(async () => {
|
|
69
|
-
tree = renderer.create(<CurrentRainSensor data={data} />);
|
|
69
|
+
tree = await renderer.create(<CurrentRainSensor data={data} />);
|
|
70
70
|
});
|
|
71
71
|
const instance = tree.root;
|
|
72
72
|
const fimage = instance.findAllByType(FImage);
|
|
@@ -85,7 +85,7 @@ describe('Test CurrentRainSensor', () => {
|
|
|
85
85
|
},
|
|
86
86
|
];
|
|
87
87
|
await act(async () => {
|
|
88
|
-
tree = renderer.create(<CurrentRainSensor data={data} />);
|
|
88
|
+
tree = await renderer.create(<CurrentRainSensor data={data} />);
|
|
89
89
|
});
|
|
90
90
|
const instance = tree.root;
|
|
91
91
|
const iconComponent = instance.findAllByType(IconComponent);
|
|
@@ -18,7 +18,7 @@ describe('Test SonosSpeaker', () => {
|
|
|
18
18
|
let tree;
|
|
19
19
|
it('create SonosSpeaker', async () => {
|
|
20
20
|
await act(async () => {
|
|
21
|
-
tree = renderer.create(wrapComponent());
|
|
21
|
+
tree = await renderer.create(wrapComponent());
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const instance = tree.root;
|
|
@@ -28,7 +28,7 @@ describe('Test SonosSpeaker', () => {
|
|
|
28
28
|
|
|
29
29
|
it('Test handleClickButton', async () => {
|
|
30
30
|
await act(async () => {
|
|
31
|
-
tree = renderer.create(wrapComponent());
|
|
31
|
+
tree = await renderer.create(wrapComponent());
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
const instance = tree.root;
|
|
@@ -43,7 +43,7 @@ describe('Test SonosSpeaker', () => {
|
|
|
43
43
|
|
|
44
44
|
it('Test onValueChange', async () => {
|
|
45
45
|
await act(async () => {
|
|
46
|
-
tree = renderer.create(wrapComponent());
|
|
46
|
+
tree = await renderer.create(wrapComponent());
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
const instance = tree.root;
|
|
@@ -20,7 +20,7 @@ describe('Test Compass', () => {
|
|
|
20
20
|
},
|
|
21
21
|
];
|
|
22
22
|
await act(async () => {
|
|
23
|
-
tree = renderer.create(wrapComponent(data));
|
|
23
|
+
tree = await renderer.create(wrapComponent(data));
|
|
24
24
|
});
|
|
25
25
|
const instance = tree.root;
|
|
26
26
|
const textInputs = instance.findAllByType(Text);
|
|
@@ -29,7 +29,7 @@ describe('Test Compass', () => {
|
|
|
29
29
|
|
|
30
30
|
it('create Compass data null', async () => {
|
|
31
31
|
await act(async () => {
|
|
32
|
-
tree = renderer.create(wrapComponent([]));
|
|
32
|
+
tree = await renderer.create(wrapComponent([]));
|
|
33
33
|
});
|
|
34
34
|
const instance = tree.root;
|
|
35
35
|
const textInputs = instance.findAllByType(Text);
|
|
@@ -80,6 +80,7 @@ const Anemometer = memo(
|
|
|
80
80
|
);
|
|
81
81
|
arr.push(
|
|
82
82
|
<Text
|
|
83
|
+
key={i.toString()}
|
|
83
84
|
fill={txtColor}
|
|
84
85
|
fontSize={18}
|
|
85
86
|
x={textPosition.x}
|
|
@@ -100,6 +101,7 @@ const Anemometer = memo(
|
|
|
100
101
|
);
|
|
101
102
|
arr.push(
|
|
102
103
|
<Text
|
|
104
|
+
key={i.toString()}
|
|
103
105
|
fill={txtColor}
|
|
104
106
|
fontSize={18}
|
|
105
107
|
x={textPosition.x}
|