@eohjsc/react-native-smart-city 0.2.97 → 0.2.98

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 (68) hide show
  1. package/package.json +2 -2
  2. package/src/commons/Action/ItemQuickAction.js +5 -2
  3. package/src/commons/ActionGroup/ColorPickerTemplate.js +1 -1
  4. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +10 -2
  5. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +4 -1
  6. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +1 -0
  7. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +12 -10
  8. package/src/commons/ActionGroup/OnOffTemplate/index.js +38 -5
  9. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +8 -2
  10. package/src/commons/ActionGroup/SliderRangeTemplate.js +1 -1
  11. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +4 -1
  12. package/src/commons/ActionGroup/StatesGridActionTemplate.js +14 -4
  13. package/src/commons/ActionGroup/TimerActionTemplate.js +9 -1
  14. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +7 -3
  15. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +14 -14
  16. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +53 -78
  17. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +36 -20
  18. package/src/commons/Auth/AccountList.js +1 -1
  19. package/src/commons/Device/HistoryChart.js +4 -0
  20. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +16 -12
  21. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -0
  22. package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +1 -0
  23. package/src/commons/FullLoading/index.js +2 -1
  24. package/src/commons/MenuActionAddnew/index.js +1 -0
  25. package/src/commons/MenuActionList/index.js +1 -0
  26. package/src/commons/MenuActionMore/index.js +1 -1
  27. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +62 -0
  28. package/src/commons/PreventAccess/index.js +9 -1
  29. package/src/configs/Constants.js +4 -0
  30. package/src/context/actionType.ts +1 -0
  31. package/src/context/reducer.ts +3 -0
  32. package/src/screens/AQIGuide/index.js +1 -1
  33. package/src/screens/ActivityLog/FilterPopup.js +2 -0
  34. package/src/screens/AddCommon/SelectSubUnit.js +1 -0
  35. package/src/screens/AddCommon/SelectUnit.js +1 -0
  36. package/src/screens/AddLocationMaps/index.js +4 -1
  37. package/src/screens/AddNewAction/SelectSensorDevices.js +6 -1
  38. package/src/screens/AddNewDevice/index.js +1 -0
  39. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +4 -1
  40. package/src/screens/AddNewGateway/SelectGateway.js +1 -0
  41. package/src/screens/AddNewGateway/SetupGatewayWifi.js +1 -0
  42. package/src/screens/AddNewGateway/index.js +1 -0
  43. package/src/screens/AddNewOneTap/index.js +1 -1
  44. package/src/screens/Automate/index.js +2 -0
  45. package/src/screens/Device/detail.js +9 -1
  46. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +14 -0
  47. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +19 -1
  48. package/src/screens/EmergencySetting/index.js +4 -1
  49. package/src/screens/Explore/index.js +2 -0
  50. package/src/screens/ManageAccess/index.js +1 -0
  51. package/src/screens/MoveToAnotherSubUnit/index.js +1 -1
  52. package/src/screens/ScriptDetail/index.js +2 -2
  53. package/src/screens/SelectUnit/index.js +1 -0
  54. package/src/screens/SetSchedule/index.js +4 -1
  55. package/src/screens/SharedUnit/index.js +2 -0
  56. package/src/screens/Sharing/MemberList.js +12 -11
  57. package/src/screens/Sharing/SelectPermission.js +1 -0
  58. package/src/screens/Sharing/hooks/index.js +3 -0
  59. package/src/screens/SmartIr/components/SelectBrand.js +1 -1
  60. package/src/screens/SubUnit/ManageSubUnit.js +1 -0
  61. package/src/screens/SyncLGDevice/AddLGDevice.js +1 -0
  62. package/src/screens/TDSGuide/index.js +4 -1
  63. package/src/screens/UVIndexGuide/index.js +1 -1
  64. package/src/screens/Unit/SelectAddress.js +4 -1
  65. package/src/screens/Unit/Station/index.js +1 -0
  66. package/src/screens/Unit/Summaries.js +1 -1
  67. package/src/screens/UnitSummary/__test__/index.test.js +32 -0
  68. package/src/screens/WaterQualityGuide/index.js +1 -1
