@eohjsc/react-native-smart-city 0.7.3 → 0.7.4

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 (274) hide show
  1. package/assets/images/Automation-fill.svg +85 -0
  2. package/assets/images/Map/LocationPin.svg +10 -0
  3. package/assets/images/Scenario-filled.svg +22 -0
  4. package/assets/images/schedule-fill.svg +48 -0
  5. package/package.json +20 -17
  6. package/src/commons/Action/ItemQuickAction.js +1 -1
  7. package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -6
  8. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
  9. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
  10. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +5 -5
  11. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
  12. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  13. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
  14. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
  15. package/src/commons/ActionGroup/SliderRangeTemplate.js +7 -7
  16. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
  17. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
  18. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
  19. package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
  20. package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
  21. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +2 -2
  22. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +2 -2
  23. package/src/commons/ActionGroup/TimerActionTemplate.js +6 -3
  24. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
  25. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +9 -10
  26. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +5 -5
  27. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -5
  28. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +8 -8
  29. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +3 -3
  30. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -6
  31. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -1
  32. package/src/commons/ActionGroup/__test__/index.test.js +6 -6
  33. package/src/commons/ActionGroup/index.js +2 -2
  34. package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
  35. package/src/commons/Automate/ItemAutomate.js +9 -41
  36. package/src/commons/Automate/ItemConditionScriptDetail.js +109 -0
  37. package/src/commons/Automate/ItemConditionScriptDetailStyles.js +46 -0
  38. package/src/commons/Automate/__test__/ItemAutomate.test.js +0 -21
  39. package/src/commons/BackDefault/index.js +2 -2
  40. package/src/commons/BottomButtonView/index.js +1 -0
  41. package/src/commons/ButtonPopup/index.js +3 -2
  42. package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
  43. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
  44. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
  45. package/src/commons/DateTimeRangeChange/DateTimeButton.js +3 -3
  46. package/src/commons/DateTimeRangeChange/index.js +1 -1
  47. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  48. package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
  49. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
  50. package/src/commons/Device/FlatListItems.js +20 -19
  51. package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
  52. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
  53. package/src/commons/Device/HorizontalBarChart.js +54 -34
  54. package/src/commons/Device/ItemAddNew/index.js +2 -2
  55. package/src/commons/Device/ItemDevice.js +5 -21
  56. package/src/commons/Device/SonosSpeaker/index.js +3 -3
  57. package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
  58. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +6 -2
  59. package/src/commons/DisplayChecking/index.js +2 -2
  60. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  61. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  62. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
  63. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
  64. package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
  65. package/src/commons/FlatListDnD/index.js +12 -9
  66. package/src/commons/Grid/GridItem.js +10 -2
  67. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
  68. package/src/commons/Header/HeaderCustom.js +2 -2
  69. package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
  70. package/src/commons/HeaderAni/index.js +2 -2
  71. package/src/commons/IconComponent/index.js +3 -3
  72. package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
  73. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
  74. package/src/commons/MenuActionMore/MenuActionMoreStyles.js +2 -1
  75. package/src/commons/MenuActionMore/index.js +1 -1
  76. package/src/commons/NavBar/NavBarStyles.js +1 -1
  77. package/src/commons/NavBar/index.js +2 -2
  78. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  79. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +1 -1
  80. package/src/commons/Popover/__test__/index.test.js +3 -3
  81. package/src/commons/Processing/__test__/Connecting.test.js +4 -4
  82. package/src/commons/SearchLocation/index.js +3 -3
  83. package/src/commons/SelectActionCard/index.js +2 -2
  84. package/src/commons/SelectSubUnit/index.js +6 -2
  85. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
  86. package/src/commons/Sharing/BtnRemoveMember.js +2 -2
  87. package/src/commons/Sharing/StationDevicePermissions.js +2 -2
  88. package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
  89. package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
  90. package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
  91. package/src/commons/SubUnit/OneTap/ItemOneTap.js +6 -7
  92. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +0 -2
  93. package/src/commons/SubUnit/OneTap/index.js +9 -8
  94. package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
  95. package/src/commons/Unit/HeaderUnit/index.js +30 -22
  96. package/src/commons/Unit/SharedUnit.js +7 -7
  97. package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
  98. package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +34 -2
  99. package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +88 -8
  100. package/src/commons/WrapParallaxScrollView/index.js +9 -10
  101. package/src/configs/API.js +1 -1
  102. package/src/configs/AccessibilityLabel.js +1 -0
  103. package/src/configs/Constants.js +3 -3
  104. package/src/configs/Theme.js +1 -1
  105. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
  106. package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
  107. package/src/hooks/IoT/__test__/useRemoteControl.test.js +14 -7
  108. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
  109. package/src/hooks/IoT/useRemoteControl.js +24 -13
  110. package/src/hooks/useMqtt.js +2 -2
  111. package/src/iot/RemoteControl/Bluetooth.js +19 -22
  112. package/src/iot/RemoteControl/Internet.js +13 -5
  113. package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
  114. package/src/navigations/EmergencyContactsStack.js +4 -3
  115. package/src/navigations/SharedStack.js +2 -0
  116. package/src/navigations/UnitStack.js +56 -57
  117. package/src/screens/AQIGuide/index.js +0 -2
  118. package/src/screens/ActivityLog/index.js +2 -2
  119. package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
  120. package/src/screens/AddLocationMaps/index.js +16 -19
  121. package/src/screens/AddLocationMaps/indexStyle.js +1 -0
  122. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  123. package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
  124. package/src/screens/AddNewGateway/ShareWifiPassword.js +16 -15
  125. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
  126. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
  127. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
  128. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
  129. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
  130. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
  131. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
  132. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
  133. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +0 -4
  134. package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
  135. package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
  136. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
  137. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
  138. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
  139. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
  140. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +38 -22
  141. package/src/screens/AllGateway/__test__/index.test.js +6 -6
  142. package/src/screens/AllGateway/components/Detail/__test__/index.test.js +3 -5
  143. package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
  144. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
  145. package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
  146. package/src/screens/AllGateway/test-utils.js +3 -4
  147. package/src/screens/Automate/AddNewAction/ChooseAction.js +17 -3
  148. package/src/screens/Automate/AddNewAction/ChooseConfig.js +7 -6
  149. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +8 -8
  150. package/src/screens/Automate/AddNewAction/SelectControlDevices.js +30 -20
  151. package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +17 -10
  152. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +58 -44
  153. package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +1 -1
  154. package/src/screens/Automate/AddNewAction/SetupScriptNotify.js +3 -3
  155. package/src/screens/Automate/AddNewAction/Styles/SetupSensorStyles.js +20 -4
  156. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +12 -12
  157. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
  158. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
  159. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +54 -15
  160. package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
  161. package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +39 -10
  162. package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +10 -10
  163. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
  164. package/src/screens/Automate/Components/InputName.js +10 -7
  165. package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
  166. package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
  167. package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
  168. package/src/screens/Automate/EditActionsList/index.js +19 -17
  169. package/src/screens/Automate/MultiUnits.js +19 -22
  170. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +18 -8
  171. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
  172. package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +14 -6
  173. package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
  174. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +42 -17
  175. package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
  176. package/src/screens/Automate/ScriptDetail/index.js +51 -40
  177. package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
  178. package/src/screens/Automate/SetSchedule/__test__/index.test.js +29 -18
  179. package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
  180. package/src/screens/Automate/SetSchedule/index.js +8 -7
  181. package/src/screens/Automate/Styles/indexStyles.js +1 -1
  182. package/src/screens/Automate/__test__/MultiUnits.test.js +1 -4
  183. package/src/screens/Automate/__test__/index.test.js +0 -1
  184. package/src/screens/Automate/index.js +36 -34
  185. package/src/screens/ChangePosition/__test__/index.test.js +6 -6
  186. package/src/screens/ChangePosition/index.js +2 -1
  187. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +13 -13
  188. package/src/screens/Device/EditDevice/index.js +4 -4
  189. package/src/screens/Device/__test__/BluetoothDevice.test.js +300 -0
  190. package/src/screens/Device/__test__/detail.test.js +14 -14
  191. package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
  192. package/src/screens/Device/components/BluetoothDevice.js +135 -0
  193. package/src/screens/Device/components/SensorDisplayItem.js +9 -8
  194. package/src/screens/Device/detail.js +70 -62
  195. package/src/screens/Device/hooks/useEvaluateValue.js +1 -1
  196. package/src/screens/Drawer/Drawer.test.js +2 -2
  197. package/src/screens/Drawer/index.js +3 -3
  198. package/src/screens/EmergencyContacts/EmergencyContactsList.js +8 -4
  199. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
  200. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
  201. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  202. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
  203. package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
  204. package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
  205. package/src/screens/GuestInfo/index.js +2 -2
  206. package/src/screens/HanetCamera/ManageAccess.js +3 -3
  207. package/src/screens/HanetCamera/MemberInfo.js +2 -2
  208. package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
  209. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
  210. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  211. package/src/screens/ManageAccess/index.js +3 -3
  212. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
  213. package/src/screens/Notification/__test__/Notification.test.js +9 -9
  214. package/src/screens/Notification/components/NotificationItem.js +3 -4
  215. package/src/screens/Notification/index.js +3 -3
  216. package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
  217. package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
  218. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
  219. package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
  220. package/src/screens/SelectUnit/__test__/index.test.js +8 -8
  221. package/src/screens/SelectUnit/index.js +4 -4
  222. package/src/screens/SharedUnit/TabHeader.js +2 -2
  223. package/src/screens/Sharing/Components/EndDevice.js +3 -3
  224. package/src/screens/Sharing/UnitMemberList.js +2 -2
  225. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +7 -7
  226. package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
  227. package/src/screens/SmartAccount/Connecting/index.js +5 -5
  228. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
  229. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
  230. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +2 -2
  231. package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
  232. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
  233. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +3 -2
  234. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -2
  235. package/src/screens/SmartIr/components/SelectBrand.js +2 -2
  236. package/src/screens/SubUnit/AddSubUnit.js +28 -26
  237. package/src/screens/SubUnit/AddSubUnitStyles.js +10 -4
  238. package/src/screens/SubUnit/EditSubUnit.js +12 -11
  239. package/src/screens/SubUnit/ManageSubUnit.js +3 -3
  240. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +13 -13
  241. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +3 -3
  242. package/src/screens/Template/EditTemplate.js +6 -4
  243. package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
  244. package/src/screens/Template/__test__/detail.test.js +4 -4
  245. package/src/screens/Template/__test__/index.test.js +1 -1
  246. package/src/screens/UVIndexGuide/index.js +2 -4
  247. package/src/screens/Unit/Detail.js +1 -5
  248. package/src/screens/Unit/MoreMenu.js +6 -5
  249. package/src/screens/Unit/SelectAddToFavorites.js +2 -2
  250. package/src/screens/Unit/SelectAddress.js +16 -12
  251. package/src/screens/Unit/Station/__test__/index.test.js +1 -1
  252. package/src/screens/Unit/__test__/MoreMenu.test.js +5 -1
  253. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
  254. package/src/screens/Unit/__test__/SelectAddress.test.js +11 -17
  255. package/src/screens/Unit/__test__/Summaries.test.js +7 -7
  256. package/src/screens/Unit/components/AutomateScript/index.js +5 -5
  257. package/src/screens/Unit/components/ButtonWrapper/index.js +3 -3
  258. package/src/screens/Unit/components/Header/index.js +2 -2
  259. package/src/screens/Unit/components/SharedUnit/index.js +5 -5
  260. package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
  261. package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
  262. package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
  263. package/src/screens/UnitSummary/components/AirQuality/index.js +6 -11
  264. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +5 -5
  265. package/src/screens/UnitSummary/index.js +6 -2
  266. package/src/utils/Apis/axios.js +5 -5
  267. package/src/utils/Functions/ShortEmail.js +1 -0
  268. package/src/utils/I18n/translations/en.js +6 -3
  269. package/src/utils/I18n/translations/vi.js +8 -4
  270. package/src/utils/__test__/Utils.test.js +16 -16
  271. package/src/utils/bluetooth.js +3 -0
  272. package/assets/images/OneTap.svg +0 -14
  273. package/assets/images/Schedule.svg +0 -39
  274. package/assets/images/ValueChange.svg +0 -49
