@eohjsc/react-native-smart-city 0.7.3-rc9 → 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 (166) hide show
  1. package/assets/images/Map/LocationPin.svg +10 -0
  2. package/package.json +4 -2
  3. package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -2
  4. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
  5. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
  6. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
  7. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  8. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
  9. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
  10. package/src/commons/ActionGroup/SliderRangeTemplate.js +7 -7
  11. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
  12. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
  13. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
  14. package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
  15. package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
  16. package/src/commons/ActionGroup/TimerActionTemplate.js +6 -3
  17. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
  18. package/src/commons/ActionGroup/__test__/index.test.js +2 -2
  19. package/src/commons/ActionGroup/index.js +2 -2
  20. package/src/commons/Automate/ItemAutomate.js +9 -41
  21. package/src/commons/Automate/ItemConditionScriptDetail.js +109 -0
  22. package/src/commons/Automate/ItemConditionScriptDetailStyles.js +46 -0
  23. package/src/commons/Automate/__test__/ItemAutomate.test.js +0 -21
  24. package/src/commons/BackDefault/index.js +2 -2
  25. package/src/commons/BottomButtonView/index.js +1 -0
  26. package/src/commons/ButtonPopup/index.js +3 -2
  27. package/src/commons/DateTimeRangeChange/DateTimeButton.js +3 -3
  28. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  29. package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
  30. package/src/commons/Device/FlatListItems.js +3 -3
  31. package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
  32. package/src/commons/Device/HorizontalBarChart.js +54 -34
  33. package/src/commons/Device/ItemAddNew/index.js +2 -2
  34. package/src/commons/Device/ItemDevice.js +2 -2
  35. package/src/commons/Device/SonosSpeaker/index.js +3 -3
  36. package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
  37. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +6 -2
  38. package/src/commons/DisplayChecking/index.js +2 -2
  39. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  40. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  41. package/src/commons/FlatListDnD/index.js +12 -9
  42. package/src/commons/Grid/GridItem.js +10 -2
  43. package/src/commons/Header/HeaderCustom.js +2 -2
  44. package/src/commons/HeaderAni/index.js +2 -2
  45. package/src/commons/IconComponent/index.js +4 -4
  46. package/src/commons/NavBar/index.js +2 -2
  47. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  48. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +4 -4
  49. package/src/commons/SearchLocation/index.js +3 -3
  50. package/src/commons/SelectActionCard/index.js +2 -2
  51. package/src/commons/SelectSubUnit/index.js +6 -2
  52. package/src/commons/Sharing/BtnRemoveMember.js +2 -2
  53. package/src/commons/Sharing/StationDevicePermissions.js +2 -2
  54. package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
  55. package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
  56. package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
  57. package/src/commons/SubUnit/OneTap/ItemOneTap.js +3 -4
  58. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +0 -2
  59. package/src/commons/SubUnit/OneTap/index.js +9 -8
  60. package/src/commons/Unit/HeaderUnit/index.js +3 -3
  61. package/src/commons/Unit/SharedUnit.js +7 -7
  62. package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +4 -15
  63. package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +29 -18
  64. package/src/configs/API.js +1 -1
  65. package/src/configs/AccessibilityLabel.js +1 -0
  66. package/src/configs/Theme.js +1 -1
  67. package/src/hooks/IoT/__test__/useRemoteControl.test.js +14 -7
  68. package/src/hooks/IoT/useRemoteControl.js +18 -7
  69. package/src/hooks/useMqtt.js +2 -2
  70. package/src/iot/RemoteControl/Bluetooth.js +19 -22
  71. package/src/iot/RemoteControl/Internet.js +11 -3
  72. package/src/navigations/EmergencyContactsStack.js +4 -3
  73. package/src/navigations/SharedStack.js +2 -0
  74. package/src/navigations/UnitStack.js +56 -57
  75. package/src/screens/AQIGuide/index.js +0 -2
  76. package/src/screens/ActivityLog/index.js +2 -2
  77. package/src/screens/AddLocationMaps/index.js +16 -19
  78. package/src/screens/AddLocationMaps/indexStyle.js +1 -0
  79. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  80. package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
  81. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +25 -9
  82. package/src/screens/Automate/AddNewAction/ChooseAction.js +17 -3
  83. package/src/screens/Automate/AddNewAction/ChooseConfig.js +7 -6
  84. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +8 -8
  85. package/src/screens/Automate/AddNewAction/SelectControlDevices.js +30 -20
  86. package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +17 -10
  87. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +58 -44
  88. package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +1 -1
  89. package/src/screens/Automate/AddNewAction/SetupScriptNotify.js +3 -3
  90. package/src/screens/Automate/AddNewAction/Styles/SetupSensorStyles.js +20 -4
  91. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +1 -1
  92. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
  93. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
  94. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +54 -15
  95. package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +29 -0
  96. package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +10 -10
  97. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +2 -0
  98. package/src/screens/Automate/Components/InputName.js +10 -7
  99. package/src/screens/Automate/EditActionsList/index.js +19 -17
  100. package/src/screens/Automate/MultiUnits.js +19 -22
  101. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +12 -2
  102. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +9 -1
  103. package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +14 -6
  104. package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
  105. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +42 -17
  106. package/src/screens/Automate/ScriptDetail/index.js +33 -22
  107. package/src/screens/Automate/SetSchedule/__test__/index.test.js +21 -10
  108. package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
  109. package/src/screens/Automate/SetSchedule/index.js +8 -7
  110. package/src/screens/Automate/Styles/indexStyles.js +1 -1
  111. package/src/screens/Automate/__test__/MultiUnits.test.js +1 -4
  112. package/src/screens/Automate/__test__/index.test.js +0 -1
  113. package/src/screens/Automate/index.js +36 -34
  114. package/src/screens/ChangePosition/index.js +2 -1
  115. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +4 -4
  116. package/src/screens/Device/EditDevice/index.js +4 -4
  117. package/src/screens/Device/__test__/BluetoothDevice.test.js +300 -0
  118. package/src/screens/Device/__test__/detail.test.js +3 -3
  119. package/src/screens/Device/components/BluetoothDevice.js +135 -0
  120. package/src/screens/Device/components/SensorDisplayItem.js +4 -3
  121. package/src/screens/Device/detail.js +70 -62
  122. package/src/screens/Device/hooks/useEvaluateValue.js +1 -1
  123. package/src/screens/Drawer/index.js +3 -3
  124. package/src/screens/EmergencyContacts/EmergencyContactsList.js +8 -4
  125. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
  126. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  127. package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
  128. package/src/screens/GuestInfo/index.js +2 -2
  129. package/src/screens/HanetCamera/ManageAccess.js +3 -3
  130. package/src/screens/HanetCamera/MemberInfo.js +2 -2
  131. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  132. package/src/screens/ManageAccess/index.js +3 -3
  133. package/src/screens/Notification/components/NotificationItem.js +3 -3
  134. package/src/screens/Notification/index.js +3 -3
  135. package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
  136. package/src/screens/SelectUnit/__test__/index.test.js +1 -1
  137. package/src/screens/SelectUnit/index.js +4 -4
  138. package/src/screens/SharedUnit/TabHeader.js +2 -2
  139. package/src/screens/Sharing/Components/EndDevice.js +3 -3
  140. package/src/screens/Sharing/UnitMemberList.js +2 -2
  141. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +2 -2
  142. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +3 -2
  143. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -2
  144. package/src/screens/SmartIr/components/SelectBrand.js +2 -2
  145. package/src/screens/SubUnit/AddSubUnit.js +28 -24
  146. package/src/screens/SubUnit/AddSubUnitStyles.js +10 -4
  147. package/src/screens/SubUnit/EditSubUnit.js +12 -11
  148. package/src/screens/SubUnit/ManageSubUnit.js +3 -3
  149. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +13 -13
  150. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +3 -3
  151. package/src/screens/Template/EditTemplate.js +6 -4
  152. package/src/screens/UVIndexGuide/index.js +2 -4
  153. package/src/screens/Unit/SelectAddToFavorites.js +2 -2
  154. package/src/screens/Unit/SelectAddress.js +16 -12
  155. package/src/screens/Unit/components/AutomateScript/index.js +2 -2
  156. package/src/screens/Unit/components/ButtonWrapper/index.js +3 -3
  157. package/src/screens/Unit/components/Header/index.js +2 -2
  158. package/src/screens/Unit/components/SharedUnit/index.js +5 -5
  159. package/src/screens/UnitSummary/components/AirQuality/index.js +6 -11
  160. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +6 -6
  161. package/src/screens/UnitSummary/index.js +3 -3
  162. package/src/utils/Apis/axios.js +5 -5
  163. package/src/utils/Functions/ShortEmail.js +1 -0
  164. package/src/utils/I18n/translations/en.js +6 -3
  165. package/src/utils/I18n/translations/vi.js +8 -4
  166. package/src/utils/bluetooth.js +3 -0