@@ -1,11 +1,25 @@
1
+ /* eslint-disable promise/prefer-await-to-callbacks */
1
2
  import { TESTID } from '../../../configs/Constants';
2
3
  import { watchMultiConfigs } from '../../../iot/Monitor';
3
4
  import React from 'react';
4
5
  import { View } from 'react-native';
6
+ import { useSelector } from 'react-redux';
5
7
  import { act, create } from 'react-test-renderer';
6
8
  import OnOffTemplate from '../OnOffTemplate';
7
9
  import OnOffButtonTemplate from '../OnOffTemplate/OnOffButtonTemplate';
8
10
  import OnOffSimpleTemplate from '../OnOffTemplate/OnOffSimpleTemplate';
11
+ import { mockSCStore } from '../../../context/mockStore';
12
+ import { SCProvider } from '../../../context';
13
+
14
+ const wrapComponent = (actionGroup, mockDoAction, sensor) => (
15
+ <SCProvider initState={mockSCStore({})}>
16
+ <OnOffTemplate
17
+ actionGroup={actionGroup}
18
+ doAction={mockDoAction}
19
+ sensor={sensor}
20
+ />
21
+ </SCProvider>
22
+ );
9
23
 
10
24
  jest.mock('../../../iot/Monitor');
11
25
 
@@ -13,9 +27,15 @@ jest.mock('../../../iot/states', () => ({
13
27
  useConfigGlobalState: () => [{ 5: 2 }, null],
14
28
  }));
15
29
 
