@eohjsc/react-native-smart-city 0.3.71 → 0.3.72

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 (151) hide show
  1. package/index.js +0 -2
  2. package/package.json +4 -5
  3. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +1 -1
  4. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +2 -2
  5. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +1 -1
  6. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -11
  7. package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -3
  8. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +1 -0
  9. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +1 -0
  10. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +39 -34
  11. package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +1 -1
  12. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +19 -10
  13. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +0 -1
  14. package/src/commons/ActionGroup/__test__/index.test.js +24 -16
  15. package/src/commons/ActionTemplate/__test__/index.test.js +5 -1
  16. package/src/commons/AlertAction/__test__/AlertAction.test.js +2 -2
  17. package/src/commons/Automate/__test__/ItemAutomate.test.js +1 -1
  18. package/src/commons/Calendar/__test__/Calendar.test.js +3 -5
  19. package/src/commons/CameraDevice/index.js +37 -22
  20. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -3
  21. package/src/commons/Dashboard/MyUnit/index.js +1 -1
  22. package/src/commons/Device/ConnectedViewHeader.js +2 -1
  23. package/src/commons/Device/DeviceAlertStatus.js +1 -1
  24. package/src/commons/Device/DisconnectedView.js +10 -14
  25. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
  26. package/src/commons/Device/HorizontalBarChart.js +1 -1
  27. package/src/commons/Device/LinearChart/LinearChart.test.js +10 -4
  28. package/src/commons/Device/LinearChart.js +5 -1
  29. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +1 -1
  30. package/src/commons/Device/SonosSpeaker/index.js +1 -1
  31. package/src/commons/Device/WindDirection/Compass/Compass.test.js +12 -27
  32. package/src/commons/Device/WindDirection/Compass/index.js +15 -23
  33. package/src/commons/Device/WindSpeed/__test__/Anemometer.test.js +4 -4
  34. package/src/commons/Device/WindSpeed/__test__/ChartInfo.test.js +2 -2
  35. package/src/commons/Device/__test__/ConnectedViewHeader.test.js +11 -8
  36. package/src/commons/Device/__test__/DisconnectedView.test.js +8 -45
  37. package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
  38. package/src/commons/DisplayChecking/index.js +4 -3
  39. package/src/commons/DisplayChecking/styles.js +2 -2
  40. package/src/commons/MediaPlayer/index.js +2 -1
  41. package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
  42. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +0 -1
  43. package/src/commons/MediaPlayerDetail/index.js +2 -3
  44. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +2 -1
  45. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -1
  46. package/src/commons/MenuActionList/index.js +8 -70
  47. package/src/commons/MenuActionList/styles.js +68 -0
  48. package/src/commons/Modal/__test__/ModalBottom.test.js +1 -10
  49. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +45 -31
  50. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +15 -13
  51. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +12 -9
  52. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +19 -13
  53. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -5
  54. package/src/commons/PreventAccess/index.js +3 -3
  55. package/src/commons/Sharing/__test__/MemberList.test.js +17 -6
  56. package/src/commons/Sharing/__test__/RowMember.test.js +0 -2
  57. package/src/commons/SubUnit/OneTap/index.js +6 -1
  58. package/src/commons/Today/__test__/Today.test.js +3 -3
  59. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
  60. package/src/configs/IOPinConstants.js +285 -0
  61. package/src/libs/react-native-parallax-scroll-view/index.js +2 -1
  62. package/src/navigations/AllGatewayStack.js +3 -3
  63. package/src/navigations/UnitStack.js +0 -6
  64. package/src/screens/ActivityLog/__test__/index.test.js +16 -22
  65. package/src/screens/ActivityLog/index.js +2 -3
  66. package/src/screens/AddNewAction/SelectAction.js +3 -0
  67. package/src/screens/AddNewAction/SetupSensor.js +3 -3
  68. package/src/screens/AddNewAction/__test__/SelectAction.test.js +12 -0
  69. package/src/screens/AddNewAction/__test__/SetupSensor.test.js +11 -24
  70. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +0 -1
  71. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +0 -1
  72. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +0 -1
  73. package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +2 -2
  74. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +22 -7
  75. package/src/screens/AllCamera/__test__/index.test.js +1 -1
  76. package/src/screens/AllCamera/index.js +1 -1
  77. package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +82 -0
  78. package/src/screens/AllGateway/DetailConfigActionInternal/index.js +84 -5
  79. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +63 -57
  80. package/src/screens/AllGateway/DeviceInternalDetail/index.js +32 -32
  81. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +40 -79
  82. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -42
  83. package/src/screens/AllGateway/DeviceZigbeeDetail/index.js +4 -4
  84. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +49 -61
  85. package/src/screens/AllGateway/GatewayDetail/index.js +2 -1
  86. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -1
  87. package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
  88. package/src/screens/AllGateway/hooks/useGateway.js +1 -0
  89. package/src/screens/AllGateway/test-utils.js +20 -0
  90. package/src/screens/Device/__test__/detail.test.js +8 -3
  91. package/src/screens/Device/components/SensorDisplayItem.js +1 -5
  92. package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -4
  93. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +32 -4
  94. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -5
  95. package/src/screens/EmergencyContacts/__test__/hooks.test.js +1 -1
  96. package/src/screens/GuestInfo/__test__/index.test.js +26 -14
  97. package/src/screens/HanetCamera/CaptureFaceID.js +1 -1
  98. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +1 -5
  99. package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +1 -1
  100. package/src/screens/PlayBackCamera/Timer.js +2 -3
  101. package/src/screens/PlayBackCamera/__test__/index.test.js +69 -48
  102. package/src/screens/ScanChipQR/components/QRScan/index.js +8 -8
  103. package/src/screens/SharedUnit/__test__/ShareUnit.test.js +20 -10
  104. package/src/screens/SharedUnit/index.js +19 -17
  105. package/src/screens/SmartAccount/Connecting/index.js +2 -2
  106. package/src/screens/SmartAccount/ListDevice/__test__/DeviceItem.test.js +4 -2
  107. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +17 -8
  108. package/src/screens/SmartAccount/ListDevice/index.js +1 -1
  109. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +9 -6
  110. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +1 -0
  111. package/src/screens/SmartAccount/__test__/Connecting.test.js +2 -1
  112. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +17 -6
  113. package/src/screens/SubUnit/EditSubUnit.js +6 -6
  114. package/src/screens/SubUnit/EditSubUnitStyles.js +2 -2
  115. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +5 -6
  116. package/src/screens/SubUnit/__test__/Detail.test.js +2 -3
  117. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +25 -10
  118. package/src/screens/Template/EditTemplate.js +13 -3
  119. package/src/screens/Template/__test__/EditTemplate.test.js +21 -15
  120. package/src/screens/Unit/Detail.js +157 -121
  121. package/src/screens/Unit/ManageUnit.js +3 -3
  122. package/src/screens/Unit/ManageUnitStyles.js +1 -1
  123. package/src/screens/Unit/__test__/Detail.test.js +40 -20
  124. package/src/screens/Unit/__test__/ManageUnit.test.js +18 -15
  125. package/src/screens/Unit/components/AutomateScript/index.js +9 -8
  126. package/src/screens/Unit/components/Header/index.js +1 -14
  127. package/src/screens/Unit/components/__test__/AutomateScript.test.js +10 -36
  128. package/src/screens/Unit/components/__test__/Header.test.js +14 -9
  129. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +4 -5
  130. package/src/utils/Route/index.js +1 -2
  131. package/src/utils/Utils.js +62 -2
  132. package/src/commons/Explore/ActivityIndicator/index.js +0 -49
  133. package/src/commons/Explore/CityItem/index.js +0 -116
  134. package/src/commons/Explore/HeaderExplore/index.js +0 -44
  135. package/src/commons/Explore/HeaderLabel/index.js +0 -46
  136. package/src/commons/Explore/LocationItem/index.js +0 -71
  137. package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +0 -58
  138. package/src/commons/Explore/SearchBox/index.js +0 -59
  139. package/src/commons/Explore/__test__/CityItem.test.js +0 -156
  140. package/src/commons/Explore/__test__/HeaderExplore.test.js +0 -25
  141. package/src/commons/Explore/__test__/HeaderLabel.test.js +0 -33
  142. package/src/commons/Explore/__test__/LocationItem.test.js +0 -31
  143. package/src/screens/Explore/__test__/Explore.test.js +0 -43
  144. package/src/screens/Explore/index.js +0 -201
  145. package/src/screens/Unit/MyAllUnit/index.js +0 -44
  146. package/src/screens/Unit/__test__/MyAllUnit.test.js +0 -87
  147. package/src/screens/Unit/components/ListMyAllUnit/index.js +0 -162
  148. package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +0 -117
  149. package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +0 -36
  150. package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -54
  151. package/src/screens/Unit/components/MyAllUnit/index.js +0 -44
