@eohjsc/react-native-smart-city 0.6.2 → 0.7.3-rc1

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.
Files changed (338) hide show
  1. package/README.md +3 -3
  2. package/android/build.gradle +7 -10
  3. package/assets/images/Automation-fill.svg +85 -0
  4. package/assets/images/Scenario-filled.svg +22 -0
  5. package/assets/images/schedule-fill.svg +48 -0
  6. package/package.json +53 -70
  7. package/src/commons/Action/ItemQuickAction.js +1 -1
  8. package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -2
  9. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
  10. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
  11. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +2 -2
  12. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -3
  13. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
  14. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  15. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -15
  16. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
  17. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
  18. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
  19. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
  20. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
  21. package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
  22. package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
  23. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +4 -4
  24. package/src/commons/ActionGroup/TimerActionTemplate.js +4 -5
  25. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
  26. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +4 -9
  27. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +2 -9
  28. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +4 -11
  29. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +2 -9
  30. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -18
  31. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +2 -2
  32. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +1 -8
  33. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -7
  34. package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +4 -15
  35. package/src/commons/ActionGroup/__test__/TerminalBoxTemplate.test.js +0 -7
  36. package/src/commons/ActionGroup/__test__/TextBoxTemplate.test.js +1 -8
  37. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +8 -15
  38. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +2 -10
  39. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +3 -20
  40. package/src/commons/ActionGroup/__test__/index.test.js +15 -23
  41. package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
  42. package/src/commons/ActionTemplate/__test__/utils.js +21 -0
  43. package/src/commons/ActionTemplate/index.js +1 -2
  44. package/src/commons/BackDefault/index.js +2 -2
  45. package/src/commons/ButtonPopup/index.js +2 -2
  46. package/src/commons/Calendar/__test__/Calendar.test.js +0 -7
  47. package/src/commons/CircleButton/__test__/CircleButton.test.js +2 -2
  48. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +11 -25
  49. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +27 -20
  50. package/src/commons/Dashboard/MyUnit/index.js +0 -1
  51. package/src/commons/DateTimeRangeChange/DateTimeButton.js +2 -2
  52. package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -4
  53. package/src/commons/DateTimeRangeChange/index.js +3 -3
  54. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  55. package/src/commons/Device/DisconnectedView.js +2 -2
  56. package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
  57. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +2 -2
  58. package/src/commons/Device/FlatListItems.js +3 -3
  59. package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
  60. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -11
  61. package/src/commons/Device/ItemAddNew/index.js +2 -2
  62. package/src/commons/Device/ItemDevice.js +5 -21
  63. package/src/commons/Device/SonosSpeaker/index.js +3 -3
  64. package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
  65. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -6
  66. package/src/commons/DisplayChecking/index.js +2 -2
  67. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  68. package/src/commons/EmergencyButton/AlertSent.js +6 -2
  69. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  70. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +5 -5
  71. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +9 -9
  72. package/src/commons/Form/CurrencyInput.js +1 -15
  73. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +1 -22
  74. package/src/commons/Header/HeaderCustom.js +8 -3
  75. package/src/commons/HeaderAni/index.js +2 -2
  76. package/src/commons/IconComponent/index.js +3 -3
  77. package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
  78. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +12 -48
  79. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +1 -1
  80. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -0
  81. package/src/commons/MenuActionMore/MenuActionMoreStyles.js +2 -1
  82. package/src/commons/MenuActionMore/index.js +1 -1
  83. package/src/commons/NavBar/NavBarStyles.js +1 -1
  84. package/src/commons/NavBar/index.js +2 -2
  85. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  86. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +1 -13
  87. package/src/commons/Processing/__test__/Connecting.test.js +3 -14
  88. package/src/commons/SearchLocation/index.js +3 -3
  89. package/src/commons/SelectActionCard/index.js +2 -2
  90. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -18
  91. package/src/commons/SelectSubUnit/index.js +2 -2
  92. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +1 -13
  93. package/src/commons/Sharing/BtnRemoveMember.js +2 -2
  94. package/src/commons/Sharing/StationDevicePermissions.js +2 -2
  95. package/src/commons/Sharing/WrapHeaderScrollable.js +1 -1
  96. package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +2 -2
  97. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
  98. package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
  99. package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
  100. package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
  101. package/src/commons/SubUnit/Item/index.js +3 -3
  102. package/src/commons/SubUnit/OneTap/ItemOneTap.js +5 -5
  103. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +11 -8
  104. package/src/commons/SubUnit/__test__/Favorites.test.js +1 -13
  105. package/src/commons/SubUnit/__test__/ShortDetail.test.js +5 -16
  106. package/src/commons/SummaryItem/index.js +22 -23
  107. package/src/commons/Tabbar/__test__/index.test.js +0 -11
  108. package/src/commons/Unit/HeaderUnit/index.js +93 -85
  109. package/src/commons/Unit/SharedUnit.js +7 -7
  110. package/src/commons/Unit/__test__/HeaderUnit.test.js +29 -52
  111. package/src/commons/Unit/__test__/SharedUnit.test.js +94 -105
  112. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +11 -30
  113. package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +44 -1
  114. package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +69 -0
  115. package/src/commons/WrapParallaxScrollView/index.js +20 -50
  116. package/src/configs/API.js +1 -2
  117. package/src/configs/Constants.js +3 -3
  118. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +4 -15
  119. package/src/hooks/Common/useIsOwnerOfUnit.js +1 -1
  120. package/src/hooks/IoT/__test__/useRemoteControl.test.js +1 -1
  121. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +6 -21
  122. package/src/iot/RemoteControl/HomeAssistant.js +1 -1
  123. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +234 -232
  124. package/src/navigations/AddDeviceStack.js +2 -2
  125. package/src/navigations/AddGatewayStack.js +2 -2
  126. package/src/navigations/AddLGDeviceStack.js +2 -2
  127. package/src/navigations/AddMemberStack.js +2 -2
  128. package/src/navigations/AddSubUnitStack.js +2 -2
  129. package/src/navigations/AddUnitStack.js +2 -2
  130. package/src/navigations/AllGatewayStack.js +2 -2
  131. package/src/navigations/AutomateStack.js +4 -4
  132. package/src/navigations/EmergencyContactsStack.js +4 -4
  133. package/src/navigations/GatewayStack.js +2 -2
  134. package/src/navigations/HanetCameraStack.js +2 -2
  135. package/src/navigations/Main.js +2 -2
  136. package/src/navigations/NotificationStack.js +2 -2
  137. package/src/navigations/SharedStack.js +8 -6
  138. package/src/navigations/SmartAccountStack.js +2 -2
  139. package/src/navigations/SmartIrStack.js +2 -2
  140. package/src/navigations/SmartLockStack.js +2 -2
  141. package/src/navigations/SmartStack.js +2 -2
  142. package/src/navigations/TemplateStack.js +2 -2
  143. package/src/navigations/UnitStack.js +4 -12
  144. package/src/navigations/utils.js +1 -4
  145. package/src/screens/ActivityLog/hooks/index.js +7 -4
  146. package/src/screens/ActivityLog/index.js +2 -2
  147. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +4 -21
  148. package/src/screens/AddCommon/__test__/SelectUnit.test.js +7 -19
  149. package/src/screens/AddLocationMaps/__test__/index.test.js +3 -13
  150. package/src/screens/AddLocationMaps/index.js +11 -6
  151. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +3 -20
  152. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +11 -18
  153. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +4 -21
  154. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  155. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +3 -3
  156. package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +0 -17
  157. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +4 -19
  158. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +3 -15
  159. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +31 -51
  160. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +9 -22
  161. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +12 -19
  162. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +6 -16
  163. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +4 -15
  164. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
  165. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +18 -10
  166. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
  167. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +12 -9
  168. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +12 -9
  169. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +7 -21
  170. package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +0 -20
  171. package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +7 -24
  172. package/src/screens/AllGateway/DeviceGatewayInfo/__test__/index.test.js +0 -17
  173. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +84 -100
  174. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +64 -82
  175. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -55
  176. package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +9 -18
  177. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +10 -37
  178. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +7 -32
  179. package/src/screens/AllGateway/__test__/index.test.js +1 -14
  180. package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +0 -12
  181. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -13
  182. package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
  183. package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -8
  184. package/src/screens/AllGateway/test-utils.js +1 -1
  185. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +2 -2
  186. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +27 -28
  187. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
  188. package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +8 -5
  189. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +2 -2
  190. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +1 -18
  191. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +17 -15
  192. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +4 -4
  193. package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +38 -55
  194. package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +0 -18
  195. package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +1 -19
  196. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +14 -11
  197. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +3 -3
  198. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +2 -2
  199. package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +2 -2
  200. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +33 -25
  201. package/src/screens/Automate/ScriptDetail/index.js +6 -6
  202. package/src/screens/Automate/SetSchedule/__test__/index.test.js +4 -4
  203. package/src/screens/Automate/SetSchedule/components/RowItem.js +3 -3
  204. package/src/screens/Automate/Styles/indexStyles.js +6 -0
  205. package/src/screens/Automate/__test__/MultiUnits.test.js +7 -7
  206. package/src/screens/Automate/__test__/index.test.js +9 -34
  207. package/src/screens/Automate/index.js +50 -33
  208. package/src/screens/ChangePosition/__test__/index.test.js +1 -14
  209. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +1 -23
  210. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +1 -11
  211. package/src/screens/Device/EditDevice/index.js +2 -2
  212. package/src/screens/Device/__test__/detail.test.js +11 -11
  213. package/src/screens/Device/__test__/sensorDisplayItem.test.js +0 -12
  214. package/src/screens/Device/detail.js +14 -12
  215. package/src/screens/Drawer/Drawer.test.js +3 -11
  216. package/src/screens/Drawer/index.js +3 -4
  217. package/src/screens/EmergencyContacts/EmergencyContactsList.js +4 -8
  218. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
  219. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +4 -17
  220. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +3 -14
  221. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +0 -10
  222. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  223. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +4 -17
  224. package/src/screens/GuestInfo/__test__/index.test.js +0 -11
  225. package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
  226. package/src/screens/GuestInfo/index.js +2 -2
  227. package/src/screens/HanetCamera/Detail.js +6 -2
  228. package/src/screens/HanetCamera/ManageAccess.js +3 -4
  229. package/src/screens/HanetCamera/MemberInfo.js +4 -4
  230. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +2 -16
  231. package/src/screens/HanetCamera/__test__/Detail.test.js +1 -12
  232. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -16
  233. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +5 -18
  234. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  235. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +3 -19
  236. package/src/screens/ManageAccess/index.js +3 -3
  237. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +7 -7
  238. package/src/screens/Notification/__test__/Notification.test.js +5 -15
  239. package/src/screens/Notification/__test__/NotificationItem.test.js +9 -19
  240. package/src/screens/Notification/index.js +5 -5
  241. package/src/screens/PlayBackCamera/__test__/index.test.js +13 -22
  242. package/src/screens/PlayBackCamera/index.js +2 -2
  243. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +0 -11
  244. package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
  245. package/src/screens/SelectUnit/__test__/index.test.js +9 -29
  246. package/src/screens/SelectUnit/index.js +2 -2
  247. package/src/screens/SharedUnit/TabHeader.js +2 -2
  248. package/src/screens/SharedUnit/index.js +5 -0
  249. package/src/screens/Sharing/Components/EndDevice.js +3 -3
  250. package/src/screens/Sharing/SelectUser.js +5 -4
  251. package/src/screens/Sharing/UnitMemberList.js +7 -6
  252. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +9 -4
  253. package/src/screens/Sharing/__test__/SelectShareDevice.test.js +2 -15
  254. package/src/screens/Sharing/__test__/SelectUser.test.js +2 -22
  255. package/src/screens/Sharing/__test__/UnitMemberList.test.js +2 -2
  256. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +4 -17
  257. package/src/screens/Sharing/hooks/__test__/index.test.js +2 -13
  258. package/src/screens/SmartAccount/Connecting/index.js +0 -2
  259. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +3 -18
  260. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +11 -21
  261. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +3 -4
  262. package/src/screens/SmartAccount/__test__/Connecting.test.js +30 -36
  263. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +12 -21
  264. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +8 -17
  265. package/src/screens/SmartIr/__test__/SelectBrand.test.js +1 -11
  266. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +1 -12
  267. package/src/screens/SmartIr/__test__/SmartIr.test.js +3 -11
  268. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +6 -5
  269. package/src/screens/SmartIr/components/SelectBrand.js +2 -2
  270. package/src/screens/SubUnit/AddSubUnit.js +1 -0
  271. package/src/screens/SubUnit/EditSubUnit.js +3 -2
  272. package/src/screens/SubUnit/ManageSubUnit.js +5 -5
  273. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -31
  274. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +12 -30
  275. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -2
  276. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +0 -12
  277. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -20
  278. package/src/screens/Template/__test__/EditTemplate.test.js +4 -15
  279. package/src/screens/Template/__test__/GatewayList.test.js +0 -9
  280. package/src/screens/Template/__test__/detail.test.js +8 -8
  281. package/src/screens/Template/__test__/index.test.js +3 -14
  282. package/src/screens/Template/detail.js +2 -2
  283. package/src/screens/Unit/Detail.js +10 -55
  284. package/src/screens/Unit/MoreMenu.js +6 -5
  285. package/src/screens/Unit/SelectAddToFavorites.js +2 -2
  286. package/src/screens/Unit/SelectAddress.js +9 -4
  287. package/src/screens/Unit/SmartAccountItem.js +2 -2
  288. package/src/screens/Unit/Station/__test__/index.test.js +2 -2
  289. package/src/screens/Unit/Summaries.js +24 -29
  290. package/src/screens/Unit/__test__/AddMenu.test.js +5 -2
  291. package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -12
  292. package/src/screens/Unit/__test__/ChooseLocation.test.js +1 -4
  293. package/src/screens/Unit/__test__/Detail.test.js +14 -12
  294. package/src/screens/Unit/__test__/ManageUnit.test.js +2 -17
  295. package/src/screens/Unit/__test__/MoreMenu.test.js +6 -12
  296. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +3 -14
  297. package/src/screens/Unit/__test__/SelectAddress.test.js +4 -17
  298. package/src/screens/Unit/__test__/SmartAccount.test.js +14 -11
  299. package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -11
  300. package/src/screens/Unit/__test__/Summaries.test.js +2 -14
  301. package/src/screens/Unit/components/AutomateScript/index.js +5 -5
  302. package/src/screens/Unit/components/ButtonWrapper/index.js +3 -4
  303. package/src/screens/Unit/components/Header/index.js +5 -4
  304. package/src/screens/Unit/components/SharedUnit/index.js +5 -5
  305. package/src/screens/Unit/components/__test__/Header.test.js +1 -14
  306. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +1 -11
  307. package/src/screens/Unit/components/__test__/SharedUnit.test.js +1 -11
  308. package/src/screens/UnitSummary/__test__/index.test.js +51 -17
  309. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +8 -25
  310. package/src/screens/UnitSummary/components/AirQuality/__test__/index.test.js +1 -7
  311. package/src/screens/UnitSummary/components/AirQuality/index.js +8 -3
  312. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +0 -11
  313. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +1 -16
  314. package/src/screens/UnitSummary/components/Temperature/index.js +5 -1
  315. package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +0 -8
  316. package/src/screens/UnitSummary/components/UvIndex/index.js +6 -2
  317. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +3 -3
  318. package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +14 -18
  319. package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +8 -8
  320. package/src/screens/UnitSummary/index.js +6 -6
  321. package/src/utils/Apis/axios.js +4 -2
  322. package/src/utils/Converter/__test__/timer.test.js +8 -0
  323. package/src/utils/Functions/preloadImages.js +13 -14
  324. package/src/utils/Monitor.js +2 -3
  325. package/src/utils/Route/index.js +0 -1
  326. package/src/utils/Storage.js +1 -1
  327. package/assets/images/OneTap.svg +0 -14
  328. package/assets/images/Schedule.svg +0 -39
  329. package/assets/images/ValueChange.svg +0 -49
  330. package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +0 -48
  331. package/src/commons/Device/WindSpeed/LinearChart/index.js +0 -155
  332. package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +0 -27
  333. package/src/screens/AddNewGateway/hooks/index.js +0 -31
  334. package/src/screens/SubUnit/Detail.js +0 -150
  335. package/src/screens/SubUnit/__test__/Detail.test.js +0 -125
  336. package/src/screens/UnitSummary/components/Temperature/ChartAverage/index.js +0 -62
  337. package/src/screens/UnitSummary/components/Temperature/__test__/ChartAverage.test.js +0 -17
  338. package/src/utils/dateHelper/getTickValues.js +0 -22