@@ -3,6 +3,7 @@ import moment from 'moment';
3
3
  import React, { memo, useCallback, useState } from 'react';
4
4
  import { Image, TouchableOpacity, View } from 'react-native';
5
5
 
6
+ import Notify from '../../../../assets/images/Notify.svg';
6
7
  import IconComponent from '../../../commons/IconComponent';
7
8
  import Text from '../../../commons/Text';
8
9
  import { API, Colors, SCConfig } from '../../../configs';
@@ -16,7 +17,6 @@ import { useTranslations } from '../../../hooks/Common/useTranslations';
16
17
  import { axiosPost } from '../../../utils/Apis/axios';
17
18
  import Routes from '../../../utils/Route';
18
19
  import styles from '../styles/NotificationItemStyles';
19
- import Notify from '../../../../assets/images/Notify.svg';
20
20
 
21
21
  const NotificationItem = memo(({ item }) => {
22
22
  const t = useTranslations();
@@ -72,7 +72,7 @@ const NotificationItem = memo(({ item }) => {
72
72
  },
73
73
  iconContent: (
74
74
  <IconComponent
75
- icon={'addusergroup'}
75
+ icon="usergroup-add"
76
76
  style={styles.backgroundSummer}
77
77
  />
78
78
  ),
@@ -438,7 +438,7 @@ const NotificationItem = memo(({ item }) => {
438
438
  navigation.navigate(Routes.UnitStack, {
439
439
  screen: Routes.ScriptDetail,
440
440
  params: {
441
- id: automate_id,
441
+ preAutomate: { id: automate_id },
442
442
  },
443
443
  });
444
444
  },
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useMemo, useState, useCallback, useEffect } from 'react';
2
2
  import { View, TouchableOpacity } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import { useFocusEffect } from '@react-navigation/native';
5
5
 
6
6
  import styles from './styles/indexStyles';
@@ -33,7 +33,7 @@ const Notification = memo(() => {
33
33
  notImplemented(t);
34
34
  }}
35
35
  >
36
- <AntDesign name={'plus'} size={27} color={Colors.Black} />
36
+ <IconOutline name={'plus'} size={27} color={Colors.Black} />
37
37
  </TouchableOpacity>
38
38
 
39
39
  <TouchableOpacity
@@ -41,7 +41,7 @@ const Notification = memo(() => {
41
41
  notImplemented(t);
42
42
  }}
43
43
  >
44
- <AntDesign name={'search1'} size={27} color={Colors.Black} />
44
+ <IconOutline name={'search'} size={27} color={Colors.Black} />
45
45
  </TouchableOpacity>
46
46
  </View>
47
47
  ),
@@ -7,7 +7,7 @@ import {
7
7
  Dimensions,
8
8
  TouchableOpacity,
9
9
  } from 'react-native';
10
- import AntDesign from 'react-native-vector-icons/AntDesign';
10
+ import { IconOutline } from '@ant-design/icons-react-native';
11
11
  import { RNCamera } from 'react-native-camera';
12
12
  import { getStatusBarHeight } from 'react-native-iphone-x-helper';
13
13
  import { useTranslations } from '../../../../hooks/Common/useTranslations';
@@ -36,7 +36,7 @@ const VerifyingQRCode = memo(() => {
36
36
  <View style={styles.maskOuter}>
37
37
  <TouchableOpacity style={[styles.viewVerifying, styles.buttonShadow]}>
38
38
  <Loading
39
- icon={<AntDesign name={'sync'} color={Colors.Green6} size={16} />}
39
+ icon={<IconOutline name={'sync'} color={Colors.Green6} size={16} />}
40
40
  />
41
41
  <Text type={'Body'} style={styles.text}>
42
42
  {t('verify_qr_code')}
@@ -117,7 +117,7 @@ const QRScan = ({ isScanReady = true, onScan }) => {
117
117
  borderColor={Colors.Gray4}
118
118
  style={styles.buttonClose}
119
119
  >
120
- <AntDesign name={'close'} size={24} co />
120
+ <IconOutline name={'close'} size={24} co />
121
121
  </CircleButton>
122
122
  {loading && <VerifyingQRCode />}
123
123
  </View>
@@ -158,7 +158,7 @@ describe('Test Select unit screen', () => {
158
158
  await iconClose[0].props.onPress();
159
159
  });
160
160
  expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail, {
161
- id: 1,
161
+ automate: { id: 1 },
162
162
  havePermission: true,
163
163
  isMultiUnits: undefined,
164
164
  name: '1',
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo, useState, useCallback, useEffect } from 'react';
2
2
  import { View, TouchableOpacity, FlatList } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
5
5
  import { API, Colors } from '../../configs';
6
6
  import Text from '../../commons/Text';
@@ -50,7 +50,7 @@ const SelectUnit = () => {
50
50
  const handleOnGoBackAndClose = useCallback(() => {
51
51
  if (automateId) {
52
52
  navigate(Routes.ScriptDetail, {
53
- id: automateId,
53
+ automate: { id: automateId },
54
54
  name: scriptName,
55
55
  type: oldType,
56
56
  havePermission: true,
@@ -76,7 +76,7 @@ const SelectUnit = () => {
76
76
  isAutomateTab,
77
77
  isMultiUnits,
78
78
  routeName,
79
- unit: selectedItem,
79
+ multiUnit: selectedItem,
80
80
  automateId,
81
81
  scriptName,
82
82
  oldType,
@@ -132,7 +132,7 @@ const SelectUnit = () => {
132
132
  accessibilityLabel={AccessibilityLabel.ICON_CLOSE}
133
133
  >
134
134
  <View style={styles.buttonClose}>
135
- <AntDesign name={'close'} size={24} color={Colors.Black} />
135
+ <IconOutline name={'close'} size={24} color={Colors.Black} />
136
136
  </View>
137
137
  </TouchableOpacity>
138
138
  ),
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View, TouchableOpacity } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
6
  import Text from '../../commons/Text';
@@ -54,7 +54,7 @@ const TabHeader = ({ current, getCurrentTab, showModal, textFilter }) => {
54
54
  <Text style={styles.sortBy}>
55
55
  {t('sort_by') + ': '} {textFilter}
56
56
  </Text>
57
- <AntDesign name="arrowdown" size={10} />
57
+ <IconOutline name="arrowdown" size={10} />
58
58
  </TouchableOpacity>
59
59
  </View>
60
60
  </View>
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useMemo, useState } from 'react';
2
2
  import { View, Text, TouchableOpacity } from 'react-native';
3
- import AntDesign from 'react-native-vector-icons/AntDesign';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import { Colors } from '../../../configs';
5
5
  import styles from './Styles/DeviceItemStyles';
6
6
  import { AccessibilityLabel } from '../../../configs/Constants';
@@ -71,11 +71,11 @@ const EndDevice = ({
71
71
  {name}
72
72
  </Text>
73
73
  {checked && (
74
- <AntDesign name={'check'} color={Colors.Primary} size={20} />
74
+ <IconOutline name={'check'} color={Colors.Primary} size={20} />
75
75
  )}
76
76
 
77
77
  {dataConfig.length > 0 && (
78
- <AntDesign
78
+ <IconOutline
79
79
  onPress={() => toggleExpandEndDevice()}
80
80
  name={isItemExpanded ? 'up' : 'down'}
81
81
  size={20}
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect } from 'react';
2
- import AntDesign from 'react-native-vector-icons/AntDesign';
2
+ import { IconOutline } from '@ant-design/icons-react-native';
3
3
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
4
4
  import { useNavigation, useIsFocused } from '@react-navigation/native';
5
5
  import { StyleSheet, TouchableOpacity, View } from 'react-native';
@@ -83,7 +83,7 @@ const UnitMemberList = ({ route }) => {
83
83
  style={styles.rightHeader}
84
84
  >
85
85
  {isOwner ? (
86
- <AntDesign name={'plus'} size={27} color={Colors.Black} />
86
+ <IconOutline name={'plus'} size={27} color={Colors.Black} />
87
87
  ) : (
88
88
  <MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
89
89
  )}
@@ -1,7 +1,7 @@
1
1
  import React, { memo, useCallback, useEffect, useState } from 'react';
2
2
  import { View, ScrollView, ActivityIndicator } from 'react-native';
3
3
  import { useNavigation, CommonActions } from '@react-navigation/native';
4
- import AntDesign from 'react-native-vector-icons/AntDesign';
4
+ import { IconOutline } from '@ant-design/icons-react-native';
5
5
 
6
6
  import _TextInput from '../../../commons/Form/TextInput';
7
7
  import Text from '../../../commons/Text';
@@ -134,7 +134,7 @@ const SuccessfullyConnected = memo(({ route }) => {
134
134
  <View style={styles.wrap}>
135
135
  <ScrollView>
136
136
  <View style={styles.body}>
137
- <AntDesign name="check-circle" size={28} color={Colors.Green6} />
137
+ <IconOutline name="check-circle" size={28} color={Colors.Green6} />
138
138
  <Text bold style={styles.connectingText}>
139
139
  {t('successfully_connected')}
140
140
  </Text>
@@ -9,8 +9,9 @@ import { AccessibilityLabel } from '../../../configs/Constants';
9
9
  import TextInput from '../../../commons/Form/TextInput';
10
10
  import { ModalCustom } from '../../../commons/Modal';
11
11
  import { TouchableOpacity } from 'react-native';
12
- import AntDesign from 'react-native-vector-icons/AntDesign';
12
+
13
13
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
14
+ import { IconOutline } from '@ant-design/icons-react-native';
14
15
 
15
16
  const wrapComponent = (route) => (
16
17
  <SCProvider initState={mockSCStore({})}>
@@ -133,7 +134,7 @@ describe('Test GroupButtonByType', () => {
133
134
  const icon = instance.find(
134
135
  (el) =>
135
136
  el.props.accessibilityLabel ===
136
- AccessibilityLabel.ICON_OUTLINE_TYPE_RELOAD && el.type === AntDesign
137
+ AccessibilityLabel.ICON_OUTLINE_TYPE_RELOAD && el.type === IconOutline
137
138
  );
138
139
  await act(async () => {
139
140
  await touch.props.onPress();
@@ -5,7 +5,7 @@ import { useTranslations } from '../../../../hooks/Common/useTranslations';
5
5
  import SmartTiviActionTemplate from '../../../../commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate';
6
6
  import Text from '../../../../commons/Text';
7
7
  import { ModalCustom } from '../../../../commons/Modal';
8
- import AntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { IconOutline } from '@ant-design/icons-react-native';
9
9
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
10
10
  import { Colors } from '../../../../configs';
11
11
  import TextInput from '../../../../commons/Form/TextInput';
@@ -58,7 +58,7 @@ const GroupButtonByType = memo(({ route }) => {
58
58
  style={[styles.headerButton]}
59
59
  accessibilityLabel={AccessibilityLabel.HEADER_BUTTON_TYPE_RELOAD}
60
60
  >
61
- <AntDesign
61
+ <IconOutline
62
62
  name={'reload1'}
63
63
  size={27}
64
64
  color={Colors.Black}
@@ -5,7 +5,7 @@ import { HeaderCustom } from '../../../commons/Header';
5
5
  import { useTranslations } from '../../../hooks/Common/useTranslations';
6
6
  import Routes from '../../../utils/Route';
7
7
  import { RowItem } from '../../../commons/RowItem';
8
- import AntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { IconOutline } from '@ant-design/icons-react-native';
9
9
  import { Colors } from '../../../configs';
10
10
 
11
11
  import styles from './SelectBrandStyles';
@@ -47,7 +47,7 @@ const SelectDeviceType = memo(({ route }) => {
47
47
  key={index.toString()}
48
48
  isShowSubText={false}
49
49
  rightComponent={
50
- <AntDesign name="right" size={20} color={Colors.Gray7} />
50
+ <IconOutline name="right" size={20} color={Colors.Gray7} />
51
51
  }
52
52
  />
53
53
  );
@@ -1,27 +1,28 @@
1
+ import { useNavigation } from '@react-navigation/native';
1
2
  import React, {
2
- useState,
3
3
  useCallback,
4
- useMemo,
5
4
  useEffect,
5
+ useMemo,
6
6
  useRef,
7
+ useState,
7
8
  } from 'react';
8
- import { View, Image, Keyboard, TouchableWithoutFeedback } from 'react-native';
9
- import { useNavigation } from '@react-navigation/native';
9
+ import { Image, Keyboard, TouchableWithoutFeedback, View } from 'react-native';
10
10
 
11
- import { useTranslations } from '../../hooks/Common/useTranslations';
12
- import { API, Colors } from '../../configs';
13
- import { ViewButtonBottom, ImagePicker } from '../../commons';
14
- import Text from '../../commons/Text';
11
+ import { ImagePicker, ViewButtonBottom } from '../../commons';
15
12
  import _TextInput from '../../commons/Form/TextInput';
16
- import Routes from '../../utils/Route';
17
- import { axiosPost, createFormData } from '../../utils/Apis/axios';
18
- import { ToastBottomHelper } from '../../utils/Utils';
13
+ import Text from '../../commons/Text';
14
+ import { API, Colors } from '../../configs';
19
15
  import { AccessibilityLabel } from '../../configs/Constants';
20
- import styles from './AddSubUnitStyles';
16
+ import { useSCContextSelector } from '../../context';
21
17
  import useKeyboardShow from '../../hooks/Common/useKeyboardShow';
18
+ import { useTranslations } from '../../hooks/Common/useTranslations';
22
19
  import { replace } from '../../navigations/utils';
20
+ import { axiosPost, createFormData } from '../../utils/Apis/axios';
23
21
  import { useBackendPermission } from '../../utils/Permission/backend';
24
- import { useSCContextSelector } from '../../context';
22
+ import Routes from '../../utils/Route';
23
+ import { ToastBottomHelper } from '../../utils/Utils';
24
+ import styles from './AddSubUnitStyles';
25
+ import LocationPin from '../../../assets/images/Map/LocationPin.svg';
25
26
 
26
27
  const AddSubUnit = ({ route }) => {
27
28
  const t = useTranslations();
@@ -64,7 +65,7 @@ const AddSubUnit = ({ route }) => {
64
65
  lat: location.latitude,
65
66
  lng: location.longitude,
66
67
  };
67
- const formData = createFormData(dataObj, ['background', 'lat', 'lng']);
68
+ const formData = createFormData(dataObj, ['background']);
68
69
  const { success, data } = await axiosPost(
69
70
  API.UNIT.CREATE_UNIT(),
70
71
  formData,
@@ -85,7 +86,6 @@ const AddSubUnit = ({ route }) => {
85
86
  cleanData();
86
87
  } else {
87
88
  awaitCreate.current = false;
88
- ToastBottomHelper.error(t('text_create_unit_fail'));
89
89
  }
90
90
  }
91
91
  } else {
@@ -226,15 +226,19 @@ const AddSubUnit = ({ route }) => {
226
226
  }
227
227
  onPress={onChooseLocation}
228
228
  >
229
- <View style={styles.wrapGeolocation}>
230
- <Text style={styles.addWallpaper}>{t('geolocation')}</Text>
231
- <Text
232
- style={styles.textLocation}
233
- color={location.description && Colors.Primary}
234
- >
235
- {location.description ||
236
- t('text_explain_add_geolocation')}
237
- </Text>
229
+ <View style={styles.wrapLocation}>
230
+ <Text style={styles.addWallpaper}>{t('location')}</Text>
231
+ <View style={styles.wrapTextLocation}>
232
+ <LocationPin />
233
+ <Text
234
+ style={styles.textLocation}
235
+ color={
236
+ location.description ? Colors.Primary : Colors.Gray7
237
+ }
238
+ >
239
+ {location.description || t('text_explain_add_location')}
240
+ </Text>
241
+ </View>
238
242
  </View>
239
243
  </TouchableWithoutFeedback>
240
244
  )}
@@ -63,14 +63,20 @@ export default StyleSheet.create({
63
63
  marginRight: 8,
64
64
  backgroundColor: Colors.Pink1,
65
65
  },
66
- wrapGeolocation: {
66
+ wrapLocation: {
67
67
  marginTop: 6,
68
68
  borderBottomWidth: 1,
69
+ paddingBottom: 10,
69
70
  borderColor: Colors.Gray4,
70
71
  },
72
+ wrapTextLocation: {
73
+ flexDirection: 'row',
74
+ alignItems: 'center',
75
+ },
71
76
  textLocation: {
72
- fontSize: 16,
73
- lineHeight: 24,
74
- paddingBottom: 14,
77
+ fontSize: 12,
78
+ lineHeight: 20,
79
+ width: 320,
80
+ marginLeft: 6,
75
81
  },
76
82
  });
@@ -1,27 +1,27 @@
1
- import React, { useState, useCallback, useEffect } from 'react';
2
- import { View, TouchableOpacity, Image } from 'react-native';
3
1
  import { useIsFocused, useNavigation } from '@react-navigation/native';
2
+ import React, { useCallback, useEffect, useState } from 'react';
3
+ import { Image, TouchableOpacity, View } from 'react-native';
4
4
  import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
- import { Colors, API } from '../../configs';
7
- import { ToastBottomHelper } from '../../utils/Utils';
6
+ import { API, Colors } from '../../configs';
7
+ import useBoolean from '../../hooks/Common/useBoolean';
8
8
  import {
9
- axiosPatch,
10
9
  axiosDelete,
10
+ axiosPatch,
11
11
  createFormData,
12
12
  } from '../../utils/Apis/axios';
13
13
  import Routes from '../../utils/Route';
14
- import useBoolean from '../../hooks/Common/useBoolean';
14
+ import { ToastBottomHelper } from '../../utils/Utils';
15
15
 
16
+ import { IconOutline } from '@ant-design/icons-react-native';
16
17
  import { ImagePicker, Section } from '../../commons';
17
18
  import AlertAction from '../../commons/AlertAction';
18
19
  import _TextInput from '../../commons/Form/TextInput';
19
20
  import Text from '../../commons/Text';
20
21
  import { AccessibilityLabel } from '../../configs/Constants';
21
- import AntDesign from 'react-native-vector-icons/AntDesign';
22
- import { useEmeragencyContacts } from './hooks/useEmergencyContacts';
23
22
  import useKeyboardAnimated from '../../hooks/Explore/useKeyboardAnimated';
24
23
  import styles from './EditSubUnitStyles';
24
+ import { useEmeragencyContacts } from './hooks/useEmergencyContacts';
25
25
 
26
26
  const EditSubUnit = ({ route }) => {
27
27
  const { unit, station } = route?.params || {};
@@ -52,7 +52,7 @@ const EditSubUnit = ({ route }) => {
52
52
  }, [getListContacts, group, isFocused]);
53
53
 
54
54
  const onBack = useCallback(() => {
55
- const { routes } = navigation.dangerouslyGetState();
55
+ const { routes } = navigation.getState();
56
56
  const calledByRoute = routes[routes.length - 3].name;
57
57
 
58
58
  switch (calledByRoute) {
@@ -63,9 +63,10 @@ const EditSubUnit = ({ route }) => {
63
63
  navigation.navigate(Routes.UnitDetail, {
64
64
  isEditSubUnit: true,
65
65
  isAddSubUnit: false,
66
+ unitId: unit?.id,
66
67
  });
67
68
  }
68
- }, [navigation]);
69
+ }, [navigation, unit?.id]);
69
70
 
70
71
  const updateSubUnit = useCallback(
71
72
  async (params, headers) => {
@@ -207,7 +208,7 @@ const EditSubUnit = ({ route }) => {
207
208
  <Text type={'H4'} color={Colors.Gray9}>
208
209
  {t('emergency_contacts')}
209
210
  </Text>
210
- <AntDesign name={'right'} size={20} color={Colors.Gray8} />
211
+ <IconOutline name={'right'} size={20} color={Colors.Gray8} />
211
212
  </TouchableOpacity>
212
213
  <Text
213
214
  type={'Body'}
@@ -14,7 +14,7 @@ import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
14
14
  import Text from '../../commons/Text';
15
15
 
16
16
  import styles from './ManageSubUnitStyles';
17
- import AntDesign from 'react-native-vector-icons/AntDesign';
17
+ import { IconOutline } from '@ant-design/icons-react-native';
18
18
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
19
19
  import Routes from '../../utils/Route';
20
20
  import { RowItem } from '../../commons/RowItem';
@@ -54,7 +54,7 @@ const ManageSubUnit = ({ route }) => {
54
54
  onPress={addSubUnit}
55
55
  style={styles.headerButton}
56
56
  >
57
- <AntDesign name={'plus'} size={27} color={Colors.Black} />
57
+ <IconOutline name={'plus'} size={27} color={Colors.Black} />
58
58
  </TouchableOpacity>
59
59
  <TouchableOpacity
60
60
  // onPress={handleShowMenuAction}
@@ -112,7 +112,7 @@ const ManageSubUnit = ({ route }) => {
112
112
  } devices`}
113
113
  onPress={() => goToEditSubUnit(item, unit)}
114
114
  rightComponent={
115
- <AntDesign
115
+ <IconOutline
116
116
  name="right"
117
117
  size={20}
118
118
  color={Colors.Gray6}
@@ -212,7 +212,9 @@ describe('Test AddSubUnit', () => {
212
212
  },
213
213
  isAddUnit: true,
214
214
  };
215
- mock.onPost(API.UNIT.CREATE_UNIT()).reply(400);
215
+ mock.onPost(API.UNIT.CREATE_UNIT()).reply(400, {
216
+ non_field_errors: 'You have reached max units',
217
+ });
216
218
  await act(async () => {
217
219
  tree = await create(wrapComponent(route));
218
220
  });
@@ -224,7 +226,7 @@ describe('Test AddSubUnit', () => {
224
226
  expect(Toast.show).toHaveBeenCalledWith({
225
227
  type: 'error',
226
228
  position: 'bottom',
227
- text1: getTranslate('en', 'text_create_unit_fail'),
229
+ text1: 'You have reached max units',
228
230
  visibilityTime: 1000,
229
231
  });
230
232
  });
@@ -244,19 +246,17 @@ describe('Test AddSubUnit', () => {
244
246
  await viewButtonBottom.props.onRightClick();
245
247
  });
246
248
  expect(global.mockedNavigate).toHaveBeenCalledWith('UnitDetail', {
247
- params: {
248
- isAddSubUnit: true,
249
- routeName: 'DashboardStack',
250
- stationId: undefined,
251
- unitData: {
252
- id: 1,
253
- name: 'Unit name',
254
- location: {
255
- description: 'location',
256
- },
249
+ isAddSubUnit: true,
250
+ routeName: 'DashboardStack',
251
+ stationId: undefined,
252
+ unitData: {
253
+ id: 1,
254
+ name: 'Unit name',
255
+ location: {
256
+ description: 'location',
257
257
  },
258
- unitId: 1,
259
258
  },
259
+ unitId: 1,
260
260
  });
261
261
  });
262
262
 
@@ -70,7 +70,7 @@ describe('Test EditSubUnit', () => {
70
70
  it('alertAction rightButtonClick success, previous screen Routes.UnitDetail', async () => {
71
71
  mock.onDelete(API.SUB_UNIT.REMOVE_SUB_UNIT(1, 2)).reply(200);
72
72
 
73
- global.mockedDangerouslyGetState.mockImplementation(() => ({
73
+ global.mockedGetState.mockImplementation(() => ({
74
74
  routes: [
75
75
  { name: Routes.UnitDetail },
76
76
  { name: 'route 2' },
@@ -98,7 +98,7 @@ describe('Test EditSubUnit', () => {
98
98
 
99
99
  it('alertAction rightButtonClick success', async () => {
100
100
  mock.onDelete(API.SUB_UNIT.REMOVE_SUB_UNIT(1, 2)).reply(200);
101
- global.mockedDangerouslyGetState.mockImplementation(() => ({
101
+ global.mockedGetState.mockImplementation(() => ({
102
102
  routes: [
103
103
  { name: 'UnitDetail' },
104
104
  { name: 'route 2' },
@@ -122,7 +122,7 @@ describe('Test EditSubUnit', () => {
122
122
  .onDelete('https://backend.eoh.io/api/property_manager/1/sub_units/2/')
123
123
  .reply(400);
124
124
 
125
- global.mockedDangerouslyGetState.mockImplementation(() => ({
125
+ global.mockedGetState.mockImplementation(() => ({
126
126
  routes: [{ name: 'route 1' }, { name: 'route 2' }, { name: 'route 3' }],
127
127
  }));
128
128
 
@@ -9,6 +9,7 @@ import React, {
9
9
  import { Image, TouchableOpacity, View } from 'react-native';
10
10
  import DraggableFlatList from 'react-native-draggable-flatlist';
11
11
 
12
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
12
13
  import { EmptyComponent } from '../../commons/DevMode';
13
14
  import { HeaderCustom } from '../../commons/Header';
14
15
  import Text from '../../commons/Text';
@@ -16,9 +17,9 @@ import { Images } from '../../configs';
16
17
  import { SCContext } from '../../context';
17
18
  import { Action } from '../../context/actionType';
18
19
  import t from '../../hooks/Common/useTranslations';
20
+ import { notImplemented } from '../../utils/Utils';
19
21
  import { SensorDisplayItem } from '../Device/components/SensorDisplayItem';
20
22
  import styles from './Styles/EditTemplateStyle';
21
- import { notImplemented } from '../../utils/Utils';
22
23
 
23
24
  const EditTemplate = () => {
24
25
  const { setAction } = useContext(SCContext);
@@ -100,7 +101,7 @@ const EditTemplate = () => {
100
101
  {!actionsList?.length ? (
101
102
  renderEmpty
102
103
  ) : (
103
- <>
104
+ <GestureHandlerRootView>
104
105
  <View style={styles.wrapDescription}>
105
106
  <Text style={styles.description}>
106
107
  {t('hold_and_hover_description')}
@@ -109,7 +110,8 @@ const EditTemplate = () => {
109
110
  <DraggableFlatList
110
111
  showsVerticalScrollIndicator={false}
111
112
  data={actionsList}
112
- renderItem={({ item, index, drag }) => {
113
+ renderItem={({ item, getIndex, drag }) => {
114
+ const index = getIndex();
113
115
  return (
114
116
  <TouchableOpacity
115
117
  onLongPress={onDrag(item, drag)}
@@ -153,7 +155,7 @@ const EditTemplate = () => {
153
155
  <Text style={styles.save}>{t('save')}</Text>
154
156
  </TouchableOpacity>
155
157
  </View>
156
- </>
158
+ </GestureHandlerRootView>
157
159
  )}
158
160
  </View>
159
161
  );
@@ -2,16 +2,14 @@ import React, { memo, useMemo } from 'react';
2
2
  import { ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';
3
3
  import { getStatusBarHeight } from 'react-native-iphone-x-helper';
4
4
 
5
- import { useTranslations } from '../../hooks/Common/useTranslations';
6
- import { Colors, Theme } from '../../configs';
7
5
  import Text from '../../commons/Text';
6
+ import { Colors, Theme } from '../../configs';
8
7
  import { AccessibilityLabel } from '../../configs/Constants';
9
8
  import { useSCContextSelector } from '../../context';
10
- import useTitleHeader from '../../hooks/Common/useTitleHeader';
9
+ import { useTranslations } from '../../hooks/Common/useTranslations';
11
10
 
12
11
  const UVIndexGuide = memo(() => {
13
12
  const t = useTranslations();
14
- useTitleHeader(t('UV Index Guide'));
15
13
  const language = useSCContextSelector((state) => state.language);
16
14
 
17
15
  const data = useMemo(
@@ -8,7 +8,7 @@ import React, {
8
8
  } from 'react';
9
9
  import { View, ScrollView, TouchableOpacity } from 'react-native';
10
10
  import { useNavigation } from '@react-navigation/native';
11
- import AntDesign from 'react-native-vector-icons/AntDesign';
11
+ import { IconOutline } from '@ant-design/icons-react-native';
12
12
  import { HeaderCustom } from '../../commons/Header';
13
13
  import Text from '../../commons/Text';
14
14
  import NavBar from '../../commons/NavBar';
@@ -142,7 +142,7 @@ const SelectAddToFavorites = memo(({ route }) => {
142
142
  style={styles.buttonClose}
143
143
  onPress={goBack}
144
144
  >
145
- <AntDesign name={'close'} size={24} color={Colors.Black} />
145
+ <IconOutline name={'close'} size={24} color={Colors.Black} />
146
146
  </TouchableOpacity>
147
147
  ),
148
148
  // eslint-disable-next-line react-hooks/exhaustive-deps