@@ -1,17 +1,17 @@
1
+ import { useNavigation, useRoute } from '@react-navigation/native';
2
+ import MockAdapter from 'axios-mock-adapter';
1
3
  import React from 'react';
4
+ import { TouchableOpacity } from 'react-native';
2
5
  import renderer, { act } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
- import { SCProvider } from '../../../../context';
5
- import { mockSCStore } from '../../../../context/mockStore';
6
- import Device from '../Device';
7
6
  import NavBar from '../../../../commons/NavBar';
8
7
  import API from '../../../../configs/API';
9
8
  import { AccessibilityLabel } from '../../../../configs/Constants';
10
- import { TouchableOpacity } from 'react-native';
11
- import Routes from '../../../../utils/Route';
9
+ import { SCProvider } from '../../../../context';
10
+ import { mockSCStore } from '../../../../context/mockStore';
12
11
  import api from '../../../../utils/Apis/axios';
12
+ import Routes from '../../../../utils/Route';
13
+ import Device from '../Device';
13
14
  import SelectControlDevices from '../SelectControlDevices';
14
- import { useNavigation, useRoute } from '@react-navigation/native';
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
17
 
@@ -108,6 +108,12 @@ describe('Test SelectMonitorDevices', () => {
108
108
  await act(async () => {
109
109
  iconClose[0].props.onPress();
110
110
  });
111
- expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail);
111
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail, {
112
+ automate: { sensor_id: 1 },
113
+ automateId: 1,
114
+ closeScreen: 'ScriptDetail',
115
+ scriptName: 'scriptName test',
116
+ unitId: 1,
117
+ });
112
118
  });