@@ -103,7 +103,7 @@ describe('test OneTap', () => {
103
103
  await act(async () => {
104
104
  await item[0].props.onPress();
105
105
  });
106
- expect(mockedNavigate).not.toBeCalled();
106
+ expect(global.mockedNavigate).not.toBeCalled();
107
107
  });
108
108
 
109
109
  it('test onClose have automateId', async () => {
@@ -125,6 +125,6 @@ describe('test OneTap', () => {
125
125
  await act(async () => {
126
126
  header.props.onPress();
127
127
  });
128
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail);
128
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail);
129
129
  });
130
130
  });
@@ -11,7 +11,7 @@ import Event from '../../../../../assets/images/Event.svg';
11
11
  import Notify from '../../../../../assets/images/Notify.svg';
12
12
  import Delay from '../../../../../assets/images/Delay.svg';
13
13
  import { TouchableOpacity } from 'react-native';
14
- import { IconOutline } from '@ant-design/icons-react-native';
14
+ import AntDesign from 'react-native-vector-icons/AntDesign';
15
15
  import { Text } from '../../../../commons';
16
16
  import Routes from '../../../../utils/Route';
17
17
  import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
@@ -109,7 +109,7 @@ const AddActionScript = memo(
109
109
  <View style={styles.wapItem}>
110
110
  <View style={styles.imageItem}>{item.image}</View>
111
111
  <Text style={styles.textItem}>{item.text}</Text>
112
- <IconOutline name="right" />
112
+ <AntDesign name="right" />
113
113
  </View>
114
114
  </TouchableOpacity>
115
115
  </View>
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { create, act } from 'react-test-renderer';
3
3
  import Toast from 'react-native-toast-message';
4
4
  import { useNavigation } from '@react-navigation/native';
5
- import { TouchableOpacity } from 'react-native';
5
+ import { Switch, TouchableOpacity } from 'react-native';
6
6
  import MockAdapter from 'axios-mock-adapter';
7
7
 
8
8
  import { SCProvider } from '../../../../context';
@@ -24,7 +24,6 @@ import Text from '../../../../commons/Text';
24
24
  import { ToastBottomHelper } from '../../../../utils/Utils';
25
25
  import { getTranslate } from '../../../../utils/I18n';
26
26
  import AddActionScript from '../Components/AddActionScript';
27
- import { Switch } from '@ant-design/react-native';
28
27
 
29
28
  const wrapComponent = (route, storeData = {}) => (
30
29
  <SCProvider initState={mockSCStore(storeData)}>
@@ -40,10 +39,10 @@ describe('Test ScriptDetail', () => {
40
39
  let tree;
41
40
 
42
41
  const mockGoBack = useNavigation().goBack;
43
- const mockNavigate = useNavigation().navigate;
42
+ const mockedNavigate = useNavigation().navigate;
44
43
  beforeEach(() => {
45
44
  mockGoBack.mockClear();
46
- mockNavigate.mockClear();
45
+ mockedNavigate.mockClear();
47
46
  mock.reset();
48
47
  route = {
49
48
  params: {
@@ -202,7 +201,7 @@ describe('Test ScriptDetail', () => {
202
201
  await alertAction.props.rightButtonClick();
203
202
  });
204
203
  expect(alertAction.props.visible).toBeFalsy();
205
- expect(mockGoBack).toHaveBeenCalled();
204
+ expect(global.mockedGoBack).toHaveBeenCalled();
206
205
  });
207
206
 
208
207
  it('test star then unstar script', async () => {
@@ -234,7 +233,7 @@ describe('Test ScriptDetail', () => {
234
233
  await act(async () => {
235
234
  await menu.props.onItemClick(removeFavorite);
236
235
  });
237
- expect(mockGoBack).not.toHaveBeenCalled();
236
+ expect(global.mockedGoBack).not.toHaveBeenCalled();
238
237
  });
239
238
 
240
239
  it('test activate one tap', async () => {
@@ -255,7 +254,7 @@ describe('Test ScriptDetail', () => {
255
254
  await act(async () => {
256
255
  await buttonActivate.props.onPress();
257
256
  });
258
- expect(mockNavigate).not.toBeCalled();
257
+ expect(global.mockedNavigate).not.toBeCalled();
259
258
  });
260
259
 
261
260
  it('test press add action', async () => {
@@ -303,28 +302,37 @@ describe('Test ScriptDetail', () => {
303
302
  await listScriptActions[0].props.onPress();
304
303
  });
305
304
 
306
- expect(mockNavigate).toHaveBeenCalledWith(Routes.SelectControlDevices, {
307
- unitId: route.params.preAutomate.unit,
308
- automateId: route.params.preAutomate.id,
309
- numberActionCanAdd: 2,
310
- });
311
- mockNavigate.mockClear();
305
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
306
+ Routes.SelectControlDevices,
307
+ {
308
+ unitId: route.params.preAutomate.unit,
309
+ automateId: route.params.preAutomate.id,
310
+ numberActionCanAdd: 2,
311
+ }
312
+ );
313
+ mockedNavigate.mockClear();
312
314
  await act(async () => {
313
315
  await listScriptActions[1].props.onPress();
314
316
  });
315
317
 
316
- expect(mockNavigate).toHaveBeenCalledWith(Routes.SetupScriptNotify, {
317
- automate: route.params.preAutomate,
318
- unitId: route.params.preAutomate.unit,
319
- });
320
- mockNavigate.mockClear();
318
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
319
+ Routes.SetupScriptNotify,
320
+ {
321
+ automate: route.params.preAutomate,
322
+ unitId: route.params.preAutomate.unit,
323
+ }
324
+ );
325
+ mockedNavigate.mockClear();
321
326
  await act(async () => {
322
327
  await listScriptActions[2].props.onPress();
323
328
  });
324
329
 
325
- expect(mockNavigate).toHaveBeenCalledWith(Routes.SetupScriptDelay, {
326
- automate: route.params.preAutomate,
327
- });
330
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
331
+ Routes.SetupScriptDelay,
332
+ {
333
+ automate: route.params.preAutomate,
334
+ }
335
+ );
328
336
  });
329
337
 
330
338
  it('test press disable script', async () => {
@@ -383,7 +391,7 @@ describe('Test ScriptDetail', () => {
383
391
  await act(async () => {
384
392
  await button.props.onPress();
385
393
  });
386
- expect(mockNavigate).not.toBeCalled();
394
+ expect(global.mockedNavigate).not.toBeCalled();
387
395
  expect(spyToastError).toBeCalledWith(
388
396
  getTranslate('en', 'reach_max_actions_per_automation', { length: 0 }),
389
397
  '',
@@ -418,7 +426,7 @@ describe('Test ScriptDetail', () => {
418
426
  await act(async () => {
419
427
  await WrapHeaderScrollables[0].props.onGoBack();
420
428
  });
421
- expect(mockGoBack).toBeCalled();
429
+ expect(global.mockedGoBack).toBeCalled();
422
430
  });
423
431
 
424
432
  const _testGoToActivityLog = (
@@ -440,7 +448,7 @@ describe('Test ScriptDetail', () => {
440
448
  await act(async () => {
441
449
  await menu.props.onItemClick(gotoActivityLog);
442
450
  });
443
- expect(mockNavigate).toHaveBeenCalledWith(Routes.ActivityLog, {
451
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ActivityLog, {
444
452
  id: route.params.id,
445
453
  type: activityLogType,
446
454
  share: unitId,
@@ -490,7 +498,7 @@ describe('Test ScriptDetail', () => {
490
498
  await act(async () => {
491
499
  itemAutomate.findByType(TouchableOpacity).props.onPress();
492
500
  });
493
- expect(mockNavigate).toBeCalled();
501
+ expect(global.mockedNavigate).toBeCalled();
494
502
  });
495
503
 
496
504
  it('Test render textCondition value change =', async () => {
@@ -5,10 +5,10 @@ import React, {
5
5
  useRef,
6
6
  useState,
7
7
  } from 'react';
8
- import { Image, Platform, TouchableOpacity, View } from 'react-native';
8
+ import { Image, Platform, TouchableOpacity, View, Switch } from 'react-native';
9
9
  import { PopoverMode } from 'react-native-popover-view';
10
- import { IconFill, IconOutline } from '@ant-design/icons-react-native';
11
- import { Icon, Switch } from '@ant-design/react-native';
10
+ import AntDesign from 'react-native-vector-icons/AntDesign';
11
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
12
12
 
13
13
  import { useTranslations } from '../../../hooks/Common/useTranslations';
14
14
  import styles from './Styles/indexStyles';
@@ -192,7 +192,7 @@ const ScriptDetail = ({ route }) => {
192
192
  accessibilityLabel={AccessibilityLabel.ICON_MORE}
193
193
  >
194
194
  <View style={[styles.headerButton, styles.moreButton]}>
195
- <Icon name={'more'} size={27} color={Colors.Black} />
195
+ <MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
196
196
  </View>
197
197
  </TouchableOpacity>
198
198
  </View>
@@ -479,9 +479,9 @@ const ButtonStar = ({ automate }) => {
479
479
  accessibilityLabel={AccessibilityLabel.HEADER_SCRIPT_DETAIL_BUTTON_STAR}
480
480
  >
481
481
  {isStarred ? (
482
- <IconFill name="star" size={25} color={Colors.Yellow6} />
482
+ <AntDesign name="star" size={25} color={Colors.Yellow6} />
483
483
  ) : (
484
- <IconOutline name="star" size={25} />
484
+ <AntDesign name="staro" size={25} />
485
485
  )}
486
486
  </PreventDoubleTouch>
487
487
  );
@@ -32,10 +32,10 @@ describe('Test SetSchedule', () => {
32
32
  },
33
33
  };
34
34
 
35
- const mockNavigate = useNavigation().navigate;
35
+ const mockedNavigate = useNavigation().navigate;
36
36
 
37
37
  beforeEach(() => {
38
- mockNavigate.mockClear();
38
+ mockedNavigate.mockClear();
39
39
  Date.now = jest.fn(() => new Date('2021-01-24T12:00:00.000Z'));
40
40
  });
41
41
 
@@ -70,7 +70,7 @@ describe('Test SetSchedule', () => {
70
70
  await act(async () => {
71
71
  await header.props.onPress();
72
72
  });
73
- expect(mockNavigate).toBeCalledWith(undefined);
73
+ expect(global.mockedNavigate).toBeCalledWith(undefined);
74
74
  });
75
75
 
76
76
  it('test repeat options popup', async () => {
@@ -131,7 +131,7 @@ describe('Test SetSchedule', () => {
131
131
  await act(async () => {
132
132
  await button.props.onPressMain();
133
133
  });
134
- expect(mockNavigate).toHaveBeenCalledWith(Routes.ValueChangeName, {
134
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ValueChangeName, {
135
135
  automate: {
136
136
  date_repeat: '2021-01-24',
137
137
  repeat: 'once',
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { View, TouchableOpacity } from 'react-native';
3
- import { IconOutline } from '@ant-design/icons-react-native';
3
+ import AntDesign from 'react-native-vector-icons/AntDesign';
4
4
  import Text from '../../../../commons/Text';
5
5
  import styles from '../styles/RowItemStyles';
6
6
  import { Colors } from '../../../../configs';
@@ -17,8 +17,8 @@ const RowItem = ({ title, value, icon = null, arrow = false, onPress }) => {
17
17
  </Text>
18
18
  </View>
19
19
  <View style={[styles.itemRight, arrow && styles.center]}>
20
- {arrow && <IconOutline name="right" color={Colors.Gray7} />}
21
- {icon && <IconOutline name={icon} size={17} color={Colors.Black} />}
20
+ {arrow && <AntDesign name="right" color={Colors.Gray7} />}
21
+ {icon && <AntDesign name={icon} size={17} color={Colors.Black} />}
22
22
  </View>
23
23
  </TouchableOpacity>
24
24
  );
@@ -64,4 +64,10 @@ export default StyleSheet.create({
64
64
  height: 126,
65
65
  width: (Constants.width - 40) / 2,
66
66
  },
67
+ automatesRow: {
68
+ flexDirection: 'row',
69
+ marginTop: 8,
70
+ overflow: 'hidden',
71
+ alignSelf: 'center',
72
+ },
67
73
  });
@@ -99,16 +99,16 @@ describe('Test MultiUnits', () => {
99
99
  expect(WrapHeaderScrollables[0].props.title).toEqual(
100
100
  getTranslate('en', 'multi_units_automate')
101
101
  );
102
- const TouchableOpacities = instance.findAllByType(TouchableOpacity);
102
+ const touchableOpacities = instance.findAllByType(TouchableOpacity);
103
103
  await act(async () => {
104
- TouchableOpacities[2].props.onPress();
104
+ touchableOpacities[2].props.onPress();
105
105
  });
106
106
 
107
107
  const ItemOneTaps = instance.findAllByType(ItemOneTap);
108
108
  await act(async () => {
109
109
  ItemOneTaps[0].props.onPressItem();
110
110
  });
111
- expect(mockedNavigate).toBeCalledWith(Routes.UnitStack, {
111
+ expect(global.mockedNavigate).toBeCalledWith(Routes.UnitStack, {
112
112
  screen: Routes.ScriptDetail,
113
113
  params: {
114
114
  id: response[1].id,
@@ -119,7 +119,7 @@ describe('Test MultiUnits', () => {
119
119
  await act(async () => {
120
120
  ItemAddNews[0].props.onAddNew();
121
121
  });
122
- expect(mockedNavigate).toBeCalledWith(Routes.UnitStack, {
122
+ expect(global.mockedNavigate).toBeCalledWith(Routes.UnitStack, {
123
123
  screen: Routes.AddUnknownTypeSmart,
124
124
  params: {
125
125
  automate: { unit: undefined },
@@ -192,7 +192,7 @@ describe('Test MultiUnits', () => {
192
192
  await act(async () => {
193
193
  ItemAddNews[0].props.onAddNew();
194
194
  });
195
- expect(mockedNavigate).toBeCalledWith(Routes.UnitStack, {
195
+ expect(global.mockedNavigate).toBeCalledWith(Routes.UnitStack, {
196
196
  screen: Routes.ScenarioName,
197
197
  params: {
198
198
  automate: {
@@ -250,7 +250,7 @@ describe('Test MultiUnits', () => {
250
250
  await act(async () => {
251
251
  itemAddNews[0].props.onAddNew();
252
252
  });
253
- expect(mockedNavigate).not.toBeCalled();
253
+ expect(global.mockedNavigate).not.toBeCalled();
254
254
  expect(spyToastError).toBeCalledWith(
255
255
  getTranslate('en', 'reach_max_automations_per_unit', { length: 0 }),
256
256
  '',
@@ -288,7 +288,7 @@ describe('Test MultiUnits', () => {
288
288
  await act(async () => {
289
289
  itemAddNews[0].props.onAddNew();
290
290
  });
291
- expect(mockedNavigate).not.toBeCalled();
291
+ expect(global.mockedNavigate).not.toBeCalled();
292
292
  expect(spyToastError).toBeCalledWith(
293
293
  getTranslate('en', 'no_permission_smart_script_for_multi_unit'),
294
294
  '',
@@ -49,32 +49,7 @@ describe('Test Automate', () => {
49
49
  data: [
50
50
  {
51
51
  type: 'MultiUnit',
52
- automates: [
53
- {
54
- id: 1,
55
- user: 2,
56
- type: 'one_tap',
57
- activate_at: '2021-09-17T05:30:00Z',
58
- script: {
59
- id: 1,
60
- name: 'script',
61
- icon: undefined,
62
- icon_kit: undefined,
63
- },
64
- },
65
- {
66
- id: 2,
67
- user: 2,
68
- type: 'one_tap',
69
- activate_at: '2021-09-17T05:30:00Z',
70
- script: {
71
- id: 1,
72
- name: 'script2',
73
- icon: undefined,
74
- icon_kit: undefined,
75
- },
76
- },
77
- ],
52
+ automates: [],
78
53
  },
79
54
  ],
80
55
  };
@@ -98,14 +73,14 @@ describe('Test Automate', () => {
98
73
 
99
74
  const instance = tree.root;
100
75
  const FlatLists = instance.findAllByType(FlatList);
101
- expect(FlatLists).toHaveLength(2);
76
+ expect(FlatLists).toHaveLength(1); // only 1 flat list
102
77
 
103
78
  const ItemAddNews = instance.findAllByType(ItemAddNew);
104
79
  expect(ItemAddNews).toHaveLength(1);
105
80
  await act(async () => {
106
81
  ItemAddNews[0].props.onAddNew('MultiUnit');
107
82
  });
108
- expect(mockedNavigate).toBeCalledWith(Routes.UnitStack, {
83
+ expect(global.mockedNavigate).toBeCalledWith(Routes.UnitStack, {
109
84
  screen: Routes.AddUnknownTypeSmart,
110
85
  params: {
111
86
  closeScreen: undefined,
@@ -146,7 +121,7 @@ describe('Test Automate', () => {
146
121
  await act(async () => {
147
122
  itemAddNew.props.onAddNew(1, []);
148
123
  });
149
- expect(mockedNavigate).not.toBeCalled();
124
+ expect(global.mockedNavigate).not.toBeCalled();
150
125
  expect(spyToastError).toBeCalledWith(
151
126
  getTranslate('en', 'reach_max_automations_per_unit', { length: 0 }),
152
127
  '',
@@ -186,14 +161,14 @@ describe('Test Automate', () => {
186
161
 
187
162
  const instance = tree.root;
188
163
  const FlatLists = instance.findAllByType(FlatList);
189
- expect(FlatLists).toHaveLength(3);
164
+ expect(FlatLists).toHaveLength(1); // only 1 flat list
190
165
  const ItemOneTaps = instance.findAllByType(ItemOneTap);
191
166
  expect(ItemOneTaps).toHaveLength(1);
192
167
  await act(async () => {
193
168
  await ItemOneTaps[0].props.onPressItem();
194
169
  });
195
170
 
196
- expect(mockedNavigate).toBeCalledWith(Routes.UnitStack, {
171
+ expect(global.mockedNavigate).toBeCalledWith(Routes.UnitStack, {
197
172
  screen: Routes.ScriptDetail,
198
173
  params: {
199
174
  preAutomate: response.data[0].automates[0],
@@ -246,7 +221,7 @@ describe('Test Automate', () => {
246
221
  await iconArrowRight[0].props.onPress();
247
222
  });
248
223
 
249
- expect(mockedNavigate).toBeCalledWith(Routes.MultiUnits, {
224
+ expect(global.mockedNavigate).toBeCalledWith(Routes.MultiUnits, {
250
225
  unit: { id: undefined, name: '' },
251
226
  });
252
227
 
@@ -255,7 +230,7 @@ describe('Test Automate', () => {
255
230
  await iconArrowRight[1].props.onPress();
256
231
  });
257
232
 
258
- expect(mockedNavigate).toBeCalledWith(Routes.MultiUnits, {
233
+ expect(global.mockedNavigate).toBeCalledWith(Routes.MultiUnits, {
259
234
  unit: { id: 3, name: 'La Vida' },
260
235
  });
261
236
  });
@@ -292,7 +267,7 @@ describe('Test Automate', () => {
292
267
  await act(async () => {
293
268
  itemAddNew.props.onAddNew(1, []);
294
269
  });
295
- expect(mockedNavigate).not.toBeCalled();
270
+ expect(global.mockedNavigate).not.toBeCalled();
296
271
  expect(spyToastError).toBeCalledWith(
297
272
  getTranslate('en', 'no_permission_smart_script_for_multi_unit'),
298
273
  '',
@@ -6,7 +6,7 @@ import React, {
6
6
  useState,
7
7
  } from 'react';
8
8
  import { FlatList, Image, TouchableOpacity, View } from 'react-native';
9
- import { IconFill } from '@ant-design/icons-react-native/es';
9
+ import AntDesign from 'react-native-vector-icons/AntDesign';
10
10
  import {
11
11
  useIsFocused,
12
12
  useNavigation,
@@ -58,7 +58,14 @@ const Automate = () => {
58
58
  setIsLoading(true);
59
59
  const { success, data } = await axiosGet(API.AUTOMATE.GET_SMART());
60
60
  if (success && data && data.length) {
61
- setAutomatesData(data);
61
+ const multiUnit = data[0];
62
+ const haveAutomates = data
63
+ .slice(1)
64
+ .filter((unit) => unit.automates.length);
65
+ const notHaveAutomates = data
66
+ .slice(1)
67
+ .filter((unit) => !unit.automates.length);
68
+ setAutomatesData([multiUnit, ...haveAutomates, ...notHaveAutomates]);
62
69
  }
63
70
  setIsLoading(false);
64
71
  }, []);
@@ -137,16 +144,6 @@ const Automate = () => {
137
144
  const isOwner = owner_unit_id
138
145
  ? owner_unit_id === idUser
139
146
  : type === UNIT_TYPES.MULTI;
140
- const renderItemAutomate = ({ item: automate }) => {
141
- return (
142
- <ItemOneTap
143
- isOwner={isOwner}
144
- automate={automate}
145
- wrapSyles={styles.wrapAutomateItem}
146
- onPressItem={() => onPressItem(automate, unit_id, type, isOwner)}
147
- />
148
- );
149
- };
150
147
 
151
148
  return (
152
149
  <View style={styles.wrapUniItem}>
@@ -167,16 +164,29 @@ const Automate = () => {
167
164
  <Image source={Images.arrowBack} style={styles.arrowRight} />
168
165
  </TouchableOpacity>
169
166
  </View>
170
- <FlatList
171
- horizontal
172
- keyExtractor={keyExtractor}
173
- data={automates}
174
- renderItem={renderItemAutomate}
175
- showsHorizontalScrollIndicator={false}
176
- contentContainerStyle={styles.contentContainerStyle2}
177
- ListFooterComponent={renderListFooterComponent(unit_id, automates)}
178
- scrollIndicatorInsets={{ right: 1 }}
179
- />
167
+ {!!automates?.length && (
168
+ <View style={styles.automatesRow}>
169
+ <ItemOneTap
170
+ isOwner={isOwner}
171
+ automate={automates[0]}
172
+ wrapSyles={styles.wrapAutomateItem}
173
+ onPressItem={() =>
174
+ onPressItem(automates[0], unit_id, type, isOwner)
175
+ }
176
+ />
177
+ {!!automates[1] && (
178
+ <ItemOneTap
179
+ isOwner={isOwner}
180
+ automate={automates[1]}
181
+ wrapSyles={styles.wrapAutomateItem}
182
+ onPressItem={() =>
183
+ onPressItem(automates[1], unit_id, type, isOwner)
184
+ }
185
+ />
186
+ )}
187
+ </View>
188
+ )}
189
+ {!automates?.length && renderListFooterComponent(unit_id, automates)}
180
190
  </View>
181
191
  );
182
192
  },
@@ -184,12 +194,15 @@ const Automate = () => {
184
194
  [sortedAutomateData]
185
195
  );
186
196
 
187
- const renderListFooterComponent = (unitId, automates) => (
188
- <ItemAddNew
189
- title={t('add_new')}
190
- onAddNew={() => handleOnAddNew(unitId, automates)}
191
- wrapStyle={styles.addNewItem}
192
- />
197
+ const renderListFooterComponent = useCallback(
198
+ (unitId, automates) => (
199
+ <ItemAddNew
200
+ title={t('add_new')}
201
+ onAddNew={() => handleOnAddNew(unitId, automates)}
202
+ wrapStyle={styles.addNewItem}
203
+ />
204
+ ),
205
+ [handleOnAddNew, t]
193
206
  );
194
207
 
195
208
  useLayoutEffect(() => {
@@ -197,20 +210,19 @@ const Automate = () => {
197
210
  /* istanbul ignore next */
198
211
  headerRight: () => (
199
212
  <TouchableOpacity style={styles.buttonAdd}>
200
- <IconFill name={'plus-circle'} size={28} color={Colors.Orange} />
213
+ <AntDesign name={'pluscircle'} size={28} color={Colors.Orange} />
201
214
  </TouchableOpacity>
202
215
  ),
203
216
  });
204
217
  }, [setOptions]);
205
218
 
206
219
  useEffect(() => {
207
- getAutomates();
208
- // eslint-disable-next-line react-hooks/exhaustive-deps
209
- }, [isFocused]);
220
+ isFocused && getAutomates();
221
+ }, [isFocused, getAutomates]);
210
222
 
211
223
  return (
212
224
  <View style={styles.wrap}>
213
- {isLoading && !sortedAutomateData?.length && <Loading />}
225
+ {isLoading && <Loading />}
214
226
  <FlatList
215
227
  keyExtractor={keyExtractor}
216
228
  data={sortedAutomateData}
@@ -220,6 +232,11 @@ const Automate = () => {
220
232
  refreshing={false}
221
233
  onRefresh={getAutomates}
222
234
  scrollIndicatorInsets={{ right: 1 }}
235
+ getItemLayout={(data, index) => ({
236
+ length: 180,
237
+ offset: 180 * index,
238
+ index,
239
+ })}
223
240
  />
224
241
  </View>
225
242
  );
@@ -13,20 +13,8 @@ import { ToastBottomHelper } from '../../../utils/Utils';
13
13
  import BottomButtonView from '../../../commons/BottomButtonView';
14
14
 
15
15
  const mock = new MockAdapter(api.axiosInstance);
16
- const mockGoBack = jest.fn();
17
16
  const mockSetDisplay = jest.fn();
18
17
 
19
- jest.mock('@react-navigation/native', () => {
20
- return {
21
- ...jest.requireActual('@react-navigation/native'),
22
- useRoute: jest.fn(),
23
-
24
- useNavigation: () => ({
25
- goBack: mockGoBack,
26
- }),
27
- };
28
- });
29
-
30
18
  const wrapComponent = ({ ...rest }) => (
31
19
  <SCProvider initState={mockSCStore({})}>
32
20
  <ChangePosition {...rest} />
@@ -38,7 +26,6 @@ describe('Test ChangePosition', () => {
38
26
 
39
27
  beforeEach(() => {
40
28
  useRoute.mockClear();
41
- mockGoBack.mockClear();
42
29
  });
43
30
 
44
31
  it('render ChangePosition', async () => {
@@ -70,7 +57,7 @@ describe('Test ChangePosition', () => {
70
57
  await act(async () => {
71
58
  bottomButtonView[0].props.onPressMain();
72
59
  });
73
- expect(mockGoBack).toHaveBeenCalled();
60
+ expect(global.mockedGoBack).toHaveBeenCalled();
74
61
  expect(mockFetchData).toHaveBeenCalled();
75
62
  expect(mockSetDisplay).toHaveBeenCalled();
76
63
  expect(spyToastSuccess).toBeCalledWith('Updated widget successfully');
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React from 'react';
2
2
  import renderer, { act } from 'react-test-renderer';
3
3
 
4
4
  import { SCProvider } from '../../../context';
@@ -18,26 +18,6 @@ const wrapComponent = (route, navigation) => (
18
18
  </SCProvider>
19
19
  );
20
20
 
21
- const mockNavigate = jest.fn();
22
- const mockGoBack = jest.fn();
23
- jest.mock('@react-navigation/native', () => {
24
- return {
25
- ...jest.requireActual('@react-navigation/native'),
26
- useNavigation: () => ({
27
- navigate: mockNavigate,
28
- goBack: mockGoBack,
29
- }),
30
- };
31
- });
32
-
33
- const mockSetState = jest.fn();
34
- jest.mock('react', () => {
35
- return {
36
- ...jest.requireActual('react'),
37
- useState: jest.fn((init) => [init, mockSetState]),
38
- };
39
- });
40
-
41
21
  describe('Test ConfirmUnitDeletion', () => {
42
22
  let tree;
43
23
  let route;
@@ -53,7 +33,6 @@ describe('Test ConfirmUnitDeletion', () => {
53
33
  });
54
34
 
55
35
  it('test render ConfirmUnitDeletion', async () => {
56
- useState.mockImplementationOnce((init) => ['new_name', mockSetState]);
57
36
  await act(async () => {
58
37
  tree = await renderer.create(wrapComponent(route));
59
38
  });
@@ -65,7 +44,6 @@ describe('Test ConfirmUnitDeletion', () => {
65
44
  });
66
45
  });
67
46
  it('Onpress button ConfirmUnitDeletion ', async () => {
68
- useState.mockImplementationOnce((init) => ['YES', mockSetState]);
69
47
  await act(async () => {
70
48
  tree = await renderer.create(wrapComponent(route));
71
49
  });