@@ -0,0 +1,285 @@
1
+ export const INTERNAL_DEVICE = {
2
+ ESP32: 'esp32',
3
+ STM32: 'stm32',
4
+ RASPBERRY_PI: 'raspberry_pi',
5
+ };
6
+
7
+ export const TYPE_BOARD = [
8
+ { value: INTERNAL_DEVICE.ESP32, text: 'ESP32' },
9
+ { value: INTERNAL_DEVICE.STM32, text: 'STM32' },
10
+ { value: INTERNAL_DEVICE.RASPBERRY_PI, text: 'Raspberry Pi' },
11
+ ];
12
+
13
+ // DEFAULT
14
+
15
+ export const TYPE_PIN_MODE = {
16
+ OUTPUT: 'output',
17
+ INPUT: 'input',
18
+ };
19
+ export const ARDUINO_PIN_CONFIG_TYPE = [
20
+ { key: 'boolean', value: 'Digital' },
21
+ { key: 'integer', value: 'Analog' },
22
+ ];
23
+
24
+ export const READ_DIGITAL_PIN_MODE = [
25
+ { key: 'input', value: 'Input' },
26
+ { key: 'pull_up', value: 'Pullup' },
27
+ { key: 'pull_down', value: 'Pulldown' },
28
+ ];
29
+
30
+ export const READ_ANALOG_PIN_MODE = [{ key: 'analog', value: 'Analog' }];
31
+
32
+ export const WRITE_DIGITAL_PIN_MODE = [
33
+ { key: 'output', value: 'Output' },
34
+ { key: 'open_drain', value: 'Open drain' },
35
+ ];
36
+
37
+ export const WRITE_ANALOG_PIN_MODE = [{ key: 'pwm', value: 'PWM' }];
38
+
39
+ export const CONFIG_IS_WRITE_IS_READ_PIN_MODE = [
40
+ { key: 'output', value: 'Input' },
41
+ ];
42
+
43
+ // ESP32
44
+
45
+ export const ESP32_DIGITAL = [
46
+ { key: '0', value: 'GPIO 0' },
47
+ { key: '1', value: 'GPIO 1 - UART 0 TX' },
48
+ { key: '2', value: 'GPIO 2' },
49
+ { key: '3', value: 'GPIO 3 - UART 0 RX' },
50
+ { key: '4', value: 'GPIO 4' },
51
+ { key: '5', value: 'GPIO 5' },
52
+ { key: '12', value: 'GPIO 12' },
53
+ { key: '13', value: 'GPIO 13' },
54
+ { key: '14', value: 'GPIO 14' },
55
+ { key: '15', value: 'GPIO 15' },
56
+ { key: '16', value: 'GPIO 16 - UART 1 RX' },
57
+ { key: '17', value: 'GPIO 17 - UART 1 TX' },
58
+ { key: '18', value: 'GPIO 18' },
59
+ { key: '19', value: 'GPIO 19' },
60
+ { key: '21', value: 'GPIO 21' },
61
+ { key: '22', value: 'GPIO 22' },
62
+ { key: '23', value: 'GPIO 23' },
63
+ { key: '25', value: 'GPIO 25' },
64
+ { key: '26', value: 'GPIO 26' },
65
+ { key: '27', value: 'GPIO 27' },
66
+ { key: '32', value: 'GPIO 32 - ADC1 CH4' },
67
+ { key: '34', value: 'GPIO 34 - ADC1 CH6' },
68
+ { key: '35', value: 'GPIO 35 - ADC1 CH7' },
69
+ { key: '36', value: 'GPIO 36 - ADC1 CH0' },
70
+ { key: '39', value: 'GPIO 39 - ADC1 CH3' },
71
+ ];
72
+
73
+ export const ESP32_ANALOG_READ = [
74
+ { key: '36', value: 'GPIO 36 - ADC1 CH0 - A0' },
75
+ { key: '37', value: 'GPIO 37 - ADC1 CH0 - A1' },
76
+ { key: '38', value: 'GPIO 38 - ADC1 CH0 - A2' },
77
+ { key: '39', value: 'GPIO 39 - ADC1 CH0 - A3' },
78
+ { key: '32', value: 'GPIO 32 - ADC1 CH0 - A4' },
79
+ { key: '33', value: 'GPIO 33 - ADC1 CH0 - A5' },
80
+ { key: '34', value: 'GPIO 34 - ADC1 CH0 - A6' },
81
+ { key: '35', value: 'GPIO 35 - ADC1 CH0 - A7' },
82
+ ];
83
+
84
+ export const ESP32_ANALOG_WRITE = [
85
+ { key: '0', value: 'GPIO 0' },
86
+ { key: '1', value: 'GPIO 1 - UART 0 TX' },
87
+ { key: '2', value: 'GPIO 2' },
88
+ { key: '3', value: 'GPIO 3 - UART 0 RX' },
89
+ { key: '4', value: 'GPIO 4' },
90
+ { key: '5', value: 'GPIO 5' },
91
+ { key: '12', value: 'GPIO 12' },
92
+ { key: '13', value: 'GPIO 13' },
93
+ { key: '14', value: 'GPIO 14' },
94
+ { key: '15', value: 'GPIO 15' },
95
+ { key: '16', value: 'GPIO 16 - UART 2 RX' },
96
+ { key: '17', value: 'GPIO 17 - UART 2 TX' },
97
+ { key: '18', value: 'GPIO 18' },
98
+ { key: '19', value: 'GPIO 19' },
99
+ { key: '21', value: 'GPIO 21' },
100
+ { key: '22', value: 'GPIO 22' },
101
+ { key: '23', value: 'GPIO 23' },
102
+ { key: '25', value: 'GPIO 25' },
103
+ { key: '26', value: 'GPIO 26' },
104
+ { key: '27', value: 'GPIO 27' },
105
+ ];
106
+
107
+ // RASPBERRY
108
+
109
+ export const RASPBERRY_PI_DIGITAL = [
110
+ { key: '0', value: 'GPIO 0 - UART TXD' },
111
+ { key: '1', value: 'GPIO 1 - UART RXD' },
112
+ { key: '2', value: 'GPIO 2' },
113
+ { key: '3', value: 'GPIO 3' },
114
+ { key: '4', value: 'GPIO 4 - UART TXD' },
115
+ { key: '5', value: 'GPIO 5 - UART RXD' },
116
+ { key: '6', value: 'GPIO 6' },
117
+ { key: '7', value: 'GPIO 7' },
118
+ { key: '8', value: 'GPIO 8 - UART TXD' },
119
+ { key: '9', value: 'GPIO 9 - UART RXD' },
120
+ { key: '10', value: 'GPIO 10' },
121
+ { key: '11', value: 'GPIO 11' },
122
+ { key: '12', value: 'GPIO 12 - PWM 0 - UART TXD' },
123
+ { key: '13', value: 'GPIO 13 - PWM 1 - UART RXD' },
124
+ { key: '14', value: 'GPIO 14 - UART TXD' },
125
+ { key: '15', value: 'GPIO 15 - UART RXD' },
126
+ { key: '16', value: 'GPIO 16' },
127
+ { key: '17', value: 'GPIO 17' },
128
+ { key: '18', value: 'GPIO 18 - PWM 0' },
129
+ { key: '19', value: 'GPIO 19 - PWM 1' },
130
+ { key: '20', value: 'GPIO 20' },
131
+ { key: '21', value: 'GPIO 21' },
132
+ { key: '22', value: 'GPIO 22' },
133
+ { key: '23', value: 'GPIO 23' },
134
+ { key: '24', value: 'GPIO 24' },
135
+ { key: '25', value: 'GPIO 25' },
136
+ { key: '26', value: 'GPIO 26' },
137
+ { key: '27', value: 'GPIO 27' },
138
+ ];
139
+
140
+ export const RASPBERRY_PI_ANALOG_READ = [];
141
+
142
+ export const RASPBERRY_PI_ANALOG_WRITE = [
143
+ { key: '12', value: 'GPIO 12 - PWM 0 - UART TXD' },
144
+ { key: '13', value: 'GPIO 13 - PWM 1 - UART RXD' },
145
+ { key: '18', value: 'GPIO 18 - PWM 0' },
146
+ { key: '19', value: 'GPIO 19 - PWM 1' },
147
+ ];
148
+
149
+ export const STM32_DIGITAL_READ = [
150
+ { key: '0', value: 'PE1' },
151
+ { key: '1', value: 'PE0' },
152
+ { key: '2', value: 'PB9' },
153
+ { key: '3', value: 'PB8' },
154
+ { key: '4', value: 'PB7' },
155
+ { key: '5', value: 'PB6' },
156
+ { key: '6', value: 'PB5' },
157
+ { key: '7', value: 'PB3' },
158
+ { key: '8', value: 'PD7' },
159
+ { key: '9', value: 'PD6' },
160
+ { key: '10', value: 'PD5' },
161
+ { key: '11', value: 'PD4' },
162
+ { key: '12', value: 'PD3' },
163
+ { key: '13', value: 'PD2' },
164
+ { key: '14', value: 'PD1' },
165
+ { key: '15', value: 'PD0' },
166
+ { key: '16', value: 'PC12' },
167
+ { key: '17', value: 'PC11' },
168
+ { key: '18', value: 'PC10' },
169
+ { key: '19', value: 'PA15' },
170
+ { key: '20', value: 'PA12' },
171
+ { key: '21', value: 'PA11' },
172
+ { key: '22', value: 'PA10' },
173
+ { key: '23', value: 'PA9' },
174
+ { key: '24', value: 'PA8' },
175
+ { key: '25', value: 'PC9' },
176
+ { key: '26', value: 'PC8' },
177
+ { key: '27', value: 'PC7' },
178
+ { key: '28', value: 'PC6' },
179
+ { key: '29', value: 'PD15' },
180
+ { key: '30', value: 'PD14' },
181
+ { key: '31', value: 'PD13' },
182
+ { key: '32', value: 'PD12' },
183
+ { key: '33', value: 'PD11' },
184
+ { key: '34', value: 'PD10' },
185
+ { key: '35', value: 'PD9' },
186
+ { key: '36', value: 'PD8' },
187
+ { key: '37', value: 'PB15' },
188
+ { key: '38', value: 'PE2' },
189
+ { key: '39', value: 'PE3' },
190
+ { key: '40', value: 'PE4' },
191
+ { key: '41', value: 'PE5' },
192
+ { key: '42', value: 'PE6' },
193
+ { key: '43', value: 'PC13' },
194
+ { key: '44', value: 'PC0' },
195
+ { key: '45', value: 'PC1' },
196
+ { key: '46', value: 'PC2' },
197
+ { key: '47', value: 'PC3' },
198
+ { key: '48', value: 'PA0' },
199
+ { key: '49', value: 'PA1' },
200
+ { key: '50', value: 'PA2' },
201
+ { key: '51', value: 'PA3' },
202
+ { key: '52', value: 'PA4' },
203
+ { key: '53', value: 'PA5' },
204
+ { key: '54', value: 'PC4' },
205
+ { key: '55', value: 'PC5' },
206
+ { key: '56', value: 'PB0' },
207
+ { key: '57', value: 'PB1' },
208
+ { key: '58', value: 'PA6' },
209
+ { key: '59', value: 'PA7' },
210
+ { key: '60', value: 'PE7' },
211
+ { key: '61', value: 'PE8' },
212
+ { key: '62', value: 'PE9' },
213
+ { key: '63', value: 'PE10' },
214
+ { key: '64', value: 'PE11' },
215
+ { key: '65', value: 'PE12' },
216
+ { key: '66', value: 'PE13' },
217
+ { key: '67', value: 'PE14' },
218
+ { key: '68', value: 'PE15' },
219
+ { key: '69', value: 'PB10' },
220
+ { key: '70', value: 'PB11' },
221
+ { key: '71', value: 'PB12' },
222
+ { key: '72', value: 'PB13' },
223
+ { key: '73', value: 'PB14' },
224
+ { key: '74', value: 'PB4' },
225
+ ];
226
+ export const STM32_ANALOG_READ = [
227
+ { key: '44', value: 'PCO-A0' },
228
+ { key: '45', value: 'PC1-A1' },
229
+ { key: '46', value: 'PC2-A2' },
230
+ { key: '47', value: 'PC3-A3' },
231
+ { key: '48', value: 'PA0-A4' },
232
+ { key: '49', value: 'PA1-A5' },
233
+ { key: '50', value: 'PA2-A6' },
234
+ { key: '51', value: 'PA3-A7' },
235
+ { key: '52', value: 'PA4-A8' },
236
+ { key: '53', value: 'PA5-A9' },
237
+ { key: '54', value: 'PC4-A10' },
238
+ { key: '55', value: 'PC5-A11' },
239
+ { key: '56', value: 'PB0-A12' },
240
+ { key: '57', value: 'PB1-A13' },
241
+ { key: '58', value: 'PA6-A14' },
242
+ { key: '59', value: 'PA7-A15' },
243
+ ];
244
+ export const STM32_DIGITAL_WRITE = STM32_DIGITAL_READ;
245
+ export const STM32_ANALOG_WRITE = [
246
+ { key: '2', value: 'PB9' },
247
+ { key: '3', value: 'PB8' },
248
+ { key: '4', value: 'PB7' },
249
+ { key: '5', value: 'PB6' },
250
+ { key: '6', value: 'PB5' },
251
+ { key: '7', value: 'PB3' },
252
+ { key: '19', value: 'PA15' },
253
+ { key: '21', value: 'PA11' },
254
+ { key: '22', value: 'PA10' },
255
+ { key: '23', value: 'PA9' },
256
+ { key: '24', value: 'PA8' },
257
+ { key: '25', value: 'PC8' },
258
+ { key: '26', value: 'PC8' },
259
+ { key: '27', value: 'PC7' },
260
+ { key: '28', value: 'PC6' },
261
+ { key: '29', value: 'PD15' },
262
+ { key: '30', value: 'PD14' },
263
+ { key: '31', value: 'PD13' },
264
+ { key: '32', value: 'PD12' },
265
+ { key: '37', value: 'PB15' },
266
+ { key: '41', value: 'PE5' },
267
+ { key: '42', value: 'PE6' },
268
+ { key: '48', value: 'PA0' },
269
+ { key: '49', value: 'PA1' },
270
+ { key: '50', value: 'PA2' },
271
+ { key: '51', value: 'PA3' },
272
+ { key: '53', value: 'PA5' },
273
+ { key: '58', value: 'PA6' },
274
+ { key: '59', value: 'PA7' },
275
+ { key: '61', value: 'PE9' },
276
+ { key: '62', value: 'PE9' },
277
+ { key: '63', value: 'PE10' },
278
+ { key: '64', value: 'PE11' },
279
+ { key: '65', value: 'PE12' },
280
+ { key: '66', value: 'PE13' },
281
+ { key: '67', value: 'PE14' },
282
+ { key: '72', value: 'PB13' },
283
+ { key: '73', value: 'PB14' },
284
+ { key: '74', value: 'PB4' },
285
+ ];
@@ -1,7 +1,8 @@
1
1
  import React, { Component } from 'react';