113
119
  });
@@ -1,15 +1,15 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import renderer, { act } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
4
 
5
- import SelectMonitorDevices from '../SelectMonitorDevices';
6
- import { SCProvider } from '../../../../context';
7
- import { mockSCStore } from '../../../../context/mockStore';
5
+ import { useRoute } from '@react-navigation/native';
6
+ import { TouchableOpacity } from 'react-native';
8
7
  import API from '../../../../configs/API';
9
8
  import { AccessibilityLabel } from '../../../../configs/Constants';
10
- import { TouchableOpacity } from 'react-native';
9
+ import { SCProvider } from '../../../../context';
10
+ import { mockSCStore } from '../../../../context/mockStore';
11
11
  import api from '../../../../utils/Apis/axios';
12
- import { useRoute } from '@react-navigation/native';
12
+ import SelectMonitorDevices from '../SelectMonitorDevices';
13
13
 
14
14
  const mock = new MockAdapter(api.axiosInstance);
15
15
 
@@ -70,6 +70,12 @@ describe('Test SelectMonitorDevices', () => {
70
70
  await act(async () => {
71
71
  iconClose[0].props.onPress();
72
72
  });
73
- expect(global.mockedNavigate).toHaveBeenCalledWith('closeScreen');
73
+ expect(global.mockedNavigate).toHaveBeenCalledWith('closeScreen', {
74
+ automate: { sensor_id: 1 },
75
+ automateId: null,
76
+ closeScreen: 'closeScreen',
77
+ scriptName: 'scriptName test',
78
+ unit: { id: 1, name: 'Unit test' },
79
+ });
74
80
  });
75
81
  });