30
+ jest.mock('react-redux', () => ({
31
+ ...jest.requireActual('react-redux'),
32
+ useSelector: jest.fn(),
33
+ }));
34
+
16
35
  describe('Test OnOffTemplate', () => {
17
- let wrapper;
18
36
  let actionGroup;
37
+ let tree;
38
+ let sensor;
19
39
 
20
40
  const action_data = {
21
41
  color: '#00979D',
@@ -62,20 +82,23 @@ describe('Test OnOffTemplate', () => {
62
82
  },
63
83
  title: 'Turn on / off',
64
84
  };
85
+
86
+ sensor = { name: 'Sensor' };
87
+
88
+ const localState = {
89
+ isOnSwich: false,
90
+ };
91
+ useSelector.mockImplementation((cb) => {
92
+ return cb(localState);
93
+ });
65
94
  });
66
95
 
67
96
  test('render with template OnOffSimpleActionTemplate', async () => {
68
97
  const mockDoAction = jest.fn();
69
98
  await act(async () => {
70
- wrapper = await create(
71
- <OnOffTemplate
72
- actionGroup={actionGroup}
73
- doAction={mockDoAction}
74
- sensor={{}}
75
- />
76
- );
99
+ tree = await create(wrapComponent(actionGroup, mockDoAction, {}));
77
100
  });
78
- const instance = wrapper.root;
101
+ const instance = tree.root;
79
102
  const template = instance.findAllByType(OnOffSimpleTemplate);
80
103
  expect(template).toHaveLength(1);
81
104
  });
@@ -84,15 +107,9 @@ describe('Test OnOffTemplate', () => {
84
107
  actionGroup.template = 'on_off_button_action_template';
85
108
  const mockDoAction = jest.fn();
86
109
  await act(async () => {
87
- wrapper = await create(
88
- <OnOffTemplate
89
- actionGroup={actionGroup}
90
- doAction={mockDoAction}
91
- sensor={{}}
92
- />
93
- );
110
+ tree = await create(wrapComponent(actionGroup, mockDoAction, {}));
94
111
  });
95
- const instance = wrapper.root;
112
+ const instance = tree.root;
96
113
  const template = instance.findAllByType(OnOffButtonTemplate);
97
114
  expect(template).toHaveLength(0);
98
115
  });
@@ -101,15 +118,9 @@ describe('Test OnOffTemplate', () => {
101
118
  actionGroup.template = 'wrong_template';
102
119
  const mockDoAction = jest.fn();
103
120
  await act(async () => {
104
- wrapper = await create(
105
- <OnOffTemplate
106
- actionGroup={actionGroup}
107
- doAction={mockDoAction}
108
- sensor={{}}
109
- />
110
- );
121
+ tree = await create(wrapComponent(actionGroup, mockDoAction, {}));
111
122
  });
112
- const instance = wrapper.root;
123
+ const instance = tree.root;
113
124
 
114
125
  const templateOnOffButton = instance.findAll(
115
126
  (el) =>
@@ -125,32 +136,20 @@ describe('Test OnOffTemplate', () => {
125
136
  test('render with template OnOffSimpleActionTemplate with is_managed_by_backend', async () => {
126
137
  const mockDoAction = jest.fn();
127
138
  await act(async () => {
128
- wrapper = await create(
129
- <OnOffTemplate
130
- actionGroup={actionGroup}
131
- doAction={mockDoAction}
132
- sensor={{ is_managed_by_backend: true }}
133
- />
134
- );
139
+ tree = await create(wrapComponent(actionGroup, mockDoAction, {}));
135
140
  });
136
- const instance = wrapper.root;
141
+ const instance = tree.root;
137
142
  const template = instance.findAllByType(OnOffSimpleTemplate);
138
143
  expect(template).toHaveLength(1);
139
- expect(watchMultiConfigs).toBeCalledTimes(1);
144
+ expect(watchMultiConfigs).toBeCalledTimes(0);
140
145
  });
141
146
 
142
147
  test('template OnOffSimpleActionTemplate doAction with is_on_value, match configValue', async () => {
143
148
  const mockDoAction = jest.fn();
144
149
  await act(async () => {
145
- wrapper = await create(
146
- <OnOffTemplate
147
- actionGroup={actionGroup}
148
- doAction={mockDoAction}
149
- sensor={{ name: 'Sensor name' }}
150
- />
151
- );
150
+ tree = await create(wrapComponent(actionGroup, mockDoAction, sensor));
152
151
  });
153
- const instance = wrapper.root;
152
+ const instance = tree.root;
154
153
  const template = instance.findByType(OnOffSimpleTemplate);
155
154
  expect(template.props.isOn).toEqual(true);
156
155
 
@@ -160,7 +159,7 @@ describe('Test OnOffTemplate', () => {
160
159
  expect(mockDoAction).toHaveBeenCalledWith(
161
160
  action_off_data,
162
161
  null,
163
- 'Sensor name turn on / off off'
162
+ 'Sensor turn on / off off'
164
163
  );
165
164
  expect(watchMultiConfigs).toBeCalledTimes(0);
166
165
  });
@@ -169,15 +168,9 @@ describe('Test OnOffTemplate', () => {
169
168
  actionGroup.configuration.is_on_value = [1];
170
169
  const mockDoAction = jest.fn();
171
170
  await act(async () => {
172
- wrapper = await create(
173
- <OnOffTemplate
174
- actionGroup={actionGroup}
175
- doAction={mockDoAction}
176
- sensor={{ name: 'Sensor name' }}
177
- />
178
- );
171
+ tree = await create(wrapComponent(actionGroup, mockDoAction, sensor));
179
172
  });
180
- const instance = wrapper.root;
173
+ const instance = tree.root;
181
174
  const template = instance.findByType(OnOffSimpleTemplate);
182
175
  expect(template.props.isOn).toEqual(false);
183
176
 
@@ -187,22 +180,16 @@ describe('Test OnOffTemplate', () => {
187
180
  expect(mockDoAction).toHaveBeenCalledWith(
188
181
  action_on_data,
189
182
  null,
190
- 'Sensor name turn on / off on'
183
+ 'Sensor turn on / off on'
191
184
  );
192
185
  });
193
186
 
194
187
  test('template OnOffSimpleActionTemplate doAction with is_on_value and is_managed_by_backend', async () => {
195
188
  const mockDoAction = jest.fn();
196
189
  await act(async () => {
197
- wrapper = await create(
198
- <OnOffTemplate
199
- actionGroup={actionGroup}
200
- doAction={mockDoAction}
201
- sensor={{ name: 'Sensor name', is_managed_by_backend: true }}
202
- />
203
- );
190
+ tree = await create(wrapComponent(actionGroup, mockDoAction, sensor));
204
191
  });
205
- const instance = wrapper.root;
192
+ const instance = tree.root;
206
193
  const template = instance.findByType(OnOffSimpleTemplate);
207
194
  expect(template.props.isOn).toEqual(true);
208
195
 
@@ -212,9 +199,9 @@ describe('Test OnOffTemplate', () => {
212
199
  expect(mockDoAction).toHaveBeenCalledWith(
213
200
  action_off_data,
214
201
  null,
215
- 'Sensor name turn on / off off'
202
+ 'Sensor turn on / off off'
216
203
  );
217
- expect(watchMultiConfigs).toBeCalledTimes(2);
204
+ expect(watchMultiConfigs).toBeCalledTimes(0);
218
205
  });
219
206
 
220
207
  test('render with template OnOffSimpleActionTemplate with just action_data', async () => {
@@ -230,15 +217,9 @@ describe('Test OnOffTemplate', () => {
230
217
  };
231
218
  const mockDoAction = jest.fn();
232
219
  await act(async () => {
233
- wrapper = await create(
234
- <OnOffTemplate
235
- actionGroup={actionGroup}
236
- doAction={mockDoAction}
237
- sensor={{ is_managed_by_backend: true }}
238
- />
239
- );
220
+ tree = await create(wrapComponent(actionGroup, mockDoAction, {}));
240
221
  });
241
- const instance = wrapper.root;
222
+ const instance = tree.root;
242
223
  const template = instance.findAllByType(OnOffSimpleTemplate);
243
224
  expect(template).toHaveLength(1);
244
225
  expect(template[0].props.disabled).toBeFalsy();
@@ -261,15 +242,9 @@ describe('Test OnOffTemplate', () => {
261
242
  };
262
243
  const mockDoAction = jest.fn();
263
244
  await act(async () => {
264
- wrapper = await create(
265
- <OnOffTemplate
266
- actionGroup={actionGroup}
267
- doAction={mockDoAction}
268
- sensor={{ is_managed_by_backend: true }}
269
- />
270
- );
245
+ tree = await create(wrapComponent(actionGroup, mockDoAction, {}));
271
246
  });
272
- const instance = wrapper.root;
247
+ const instance = tree.root;
273
248
  const template = instance.findAllByType(OnOffSimpleTemplate);
274
249
  expect(template).toHaveLength(1);
275
250
  expect(template[0].props.disabled).toBeTruthy();
@@ -1,8 +1,27 @@
1
+ /* eslint-disable promise/prefer-await-to-callbacks */
1
2
  import React from 'react';
2
3
  import { create, act } from 'react-test-renderer';
3
4
  import { TouchableOpacity } from 'react-native';
5
+ import { useSelector } from 'react-redux';
4
6
 
5
7
  import OneBigButtonTemplate from '../OneBigButtonTemplate';
8
+ import { mockSCStore } from '../../../context/mockStore';
9
+ import { SCProvider } from '../../../context';
10
+
11
+ const wrapComponent = (actionGroup, mockDoAction, sensor) => (
12
+ <SCProvider initState={mockSCStore({})}>
13
+ <OneBigButtonTemplate
14
+ actionGroup={actionGroup}
15
+ doAction={mockDoAction}
16
+ sensor={sensor}
17
+ />
18
+ </SCProvider>
19
+ );
20
+
21
+ jest.mock('react-redux', () => ({
22
+ ...jest.requireActual('react-redux'),
23
+ useSelector: jest.fn(),
24
+ }));
6
25
 
7
26
  describe('Test OneBigButtonTemplate', () => {
8
27
  const action_data = {
@@ -23,24 +42,25 @@ describe('Test OneBigButtonTemplate', () => {
23
42
  text: 'UP',
24
43
  },
25
44
  };
26
- const sensor = {
27
- name: 'Sensor name',
28
- };
29
- let wrapper;
45
+ let tree;
46
+ let sensor;
30
47
 
31
- test('render OneBigButtonTemplate', () => {
32
- const mockDoAction = jest.fn();
33
- act(() => {
34
- wrapper = create(
35
- <OneBigButtonTemplate
36
- actionGroup={actionGroup}
37
- doAction={mockDoAction}
38
- sensor={sensor}
39
- />
40
- );
48
+ beforeEach(() => {
49
+ const localState = {
50
+ isOnSwich: false,
51
+ };
52
+ useSelector.mockImplementation((cb) => {
53
+ return cb(localState);
41
54
  });
55
+ sensor = { name: 'Sensor' };
56
+ });
42
57
 
43
- const instance = wrapper.root;
58
+ test('render OneBigButtonTemplate', async () => {
59
+ const mockDoAction = jest.fn();
60
+ await act(async () => {
61
+ tree = await create(wrapComponent(actionGroup, mockDoAction, sensor));
62
+ });
63
+ const instance = tree.root;
44
64
  const buttons = instance.findAllByType(TouchableOpacity);
45
65
  expect(buttons.length).toEqual(1);
46
66
 
@@ -49,10 +69,6 @@ describe('Test OneBigButtonTemplate', () => {
49
69
  });
50
70
 
51
71
  expect(mockDoAction).toHaveBeenCalledTimes(1);
52
- expect(mockDoAction).toHaveBeenCalledWith(
53
- action_data,
54
- null,
55
- 'Sensor name up'
56
- );
72
+ expect(mockDoAction).toHaveBeenCalledWith(action_data, null, 'Sensor up');
57
73
  });
58
74
  });
@@ -5,7 +5,7 @@ import AccountItem from './AccountItem';
5
5
 
6
6
  const AccountList = ({ accounts }) => {
7
7
  return (
8
- <ScrollView>
8
+ <ScrollView scrollIndicatorInsets={{ right: 1 }}>
9
9
  {accounts.map((account) => (
10
10
  <AccountItem key={account.id || account.name} account={account} />
11
11
  ))}
@@ -239,6 +239,8 @@ const HistoryChart = memo(
239
239
  onConfirm={onConfirmStart}
240
240
  onCancel={onCancel}
241
241
  display="spinner"
242
+ cancelTextIOS={t('cancel')}
243
+ confirmTextIOS={t('confirm')}
242
244
  />
243
245
  <DateTimePickerModal
244
246
  isVisible={eventPicker.showModalEnd}
@@ -247,6 +249,8 @@ const HistoryChart = memo(
247
249
  onConfirm={onConfirmEnd}
248
250
  onCancel={onCancel}
249
251
  display="spinner"
252
+ cancelTextIOS={t('cancel')}
253
+ confirmTextIOS={t('confirm')}
250
254
  />
251
255
  </View>
252
256
  );
@@ -1,4 +1,5 @@
1
1
  import React, { memo, useCallback } from 'react';
2
+ import { View } from 'react-native';
2
3
  import { FlatList } from 'react-native';
3
4
  import QualityIndicatorItem from '../WaterQualitySensor/QualityIndicatorsItem';
4
5
  import styles from './PMSensorIndicatorStyles';
@@ -26,18 +27,21 @@ const PMSensorIndicatior = memo(({ data, style }) => {
26
27
  const isScrollMode = data.length > 3;
27
28
 
28
29
  return (
29
- <FlatList
30
- bounces={false}
31
- numColumns={1}
32
- horizontal={true}
33
- contentContainerStyle={[
34
- styles.standard,
35
- !isScrollMode && styles.centerItem,
36
- ]}
37
- data={data}
38
- keyExtractor={keyExtractor}
39
- renderItem={renderItem}
40
- />
30
+ <View style={styles.wrap}>
31
+ <FlatList
32
+ bounces={false}
33
+ numColumns={1}
34
+ horizontal={true}
35
+ contentContainerStyle={[
36
+ styles.standard,
37
+ !isScrollMode && styles.centerItem,
38
+ ]}
39
+ data={data}
40
+ keyExtractor={keyExtractor}
41
+ renderItem={renderItem}
42
+ scrollIndicatorInsets={{ right: 1 }}
43
+ />
44
+ </View>
41
45
  );
42
46
  });
43
47
 
@@ -10,4 +10,7 @@ export default StyleSheet.create({
10
10
  flex: 1,
11
11
  justifyContent: 'center',
12
12
  },
13
+ wrap: {
14
+ marginVertical: 16,
15
+ },
13
16
  });
@@ -27,6 +27,7 @@ const ListQualityIndicator = ({ data, style }) => {
27
27
  showsHorizontalScrollIndicator={false}
28
28
  nestedScrollEnabled
29
29
  contentContainerStyle={[styles.flatlistContent, style]}
30
+ scrollIndicatorInsets={{ right: 1 }}
30
31
  />
31
32
  </View>
32
33
  );
@@ -22,7 +22,8 @@ const styles = StyleSheet.create({
22
22
  left: 0,
23
23
  bottom: 0,
24
24
  right: 0,
25
- zIndex: 10,
25
+ zIndex: 1000, // works on ios
26
+ elevation: 1000, // works on android
26
27
  },
27
28
  background: {
28
29
  backgroundColor: colorOpacity(Colors.White, 0.8),
@@ -59,6 +59,7 @@ const MenuActionAddnew = memo(
59
59
  data={dataActions}
60
60
  keyExtractor={keyExtractor}
61
61
  renderItem={renderItem}
62
+ scrollIndicatorInsets={{ right: 1 }}
62
63
  />
63
64
  </View>
64
65
  </View>
@@ -57,6 +57,7 @@ const MenuActionList = memo(
57
57
  data={listItem}
58
58
  keyExtractor={keyExtractor}
59
59
  renderItem={renderItem}
60
+ scrollIndicatorInsets={{ right: 1 }}
60
61
  />
61
62
  </View>
62
63
  </View>
@@ -50,7 +50,7 @@ const MenuActionMore = memo(
50
50
  isVisible={isVisible}
51
51
  arrowStyle={styles.wrap}
52
52
  >
53
- <ScrollView>
53
+ <ScrollView scrollIndicatorInsets={{ right: 1 }}>
54
54
  {listMenuItem.map((item, index) => {
55
55
  return (
56
56
  <TouchableOpacity
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { create } from 'react-test-renderer';
3
+ import { act } from 'react-test-renderer';
4
+ import PreventAccess from '..';
5
+ import { TESTID } from '../../../configs/Constants';
6
+ import { SCProvider } from '../../../context';
7
+ import { mockSCStore } from '../../../context/mockStore';
8
+ import Text from '../../Text';
9
+
10
+ const mockGoBack = jest.fn();
11
+
12
+ const wrapComponent = (headerBodyText, visible, hidePreventAccess) => (
13
+ <SCProvider initState={mockSCStore({})}>
14
+ <PreventAccess
15
+ headerBodyText={headerBodyText}
16
+ visible={visible}
17
+ hidePreventAccess={hidePreventAccess}
18
+ />
19
+ </SCProvider>
20
+ );
21
+
22
+ jest.mock('@react-navigation/native', () => {
23
+ return {
24
+ ...jest.requireActual('@react-navigation/native'),
25
+ useRoute: jest.fn(),
26
+ useNavigation: () => ({
27
+ goBack: mockGoBack,
28
+ }),
29
+ };
30
+ });
31
+
32
+ describe('Test PreventAccess.test', () => {
33
+ let tree;
34
+ let headerBodyText;
35
+ let visible;
36
+ let hidePreventAccess = () => {};
37
+
38
+ test('onItemClick MenuActionList', () => {
39
+ act(() => {
40
+ tree = create(wrapComponent(headerBodyText, visible, hidePreventAccess));
41
+ });
42
+ const instance = tree.root;
43
+ const text = instance.findAllByType(Text);
44
+ expect(text).toHaveLength(5);
45
+ const button1 = instance.find(
46
+ (el) => el.props.testID === TESTID.BUTTON_PREVENT_ACCESS
47
+ );
48
+ const button2 = instance.find(
49
+ (el) => el.props.testID === TESTID.TEXT_PREVENT_ACCESS
50
+ );
51
+ act(() => {
52
+ button1.props.onBackButtonPress();
53
+ });
54
+
55
+ act(() => {
56
+ button2.props.onPress();
57
+ });
58
+ expect(button1).toBeDefined();
59
+ expect(button2).toBeDefined();
60
+ expect(mockGoBack).toHaveBeenCalled();
61
+ });
62
+ });
@@ -7,6 +7,7 @@ import t from '../../hooks/Common/useTranslations';
7
7
  import Text from '../Text';
8
8
  import { Colors } from '../../configs';
9
9
  import { styles } from './styles';
10
+ import { TESTID } from '../../configs/Constants';
10
11
 
11
12
  const PreventAccess = memo(({ headerBodyText, visible, hidePreventAccess }) => {
12
13
  const { goBack } = useNavigation();
@@ -37,6 +38,7 @@ const PreventAccess = memo(({ headerBodyText, visible, hidePreventAccess }) => {
37
38
  transparent={true}
38
39
  onBackButtonPress={handleBackPress}
39
40
  style={styles.container}
41
+ testID={TESTID.BUTTON_PREVENT_ACCESS}
40
42
  >
41
43
  <View style={styles.popoverStyle}>
42
44
  <View style={styles.actionTextWrap}>
@@ -48,7 +50,13 @@ const PreventAccess = memo(({ headerBodyText, visible, hidePreventAccess }) => {
48
50
  </Text>
49
51
  </View>
50
52
  <View style={styles.endOfText}>
51
- <Text size={16} bold color={Colors.Primary} onPress={handleDonePopup}>
53
+ <Text
54
+ testID={TESTID.TEXT_PREVENT_ACCESS}
55
+ size={16}
56
+ bold
57
+ color={Colors.Primary}
58
+ onPress={handleDonePopup}
59
+ >
52
60
  {dataText?.endOfText}
53
61
  </Text>
54
62
  </View>
@@ -722,6 +722,10 @@ export const TESTID = {
722
722
  AUTO_LOCK_BUTTON_ENABLE: 'AUTO_LOCK_BUTTON_ENABLE',
723
723
  AUTO_LOCK_BUTTON_INSTANT: 'AUTO_LOCK_BUTTON_INSTANT',
724
724
  AUTO_LOCK_BUTTON_RELOCK_TIMING: 'AUTO_LOCK_BUTTON_RELOCK_TIMING',
725
+
726
+ //PreventAccess
727
+ BUTTON_PREVENT_ACCESS: 'BUTTON_PREVENT_ACCESS',
728
+ TEXT_PREVENT_ACCESS: 'TEXT_PREVENT_ACCESS',
725
729
  };
726
730
 
727
731
  export const NOTIFICATION_TYPES = {
@@ -17,6 +17,7 @@ export const Action = {
17
17
  SET_STARRED_SCRIPTS: 'SET_STARRED_SCRIPTS',
18
18
  STAR_SCRIPT: 'STAR_SCRIPT',
19
19
  UNSTAR_SCRIPT: 'UNSTAR_SCRIPT',
20
+ IS_FULL_LOADING: 'IS_FULL_LOADING',
20
21
  };
21
22
 
22
23
  export type AuthData = {
@@ -42,6 +42,7 @@ export const initialState = {
42
42
  statusBar: {} as StatusBar,
43
43
  listDevice: {} as ListDevice,
44
44
  listAction: [] as ListAction,
45
+ isFullLoading: false as Boolean,
45
46
  unit: {
46
47
  favoriteDeviceIds: [],
47
48
  },
@@ -66,6 +67,8 @@ export const reducer = (currentState: ContextData, action: Action) => {
66
67
  return { ...currentState, auth: payload };
67
68
  case Action.STORE_STATUS_BAR:
68
69
  return { ...currentState, statusBar: payload };
70
+ case Action.IS_FULL_LOADING:
71
+ return { ...currentState, isFullLoading: payload };
69
72
  case Action.UPDATE_LANGUAGE:
70
73
  return { ...currentState, language: payload };
71
74
  case Action.LIST_DEVICE_TYPES:
@@ -83,7 +83,7 @@ const AQIGuide = memo(() => {
83
83
 
84
84
  return (
85
85
  <SafeAreaView style={styles.container}>
86
- <ScrollView style={styles.container}>
86
+ <ScrollView style={styles.container} scrollIndicatorInsets={{ right: 1 }}>
87
87
  {titles.map((item, index) => {
88
88
  const { title, des } = item;
89
89
  return (
@@ -257,6 +257,8 @@ const FilterPopup = ({
257
257
  onCancel={onPickerCancel}
258
258
  onHide={releaseLockShowing}
259
259
  display="spinner"
260
+ cancelTextIOS={t('cancel')}
261
+ confirmTextIOS={t('confirm')}
260
262
  />
261
263
  </>
262
264
  );
@@ -174,6 +174,7 @@ const AddCommonSelectSubUnit = ({ route }) => {
174
174
  <ScrollView
175
175
  style={styles.scrollContainer}
176
176
  showsVerticalScrollIndicator={false}
177
+ scrollIndicatorInsets={{ right: 1 }}
177
178
  >
178
179
  <Section type={'border'}>
179
180
  {subUnits.map((item, index) => (
@@ -159,6 +159,7 @@ const AddCommonSelectUnit = ({ route }) => {
159
159
  <ScrollView
160
160
  style={styles.scrollContainer}
161
161
  showsVerticalScrollIndicator={false}
162
+ scrollIndicatorInsets={{ right: 1 }}
162
163
  >
163
164
  <Section type={'border'}>
164
165
  {units.map((item, index) => (
@@ -169,7 +169,10 @@ const AddLocationMaps = memo(() => {
169
169
  </Text>
170
170
  <View style={styles.searchLocation}>
171
171
  <SearchBarLocation input={input} onTextInput={onTextInput} />
172
- <ScrollView style={styles.searchData}>
172
+ <ScrollView
173
+ style={styles.searchData}
174
+ scrollIndicatorInsets={{ right: 1 }}
175
+ >
173
176
  {searchData.map((item) => (
174
177
  <RowLocation item={item} onPress={onPressRowLocation} />
175
178
  ))}
@@ -175,6 +175,7 @@ const SelectSensorDevices = memo(({ route }) => {
175
175
  <ScrollView
176
176
  style={styles.wrap}
177
177
  contentContainerStyle={styles.contentContainerStyle}
178
+ scrollIndicatorInsets={{ right: 1 }}
178
179
  >
179
180
  <Text bold type="H2" style={styles.title}>
180
181
  {t(title)}
@@ -216,7 +217,11 @@ const SelectSensorDevices = memo(({ route }) => {
216
217
  style={styles.bottomButtonView}
217
218
  mainTitle={t('continue')}
218
219
  onPressMain={onPressContinue}
219
- typeMain={selectedDevice ? 'primary' : 'disabled'}
220
+ typeMain={
221
+ Object.keys(selectedDevice || {}).length === 0
222
+ ? 'disabled'
223
+ : 'primary'
224
+ }
220
225
  />
221
226
  </View>
222
227
  );
@@ -90,6 +90,7 @@ const AddNewDevice = memo(({ route }) => {
90
90
  <ScrollView
91
91
  style={styles.scrollContainer}
92
92
  showsVerticalScrollIndicator={false}
93
+ scrollIndicatorInsets={{ right: 1 }}
93
94
  >
94
95
  <Section type={'border'}>
95
96
  <GroupCheckBox data={stations} onSelect={handleOnSelect} />