2
- import { Animated, Dimensions, View, ViewPropTypes } from 'react-native';
2
+ import { Animated, Dimensions, View } from 'react-native';
3
3
  import styles from './styles';
4
4
  import { bool, func, number, string } from 'prop-types';
5
+ import {ViewPropTypes} from "deprecated-react-native-prop-types";
5
6
  const window = Dimensions.get('window');
6
7
  const SCROLLVIEW_REF = 'ScrollView';
7
8
  const pivotPoint = (a, b) => a - b;
@@ -11,7 +11,7 @@ import DetailConfigActionZigbee from '../screens/AllGateway/DetailConfigActionZi
11
11
  import DeviceModbusDetail from '../screens/AllGateway/DeviceModbusDetail';
12
12
  import DetailConfigActionModbus from '../screens/AllGateway/DetailConfigActionModbus';
13
13
  import DetailChildConfigActionModbus from '../screens/AllGateway/DetailConfigActionModbus';
14
- import DetailConfigActionInterval from '../screens/AllGateway/DetailConfigActionInternal';
14
+ import DetailConfigActionInternal from '../screens/AllGateway/DetailConfigActionInternal';
15
15
  import Route from '../utils/Route'; // utils/Route
16
16
  import { screenOptions } from './utils';
17
17
 
@@ -52,8 +52,8 @@ export const AllGatewayStack = memo(() => {
52
52
  name={Route.DetailConfigActionZigbee}
53
53
  />
54
54
  <Stack.Screen
55
- component={DetailConfigActionInterval}
56
- name={Route.DetailConfigActionInterval}
55
+ component={DetailConfigActionInternal}
56
+ name={Route.DetailConfigActionInternal}
57
57
  />
58
58
  <Stack.Screen
59
59
  component={DetailConfigActionModbus}
@@ -25,7 +25,6 @@ import SelectAddress from '../screens/Unit/SelectAddress';
25
25
  import ChooseLocation from '../screens/Unit/ChooseLocation';
26
26
  import ManageUnit from '../screens/Unit/ManageUnit';
27
27
  import ListSmartAccount from '../screens/Unit/SmartAccount';
28
- import MyAllUnit from '../screens/Unit/MyAllUnit';
29
28
  import SubUnitDetail from '../screens/SubUnit/Detail';
30
29
  import UnitDetail from '../screens/Unit/Detail';
31
30
  import UnitSummary from '../screens/UnitSummary';
@@ -190,11 +189,6 @@ export const UnitStack = memo((props) => {
190
189
  initialParams={get(props, 'route.params', null)}
191
190
  options={{ headerShown: false }}
192
191
  />
193
- <Stack.Screen
194
- name={Route.MyAllUnit}
195
- component={MyAllUnit}
196
- options={{ headerShown: false }}
197
- />
198
192
  <Stack.Screen
199
193
  name={Route.ManageUnit}
200
194
  component={ManageUnit}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SectionList, Text, TouchableOpacity } from 'react-native';
2
+ import { SectionList, Text } from 'react-native';
3
3
  import { create } from 'react-test-renderer';
4
4
  import { act } from '@testing-library/react-hooks';
5
5
  import MockAdapter from 'axios-mock-adapter';
@@ -24,6 +24,12 @@ jest.mock('react-redux', () => {
24
24
  useSelector: () => mockUseSelector,
25
25
  };
26
26
  });
27
+ jest.mock('react', () => {
28
+ return {
29
+ ...jest.requireActual('react'),
30
+ memo: (x) => x,
31
+ };
32
+ });
27
33
 
28
34
  const mock = new MockAdapter(api.axiosInstance);
29
35
 
@@ -69,18 +75,6 @@ describe('Test Activity log', () => {
69
75
  const instance = tree.root;
70
76
  const SectionListElement = instance.findAllByType(SectionList);
71
77
  expect(SectionListElement).toHaveLength(1);
72
- const TextElement = instance.findAllByType(Text);
73
- expect(TextElement[2].props.style).toEqual([
74
- {
75
- color: '#000',
76
- fontFamily: 'SFProDisplay-Regular',
77
- fontSize: undefined,
78
- lineHeight: undefined,
79
- textAlign: 'left',
80
- textDecorationLine: 'none',
81
- },
82
- { textAlign: 'center' },
83
- ]);
84
78
  });
85
79
 
86
80
  it('render list', async () => {
@@ -108,20 +102,20 @@ describe('Test Activity log', () => {
108
102
  tree = await create(wrapComponent(route));
109
103
  });
110
104
  const instance = tree.root;
111
- const dateTimeRangeChange = instance.findByType(DateTimeRangeChange);
112
105
  const filterPopup = instance.findAllByType(Modal);
113
- const datePicker = instance.findByType(DateTimePickerModal);
114
- const filterButton = instance.find(
115
- (el) =>
116
- el.props.accessibilityLabel === AccessibilityLabel.FILTER_BUTTON &&
117
- el.type === TouchableOpacity
118
- );
119
- // open popup
120
106
  expect(filterPopup[0].props.isVisible).toBeFalsy();
107
+
108
+ const filterButton = instance.findByProps({
109
+ accessibilityLabel: AccessibilityLabel.FILTER_BUTTON,
110
+ });
121
111
  await act(async () => {
122
- await filterButton.props.onPress();
112
+ filterButton.props.onPress();
123
113
  });
124
114
  expect(filterPopup[0].props.isVisible).toBeTruthy();
115
+
116
+ const dateTimeRangeChange = instance.findByType(DateTimeRangeChange);
117
+ const datePicker = instance.findByType(DateTimePickerModal);
118
+
125
119
  // pick start date
126
120
  await act(async () => {
127
121
  await dateTimeRangeChange.props.onStart();
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-shadow */
2
1
  import React, { useEffect, useMemo } from 'react';
3
2
  import {
4
3
  View,
@@ -63,9 +62,9 @@ const ActivityLogScreen = ({ route }) => {
63
62
  <ActivityIndicator color={Colors.Primary} style={styles.loadMore} />
64
63
  );
65
64
 
66
- const renderSectionHeader = ({ section: { data } }) => (
65
+ const renderSectionHeader = ({ section: { data: sectionData } }) => (
67
66
  <Text style={styles.title}>
68
- {getTitleFromTime(data[0].created_at, new Date())}
67
+ {getTitleFromTime(sectionData[0].created_at, new Date())}
69
68
  </Text>
70
69
  );
71
70
  useEffect(() => {
@@ -540,6 +540,7 @@ const RenderActionItem = ({ device, data, onSelectAction }) => {
540
540
  )}
541
541
  {numberUpDownActionTemplates.map((item) => (
542
542
  <NumberUpDownActionTemplate
543
+ key={item.id}
543
544
  device={device}
544
545
  data={item}
545
546
  onSelectAction={handleOnSelectAction}
@@ -548,6 +549,7 @@ const RenderActionItem = ({ device, data, onSelectAction }) => {
548
549
 
549
550
  {optionsDropdownActionTemplates.map((item) => (
550
551
  <OptionsDropdownActionTemplate
552
+ key={item.id}
551
553
  device={device}
552
554
  data={item}
553
555
  onSelectAction={handleOnSelectAction}
@@ -555,6 +557,7 @@ const RenderActionItem = ({ device, data, onSelectAction }) => {
555
557
  ))}
556
558
  {statesGridActionTemplates.map((item) => (
557
559
  <StatesGridActionTemplate
560
+ key={item.id}
558
561
  device={device}
559
562
  data={item}
560
563
  onSelectAction={handleOnSelectAction}
@@ -236,10 +236,10 @@ const SetUpSensor = () => {
236
236
  <View style={styles.modalContent}>
237
237
  {(isNumberValue
238
238
  ? modalNumberConditionData
239
- : /* Disable picking not_active/not_dectect option -> temporaly remove not_acitve option */
239
+ : /* Huy Disable picking not_active/not_detect option -> temporally remove not_active option */
240
240
  modalStateConditionData?.stateValue.slice(1)
241
241
  ).map((i, index) => (
242
- <>
242
+ <React.Fragment key={index}>
243
243
  <TouchableOpacity
244
244
  onPress={onChooseCondition(i)}
245
245
  key={index}
@@ -252,7 +252,7 @@ const SetUpSensor = () => {
252
252
  {index !== modalNumberConditionData.length - 1 && (
253
253
  <View style={styles.separated} />
254
254
  )}
255
- </>
255
+ </React.Fragment>
256
256
  ))}
257
257
  </View>
258
258
  </ModalCustom>
@@ -10,6 +10,7 @@ import { AccessibilityLabel, DEVICE_TYPE } from '../../../configs/Constants';
10
10
  import api from '../../../utils/Apis/axios';
11
11
  import { API } from '../../../configs';
12
12
  import { TouchableOpacity } from 'react-native';
13
+ import SelectActionCard from '../../../commons/SelectActionCard';
13
14
 
14
15
  const mock = new MockAdapter(api.axiosInstance);
15
16
 
@@ -101,6 +102,7 @@ describe('Test SelectAction', () => {
101
102
  success: true,
102
103
  data: [
103
104
  {
105
+ id: 1,
104
106
  title: '',
105
107
  template: 'OnOffSimpleActionTemplate',
106
108
  configuration: {
@@ -111,6 +113,7 @@ describe('Test SelectAction', () => {
111
113
  },
112
114
  },
113
115
  {
116
+ id: 2,
114
117
  title: 'Fan Speed',
115
118
  template: 'OptionsDropdownActionTemplate',
116
119
  configuration: {
@@ -134,6 +137,7 @@ describe('Test SelectAction', () => {
134
137
  },
135
138
  },
136
139
  {
140
+ id: 3,
137
141
  title: '',
138
142
  template: 'NumberUpDownActionTemplate',
139
143
  configuration: {
@@ -147,6 +151,7 @@ describe('Test SelectAction', () => {
147
151
  },
148
152
  },
149
153
  {
154
+ id: 4,
150
155
  title: '',
151
156
  template: 'NumberUpDownActionTemplate',
152
157
  configuration: {
@@ -159,6 +164,7 @@ describe('Test SelectAction', () => {
159
164
  },
160
165
  },
161
166
  {
167
+ id: 5,
162
168
  title: '',
163
169
  template: 'StatesGridActionTemplate',
164
170
  configuration: {
@@ -187,6 +193,12 @@ describe('Test SelectAction', () => {
187
193
  );
188
194
  expect(renderActionItem.props.data.length).toBe(5);
189
195
 
196
+ const cards = instance.findAllByType(SelectActionCard);
197
+ // force all render
198
+ await act(async () => {
199
+ cards.map((card) => card.props.onPress());
200
+ });
201
+
190
202
  const simpleActionOn = instance.find(
191
203
  (el) =>
192
204
  el.props.accessibilityLabel ===
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React from 'react';
2
2
  import { TouchableOpacity } from 'react-native';
3
3
  import { act, create } from 'react-test-renderer';
4
4
  import { HorizontalPicker } from '../../../commons';
@@ -8,7 +8,6 @@ import BottomButtonView from '../../../commons/BottomButtonView';
8
8
  import SetUpSensor from '../SetupSensor';
9
9
  import { useRoute } from '@react-navigation/native';
10
10
 
11
- const mockSetState = jest.fn();
12
11
  const mockSetSensorData = jest.fn();
13
12
  const mockDispatch = jest.fn();
14
13
  const mockGoBack = jest.fn();
@@ -17,7 +16,6 @@ jest.mock('react', () => {
17
16
  return {
18
17
  ...jest.requireActual('react'),
19
18
  memo: (x) => x,
20
- useState: jest.fn((init) => [init, mockSetState]),
21
19
  };
22
20
  });
23
21
 
@@ -40,9 +38,7 @@ const wrapComponent = (configuration, onPress) => (
40
38
 
41
39
  describe('Test SetUpSensor', () => {
42
40
  let tree;
43
-
44
- afterEach(() => {
45
- mockSetState.mockClear();
41
+ beforeEach(() => {
46
42
  useRoute.mockClear();
47
43
  });
48
44
 
@@ -66,28 +62,25 @@ describe('Test SetUpSensor', () => {
66
62
  tree = await create(wrapComponent());
67
63
  });
68
64
  const instance = tree.root;
69
- const TouchableOpacities = instance.findAllByType(TouchableOpacity);
70
- expect(TouchableOpacities).toHaveLength(7);
65
+
71
66
  await act(async () => {
72
- TouchableOpacities[1].props.onPress();
73
- TouchableOpacities[2].props.onPress();
67
+ instance.findAllByType(TouchableOpacity)[0].props.onPress();
68
+ instance.findAllByType(TouchableOpacity)[1].props.onPress();
69
+ instance.findAllByType(TouchableOpacity)[2].props.onPress();
74
70
  });
75
- expect(mockSetState).toBeCalledWith(true);
71
+
72
+ const touchableOpacities = instance.findAllByType(TouchableOpacity);
76
73
  expect(mockDispatch).toBeCalled();
74
+
77
75
  await act(async () => {
78
- TouchableOpacities[4].props.onPress();
79
- });
80
- expect(mockSetState).toBeCalledWith({
81
- conditionValue: '<',
82
- title: 'is below (<)',
83
- type: 'IS_BELOW',
76
+ touchableOpacities[4].props.onPress();
84
77
  });
85
78
  const HorizontalPickers = instance.findAllByType(HorizontalPicker);
86
79
  expect(HorizontalPickers).toHaveLength(1);
87
80
  await act(async () => {
88
81
  HorizontalPickers[0].props.onChangeValue(128);
89
82
  });
90
- expect(mockSetState).toBeCalledWith(false);
83
+
91
84
  const BottomButtonViews = instance.findAllByType(BottomButtonView);
92
85
  expect(BottomButtonViews).toHaveLength(1);
93
86
  await act(async () => {
@@ -111,12 +104,6 @@ describe('Test SetUpSensor', () => {
111
104
  setSensorData: () => mockSetSensorData,
112
105
  },
113
106
  });
114
- useState.mockImplementation((init) => [init, mockSetState]);
115
- useState.mockImplementation((init) => [100, mockSetState]);
116
- useState.mockImplementation((init) => [100, mockSetState]);
117
- useState.mockImplementation((init) => [100, mockSetState]);
118
- useState.mockImplementation((init) => [100, mockSetState]);
119
- useState.mockImplementation((init) => [init, mockSetState]);
120
107
  await act(async () => {
121
108
  tree = await create(wrapComponent());
122
109
  });
@@ -41,7 +41,6 @@ describe('Test ConnectRouterGuide', () => {
41
41
  });
42
42
  const instance = tree.root;
43
43
  const texts = instance.findAllByType(Text);
44
- expect(texts).toHaveLength(8);
45
44
  expect(texts[1].props.children).toEqual(
46
45
  getTranslate('en', 'connect_to_router')
47
46
  );
@@ -41,7 +41,6 @@ describe('Test FirstWarning', () => {
41
41
  });
42
42
  const instance = tree.root;
43
43
  const texts = instance.findAllByType(Text);
44
- expect(texts).toHaveLength(10);
45
44
  expect(texts[1].props.children).toEqual(
46
45
  getTranslate('en', 'warning_beta_test_feature')
47
46
  );
@@ -41,7 +41,6 @@ describe('Test ZigbeeDeviceConnectGuide', () => {
41
41
  });
42
42
  const instance = tree.root;
43
43
  const texts = instance.findAllByType(Text);
44
- expect(texts).toHaveLength(8);
45
44
  expect(texts[1].props.children).toEqual(
46
45
  getTranslate('en', 'turn_on_device_to_connect')
47
46
  );
@@ -66,7 +66,7 @@ export default StyleSheet.create({
66
66
  backgroundColor: Colors.White,
67
67
  borderRadius: 10,
68
68
  },
69
- maskOutter: {
69
+ maskOuter: {
70
70
  position: 'absolute',
71
71
  top: 0,
72
72
  left: 0,
@@ -75,7 +75,7 @@ export default StyleSheet.create({
75
75
  alignItems: 'center',
76
76
  justifyContent: 'space-around',
77
77
  },
78
- viewVerifing: {
78
+ viewVerifying: {
79
79
  marginLeft: 16,
80
80
  height: 54,
81
81
  width: Device.screenWidth - 32,