@@ -1,18 +1,17 @@
1
+ import { useRoute } from '@react-navigation/native';
1
2
  import React from 'react';
3
+ import { TouchableWithoutFeedback } from 'react-native';
2
4
  import { act, create } from 'react-test-renderer';
3
- import { SCProvider } from '../../../../context';
4
- import { mockSCStore } from '../../../../context/mockStore';
5
- import SetupConfigCondition from '../SetupConfigCondition';
6
- import { useRoute } from '@react-navigation/native';
7
- import { ToastBottomHelper } from '../../../../utils/Utils';
8
5
  import { Text } from '../../../../commons';
9
- import GridItem from '../../../../commons/Grid/GridItem';
10
- import { TouchableWithoutFeedback } from 'react-native';
11
- import Routes from '../../../../utils/Route';
12
- import { ModalCustom } from '../../../../commons/Modal';
13
6
  import { showAllGridItems } from '../../../../commons/ActionTemplate/__test__/utils';
14
7
  import TextInput from '../../../../commons/Form/TextInput';
15
- import CheckBox from '@react-native-community/checkbox';
8
+ import GridItem from '../../../../commons/Grid/GridItem';
9
+ import { ModalCustom } from '../../../../commons/Modal';
10
+ import { SCProvider } from '../../../../context';
11
+ import { mockSCStore } from '../../../../context/mockStore';
12
+ import Routes from '../../../../utils/Route';
13
+ import { ToastBottomHelper } from '../../../../utils/Utils';
14
+ import SetupConfigCondition from '../SetupConfigCondition';
16
15
 
17
16
  jest.mock('react', () => {
18
17
  return {
@@ -57,7 +56,6 @@ describe('Test SetupConfigCondition', () => {
57
56
  name: 'config name',
58
57
  decimal_behind: 0,
59
58
  title: 'is below (<)',
60
- sensor_type: 'air_quality',
61
59
  value_evaluations: [
62
60
  {
63
61
  id: 1,
@@ -108,6 +106,7 @@ describe('Test SetupConfigCondition', () => {
108
106
  },
109
107
  ],
110
108
  },
109
+ automate: {},
111
110
  sensorData: [],
112
111
  },
113
112
  });
@@ -130,9 +129,9 @@ describe('Test SetupConfigCondition', () => {
130
129
  id: 1,
131
130
  name: 'config name',
132
131
  title: 'is below (<)',
133
- sensor_type: 'air_quality',
134
132
  value_evaluations: [BOOLEAN_VALUE_EVALUATION_CONFIGURATION],
135
133
  },
134
+ automate: {},
136
135
  sensorData: [],
137
136
  },
138
137
  });
@@ -158,7 +157,6 @@ describe('Test SetupConfigCondition', () => {
158
157
  id: 1,
159
158
  name: 'config name',
160
159
  title: 'is below (<)',
161
- sensor_type: 'air_quality',
162
160
  value_evaluations: [BOOLEAN_VALUE_EVALUATION_CONFIGURATION],
163
161
  },
164
162
  sensorData: [],
@@ -214,8 +212,10 @@ describe('Test SetupConfigCondition', () => {
214
212
  });
215
213
  expect(modal.props.isVisible).toBeFalsy();
216
214
 
215
+ const modalGridItems = instance.findAllByType(GridItem);
216
+
217
217
  await act(async () => {
218
- instance.findAllByType(CheckBox)[0].props.onChange();
218
+ modalGridItems[1].findByType(TouchableWithoutFeedback).props.onPress();
219
219
  });
220
220
 
221
221
  const input = instance.findByType(TextInput);
@@ -249,7 +249,6 @@ describe('Test SetupConfigCondition', () => {
249
249
  name: 'config name',
250
250
  decimal_behind: 0,
251
251
  title: 'is below (<)',
252
- sensor_type: 'air_quality',
253
252
  },
254
253
  automate: {},
255
254
  },
@@ -286,4 +285,44 @@ describe('Test SetupConfigCondition', () => {
286
285
  'Please enter a number and select a condition'
287
286
  );
288
287
  });
288
+
289
+ it('Test render when have input number but not select condition', async () => {
290
+ await testConditionValue(
291
+ '123',
292
+ 'Please enter a number and select a condition'
293
+ );
294
+ });
295
+
296
+ it('Test render when have input empty', async () => {
297
+ await testConditionValue(
298
+ '',
299
+ 'Please enter a number and select a condition'
300
+ );
301
+ });
302
+
303
+ it('Test render when no value evaluations', async () => {
304
+ useRoute.mockReturnValue({
305
+ params: {
306
+ config: {
307
+ id: 1,
308
+ name: 'config name',
309
+ title: 'is below (<)',
310
+ sensor_type: 'air_quality',
311
+ value_evaluations: [],
312
+ },
313
+ automate: {},
314
+ sensorData: [],
315
+ },
316
+ });
317
+ await act(async () => {
318
+ tree = await create(wrapComponent());
319
+ });
320
+ const instance = tree.root;
321
+
322
+ const gridItems = instance.findAllByType(GridItem);
323
+ expect(gridItems).toHaveLength(1);
324
+ expect(gridItems[0].findByType(Text).props.children).toEqual(
325
+ 'Customize conditions'
326
+ );
327
+ });
289
328
  });
@@ -1,17 +1,17 @@
1
+ import { useNavigation, useRoute } from '@react-navigation/native';
2
+ import MockAdapter from 'axios-mock-adapter';
1
3
  import React from 'react';
4
+ import { TouchableWithoutFeedback } from 'react-native';
2
5
  import renderer, { act } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
6
+ import BottomButtonView from '../../../../commons/BottomButtonView';
7
+ import _TextInput from '../../../../commons/Form/TextInput';
8
+ import API from '../../../../configs/API';
4
9
  import { SCProvider } from '../../../../context';
5
10
  import { mockSCStore } from '../../../../context/mockStore';
6
- import API from '../../../../configs/API';
7
- import Routes from '../../../../utils/Route';
8
11
  import api from '../../../../utils/Apis/axios';
9
- import { useNavigation, useRoute } from '@react-navigation/native';
10
- import _TextInput from '../../../../commons/Form/TextInput';
11
- import BottomButtonView from '../../../../commons/BottomButtonView';
12
+ import Routes from '../../../../utils/Route';
12
13
  import { ToastBottomHelper } from '../../../../utils/Utils';
13
14
  import SetupScriptDelay from '../SetupScriptDelay';
14
- import { TouchableWithoutFeedback } from 'react-native';
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
17
 
@@ -75,7 +75,7 @@ describe('Test SetupScriptDelay', () => {
75
75
  await act(async () => {
76
76
  button.props.onPressMain();
77
77
  });
78
- expect(spyToast).toBeCalled();
78
+ expect(spyToast).toHaveBeenCalled();
79
79
  });
80
80
 
81
81
  it('SetupScriptDelay onPress create script notify error', async () => {
@@ -95,6 +95,6 @@ describe('Test SetupScriptDelay', () => {
95
95
  await act(async () => {
96
96
  button.props.onPressMain();
97
97
  });
98
- expect(spyToast).toBeCalled();
98
+ expect(spyToast).toHaveBeenCalled();
99
99
  });
100
100
  });
@@ -1,17 +1,17 @@
1
+ import { useNavigation, useRoute } from '@react-navigation/native';
2
+ import MockAdapter from 'axios-mock-adapter';
1
3
  import React from 'react';
4
+ import { TouchableWithoutFeedback } from 'react-native';
2
5
  import renderer, { act } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
6
+ import BottomButtonView from '../../../../commons/BottomButtonView';
7
+ import _TextInput from '../../../../commons/Form/TextInput';
8
+ import API from '../../../../configs/API';
4
9
  import { SCProvider } from '../../../../context';
5
10
  import { mockSCStore } from '../../../../context/mockStore';
6
- import API from '../../../../configs/API';
7
- import Routes from '../../../../utils/Route';
8
11
  import api from '../../../../utils/Apis/axios';
9
- import { useNavigation, useRoute } from '@react-navigation/native';
10
- import SetupScriptNotify from '../SetupScriptNotify';
11
- import _TextInput from '../../../../commons/Form/TextInput';
12
- import BottomButtonView from '../../../../commons/BottomButtonView';
12
+ import Routes from '../../../../utils/Route';
13
13
  import { ToastBottomHelper } from '../../../../utils/Utils';
14
- import { TouchableWithoutFeedback } from 'react-native';
14
+ import SetupScriptNotify from '../SetupScriptNotify';
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
17
 
@@ -66,7 +66,36 @@ describe('Test SetupScriptNotify', () => {
66
66
  await act(async () => {
67
67
  button.props.onPressMain();
68
68
  });
69
- expect(spyToast).toBeCalled();
69
+ expect(spyToast).toHaveBeenCalled();
70
+ });
71
+
72
+ it('SetupScriptNotify onPress create script notify success with multi unit', async () => {
73
+ route.params.unitId = null;
74
+ route.params.multiUnit = { id: 1 };
75
+ const spyToast = jest.spyOn(ToastBottomHelper, 'success');
76
+ mock.onPost(API.AUTOMATE.ADD_SCRIPT_NOTIFY(1)).reply(200);
77
+ await act(async () => {
78
+ tree = await renderer.create(wrapComponent(route));
79
+ });
80
+ const instance = tree.root;
81
+ const inputs = instance.findAllByType(_TextInput);
82
+ expect(inputs).toHaveLength(2);
83
+
84
+ await act(async () => {
85
+ inputs[0].props.onChange('Title');
86
+ });
87
+ const touchable = instance.findAllByType(TouchableWithoutFeedback);
88
+ await act(async () => {
89
+ touchable[0].props.onPress();
90
+ });
91
+ await act(async () => {
92
+ inputs[1].props.onChange('Message');
93
+ });
94
+ const button = instance.findByType(BottomButtonView);
95
+ await act(async () => {
96
+ button.props.onPressMain();
97
+ });
98
+ expect(spyToast).toHaveBeenCalled();
70
99
  });
71
100
 
72
101
  it('SetupScriptNotify onPress create script notify error', async () => {
@@ -87,6 +116,6 @@ describe('Test SetupScriptNotify', () => {
87
116
  await act(async () => {
88
117
  button.props.onPressMain();
89
118
  });
90
- expect(spyToast).toBeCalled();
119
+ expect(spyToast).toHaveBeenCalled();
91
120
  });
92
121
  });
@@ -1,22 +1,22 @@
1
+ import { useNavigation } from '@react-navigation/native';
1
2
  import React, { useCallback, useState } from 'react';
2
3
  import { View } from 'react-native';
3
- import { useNavigation } from '@react-navigation/native';
4
+ import ItemAutomate from '../../../commons/Automate/ItemAutomate';
4
5
  import { HeaderCustom } from '../../../commons/Header';
5
- import styles from './styles/AddNewAutoSmartStyles';
6
6
  import Text from '../../../commons/Text';
7
- import ItemAutomate from '../../../commons/Automate/ItemAutomate';
8
7
  import { useTranslations } from '../../../hooks/Common/useTranslations';
9
8
  import Routes from '../../../utils/Route';
9
+ import styles from './styles/AddNewAutoSmartStyles';
10
+ import { AUTOMATE_TYPE } from '../../../configs/Constants';
10
11
 
11
12
  const AddTypeSmart = ({ smartTypes, route }) => {
12
13
  const t = useTranslations();
13
14
  const { navigate, goBack } = useNavigation();
14
15
  const { automate = {}, closeScreen } = route?.params || {};
16
+ const { id, unit, type } = automate;
15
17
 
16
18
  const [selectedIndex, setSelectedIndex] = useState(
17
- automate?.id
18
- ? smartTypes.findIndex((obj) => obj.type === automate.type)
19
- : -1
19
+ id ? smartTypes.findIndex((obj) => obj.type === type) : -1
20
20
  );
21
21
 
22
22
  const handleOnContinue = useCallback(
@@ -27,17 +27,18 @@ const AddTypeSmart = ({ smartTypes, route }) => {
27
27
  ...automate,
28
28
  type: dataAutomate?.type,
29
29
  },
30
+ unitId: unit,
30
31
  closeScreen: closeScreen,
31
32
  };
32
33
 
33
- if (!automate?.unit) {
34
+ if (!unit && dataAutomate.type === AUTOMATE_TYPE.VALUE_CHANGE) {
34
35
  navigate(Routes.SelectUnit, params);
35
36
  return;
36
37
  }
37
38
 
38
39
  navigate(dataAutomate.route, params);
39
40
  },
40
- [smartTypes, automate, closeScreen, navigate]
41
+ [smartTypes, automate, unit, closeScreen, navigate]
41
42
  );
42
43
 
43
44
  const onSelectType = (index) => {
@@ -50,7 +51,7 @@ const AddTypeSmart = ({ smartTypes, route }) => {
50
51
  <HeaderCustom isShowClose onClose={goBack} />
51
52
  <View style={styles.container}>
52
53
  <Text semibold type={'H2'} style={styles.titleCreate}>
53
- {automate?.id ? t('update_smart') : t('create_smart')}
54
+ {id ? t('update_smart') : t('create_smart')}
54
55
  </Text>
55
56
  <Text type={'Body'} style={styles.titleChoose}>
56
57
  {t('choose_the_automation_method_you_want')}
@@ -62,7 +63,6 @@ const AddTypeSmart = ({ smartTypes, route }) => {
62
63
  isSelected={selectedIndex === index}
63
64
  key={item?.type?.toString()}
64
65
  index={index}
65
- selectedIndex={selectedIndex}
66
66
  setSelectedIndex={onSelectType}
67
67
  />
68
68
  ))}
@@ -1,12 +1,12 @@
1
+ import { useNavigation } from '@react-navigation/native';
1
2
  import React from 'react';
3
+ import { TouchableOpacity } from 'react-native';
2
4
  import { act, create } from 'react-test-renderer';
3
- import AddUnknownTypeSmart from '../AddUnknownTypeSmart';
5
+ import ItemAutomate from '../../../../commons/Automate/ItemAutomate';
4
6
  import { SCProvider } from '../../../../context';
5
7
  import { mockSCStore } from '../../../../context/mockStore';
6
- import ItemAutomate from '../../../../commons/Automate/ItemAutomate';
7
8
  import Routes from '../../../../utils/Route';
8
- import { TouchableOpacity } from 'react-native';
9
- import { useNavigation } from '@react-navigation/native';
9
+ import AddUnknownTypeSmart from '../AddUnknownTypeSmart';
10
10
 
11
11
  const wrapComponent = (route) => (
12
12
  <SCProvider initState={mockSCStore({})}>
@@ -41,10 +41,14 @@ describe('test AddNewAutoSmart', () => {
41
41
  await touchItem.props.onPress();
42
42
  });
43
43
 
44
- expect(global.mockedNavigate).toBeCalledWith(Routes.SelectMonitorDevices, {
45
- automate: { unit: 1, type: 'value_change' },
46
- closeScreen: undefined,
47
- });
44
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
45
+ Routes.SelectMonitorDevices,
46
+ {
47
+ automate: { unit: 1, type: 'value_change' },
48
+ closeScreen: undefined,
49
+ unitId: 1,
50
+ }
51
+ );
48
52
  });
49
53
 
50
54
  it('test choose Schedule', async () => {
@@ -62,6 +66,7 @@ describe('test AddNewAutoSmart', () => {
62
66
  expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.SetSchedule, {
63
67
  automate: { type: 'schedule', unit: 1 },
64
68
  closeScreen: undefined,
69
+ unitId: 1,
65
70
  });
66
71
  });
67
72
  });
@@ -9,12 +9,14 @@ import styles from './InputNameStyles';
9
9
  import { useTranslations } from '../../../hooks/Common/useTranslations';
10
10
  import { axiosPost, axiosPut } from '../../../utils/Apis/axios';
11
11
  import NewActionWrapper from '../../Automate/AddNewAction/NewActionWrapper';
12
+ import Routes from '../../../utils/Route';
12
13
 
13
14
  const InputName = ({ title, placeholder }) => {
14
- const { automate, closeScreen } = useRoute().params;
15
+ const { automate = {}, closeScreen } = useRoute().params;
16
+ const { id: automateNameId, name: automateName } = automate;
15
17
  const t = useTranslations();
16
18
  const { navigate } = useNavigation();
17
- const [name, setName] = useState(automate?.name);
19
+ const [name, setName] = useState(automateName);
18
20
  const [processing, setProcessing] = useState(false);
19
21
  const handleContinue = useCallback(async () => {
20
22
  if (processing) {
@@ -29,21 +31,22 @@ const InputName = ({ title, placeholder }) => {
29
31
  name: name,
30
32
  };
31
33
 
32
- const { success, data } = automate?.id
33
- ? await axiosPut(API.AUTOMATE.UPDATE_AUTOMATE(automate?.id), params)
34
+ const { success, data } = automateNameId
35
+ ? await axiosPut(API.AUTOMATE.UPDATE_AUTOMATE(automateNameId), params)
34
36
  : await axiosPost(API.AUTOMATE.CREATE_AUTOMATE(), params);
35
37
 
36
38
  if (success) {
37
39
  navigate({
38
- name: closeScreen,
40
+ name: Routes.ScriptDetail,
39
41
  merge: true,
40
42
  params: {
41
- newAutomate: data,
43
+ preAutomate: data,
44
+ closeScreen: closeScreen,
42
45
  },
43
46
  });
44
47
  }
45
48
  setProcessing(false);
46
- }, [processing, automate, name, navigate, closeScreen]);
49
+ }, [processing, automate, name, automateNameId, navigate, closeScreen]);
47
50
 
48
51
  return (
49
52
  <NewActionWrapper
@@ -1,19 +1,19 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import renderer, { act } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
4
 
5
- import { SCProvider } from '../../../../context';
6
- import { mockSCStore } from '../../../../context/mockStore';
7
5
  import API from '../../../../configs/API';
8
6
  import { AccessibilityLabel } from '../../../../configs/Constants';
7
+ import { SCProvider } from '../../../../context';
8
+ import { mockSCStore } from '../../../../context/mockStore';
9
9
 
10
+ import { useRoute } from '@react-navigation/native';
11
+ import { TouchableOpacity } from 'react-native';
12
+ import { showAllCards } from '../../../../commons/ActionTemplate/__test__/utils';
10
13
  import api from '../../../../utils/Apis/axios';
11
14
  import { ToastBottomHelper } from '../../../../utils/Utils';
12
- import UpdateActionScript from '../UpdateActionScript';
13
- import { TouchableOpacity } from 'react-native';
14
- import { useRoute } from '@react-navigation/native';
15
15
  import RenderActionItem from '../../AddNewAction/RenderActionItem';
16
- import { showAllCards } from '../../../../commons/ActionTemplate/__test__/utils';
16
+ import UpdateActionScript from '../UpdateActionScript';
17
17
 
18
18
  const mock = new MockAdapter(api.axiosInstance);
19
19
  const mockedPermission = jest.fn();
@@ -152,6 +152,6 @@ describe('Test UpdateActionScript', () => {
152
152
  await selectActionOne(instance);
153
153
  await pressSaveButton(instance);
154
154
 
155
- expect(spyToast).toBeCalled();
155
+ expect(spyToast).toHaveBeenCalled();
156
156
  });
157
157
  });
@@ -1,15 +1,15 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import renderer, { act } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
4
 
5
- import { SCProvider } from '../../../../context';
6
- import { mockSCStore } from '../../../../context/mockStore';
7
5
  import API from '../../../../configs/API';
8
6
  import { AccessibilityLabel } from '../../../../configs/Constants';
7
+ import { SCProvider } from '../../../../context';
8
+ import { mockSCStore } from '../../../../context/mockStore';
9
9
 
10
- import api from '../../../../utils/Apis/axios';
11
- import _TextInput from '../../../../commons/Form/TextInput';
12
10
  import BottomButtonView from '../../../../commons/BottomButtonView';
11
+ import _TextInput from '../../../../commons/Form/TextInput';
12
+ import api from '../../../../utils/Apis/axios';
13
13
  import { ToastBottomHelper } from '../../../../utils/Utils';
14
14
  import UpdateDelayScript from '../UpdateDelayScript';
15
15
 
@@ -80,7 +80,7 @@ describe('Test UpdateDelayScript', () => {
80
80
  await act(async () => {
81
81
  button.props.onPressMain();
82
82
  });
83
- expect(spyToast).toBeCalled();
83
+ expect(spyToast).toHaveBeenCalled();
84
84
  });
85
85
  it('test can not update title and message', async () => {
86
86
  await act(async () => {
@@ -1,17 +1,17 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import renderer, { act } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
4
 
5
- import { SCProvider } from '../../../../context';
6
- import { mockSCStore } from '../../../../context/mockStore';
7
5
  import API from '../../../../configs/API';
8
6
  import { AccessibilityLabel } from '../../../../configs/Constants';
7
+ import { SCProvider } from '../../../../context';
8
+ import { mockSCStore } from '../../../../context/mockStore';
9
9
 
10
- import api from '../../../../utils/Apis/axios';
11
- import UpdateNotifyScript from '../UpdateNotifyScript';
12
- import _TextInput from '../../../../commons/Form/TextInput';
13
10
  import BottomButtonView from '../../../../commons/BottomButtonView';
11
+ import _TextInput from '../../../../commons/Form/TextInput';
12
+ import api from '../../../../utils/Apis/axios';
14
13
  import { ToastBottomHelper } from '../../../../utils/Utils';
14
+ import UpdateNotifyScript from '../UpdateNotifyScript';
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
17
  const mockerOnClosePopup = jest.fn();
@@ -89,7 +89,7 @@ describe('Test UpdateNotifyScript', () => {
89
89
  await act(async () => {
90
90
  button.props.onPressMain();
91
91
  });
92
- expect(spyToast).toBeCalled();
92
+ expect(spyToast).toHaveBeenCalled();
93
93
  // expect(global.mockedNavigate).toHaveBeenCalledWith('closeScreen');
94
94
  });
95
95
  it('test can not update title and message', async () => {
@@ -1,27 +1,28 @@
1
- import React, { useState, useCallback, useMemo, useEffect } from 'react';
2
- import { View, TouchableOpacity } from 'react-native';
3
- import DraggableFlatList from 'react-native-draggable-flatlist';
4
1
  import { useNavigation, useRoute } from '@react-navigation/native';
2
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
+ import { TouchableOpacity, View } from 'react-native';
4
+ import DraggableFlatList from 'react-native-draggable-flatlist';
5
5
  import ParsedText from 'react-native-parsed-text';
6
6
 
7
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
8
+ import Close from '../../../../assets/images/Close.svg';
9
+ import Delay from '../../../../assets/images/Delay.svg';
10
+ import Notify from '../../../../assets/images/Notify.svg';
11
+ import Rearrange from '../../../../assets/images/Rearrange.svg';
12
+ import { FullLoading } from '../../../commons';
13
+ import FImage from '../../../commons/FImage';
7
14
  import { HeaderCustom } from '../../../commons/Header';
8
- import { useTranslations } from '../../../hooks/Common/useTranslations';
15
+ import { ModalBottom, ModalCustom } from '../../../commons/Modal';
9
16
  import Text from '../../../commons/Text';
10
- import styles from './Styles/indexStyles';
11
17
  import { API, Colors } from '../../../configs';
12
- import FImage from '../../../commons/FImage';
13
- import Rearrange from '../../../../assets/images/Rearrange.svg';
14
- import Notify from '../../../../assets/images/Notify.svg';
15
- import Delay from '../../../../assets/images/Delay.svg';
16
- import Close from '../../../../assets/images/Close.svg';
17
- import { axiosDelete, axiosPut } from '../../../utils/Apis/axios';
18
- import { ModalBottom, ModalCustom } from '../../../commons/Modal';
19
- import { ToastBottomHelper } from '../../../utils/Utils';
20
18
  import { AccessibilityLabel } from '../../../configs/Constants';
19
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
20
+ import { axiosDelete, axiosPut } from '../../../utils/Apis/axios';
21
21
  import Routes from '../../../utils/Route';
22
+ import { ToastBottomHelper } from '../../../utils/Utils';
23
+ import styles from './Styles/indexStyles';
22
24
  import UpdateDelayScript from './UpdateDelayScript';
23
25
  import UpdateNotifyScript from './UpdateNotifyScript';
24
- import { FullLoading } from '../../../commons';
25
26
 
26
27
  const EditActionsList = () => {
27
28
  const t = useTranslations();
@@ -134,7 +135,8 @@ const EditActionsList = () => {
134
135
  </View>
135
136
  );
136
137
  const renderItem = useCallback(
137
- ({ item, index, drag, isActive }) => {
138
+ ({ item, getIndex, drag, isActive }) => {
139
+ const index = getIndex();
138
140
  const paddedIndex = (index + 1).toString().padStart(2, '0');
139
141
  const { action_script, notify_script, delay_script } = item;
140
142
  if (action_script) {
@@ -354,7 +356,7 @@ const EditActionsList = () => {
354
356
  }, [itemRemove, t]);
355
357
 
356
358
  return (
357
- <View style={styles.wrap}>
359
+ <GestureHandlerRootView style={styles.wrap}>
358
360
  <HeaderCustom title={t('edit_actions_list')} onGoBack={onCancel} />
359
361
  <View style={styles.wrapContent}>
360
362
  <Text type="Body" color={Colors.Gray8}>
@@ -393,7 +395,7 @@ const EditActionsList = () => {
393
395
  <View style={styles.modalHeader}>{renderAction}</View>
394
396
  </View>
395
397
  </ModalCustom>
396
- </View>
398
+ </GestureHandlerRootView>
397
399
  );
398
400
  };
399
401