@eohjsc/react-native-smart-city 0.4.47 → 0.4.48

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 (65) hide show
  1. package/README.md +1 -5
  2. package/android/build.gradle +24 -19
  3. package/package.json +12 -15
  4. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +7 -4
  5. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +3 -6
  6. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +1 -4
  7. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +11 -1
  8. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +5 -0
  9. package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +6 -1
  10. package/src/commons/Dashboard/MyUnit/index.js +6 -8
  11. package/src/commons/DateTimeRangeChange/index.js +3 -3
  12. package/src/commons/Device/Hanet/ItemHanetDevice.js +1 -5
  13. package/src/commons/Device/ItemAddNew/index.js +2 -6
  14. package/src/commons/Device/ItemDevice.js +1 -5
  15. package/src/commons/FlatListDnD/__test__/index.test.js +25 -27
  16. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +22 -1
  17. package/src/commons/HeaderAni/index.js +2 -12
  18. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +23 -1
  19. package/src/commons/Modal/ModalCustom.js +2 -2
  20. package/src/commons/SubUnit/OneTap/ItemOneTap.js +2 -10
  21. package/src/commons/Unit/HeaderUnit/index.js +7 -18
  22. package/src/commons/Unit/SharedUnit.js +43 -58
  23. package/src/commons/Unit/__test__/SharedUnit.test.js +100 -60
  24. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +289 -0
  25. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +59 -1
  26. package/src/commons/WrapParallaxScrollView/index.js +0 -4
  27. package/src/configs/AccessibilityLabel.js +0 -3
  28. package/src/hooks/IoT/__test__/useRemoteControl.test.js +51 -52
  29. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +2 -3
  30. package/src/navigations/AutomateStack.js +2 -5
  31. package/src/navigations/NotificationStack.js +2 -28
  32. package/src/navigations/SharedStack.js +2 -8
  33. package/src/navigations/UnitStack.js +2 -2
  34. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +32 -31
  35. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +68 -69
  36. package/src/screens/Automate/ScriptDetail/Styles/indexStyles.js +0 -1
  37. package/src/screens/Automate/ScriptDetail/index.js +7 -4
  38. package/src/screens/ChangePosition/__test__/index.test.js +32 -34
  39. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +11 -1
  40. package/src/screens/Device/__test__/detail.test.js +8 -67
  41. package/src/screens/Device/components/ChartWrapper.js +12 -14
  42. package/src/screens/Device/components/VisualChart.js +1 -7
  43. package/src/screens/Device/components/__test__/VisualChart.test.js +3 -0
  44. package/src/screens/Device/detail.js +34 -29
  45. package/src/screens/Device/hooks/__test__/useEvaluateValue.test.js +18 -20
  46. package/src/screens/Device/styles.js +0 -3
  47. package/src/screens/Notification/__test__/Notification.test.js +8 -14
  48. package/src/screens/Notification/components/NotificationItem.js +0 -1
  49. package/src/screens/Notification/index.js +48 -42
  50. package/src/screens/Notification/styles/indexStyles.js +3 -6
  51. package/src/screens/SharedUnit/index.js +4 -1
  52. package/src/screens/Sharing/InfoMemberUnit.js +1 -3
  53. package/src/screens/Sharing/MemberList.js +3 -16
  54. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +0 -2
  55. package/src/screens/Sharing/__test__/SelectPermission.test.js +137 -96
  56. package/src/screens/Template/__test__/EditTemplate.test.js +1 -7
  57. package/src/screens/Unit/__test__/SelectAddress.test.js +11 -4
  58. package/src/screens/Unit/components/SharedUnit/index.js +9 -6
  59. package/src/screens/Unit/components/__test__/SharedUnit.test.js +15 -19
  60. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +11 -1
  61. package/src/utils/Monitor.js +2 -2
  62. package/src/Images/Common/pushpin-full.svg +0 -3
  63. package/src/Images/Common/pushpin-outline.svg +0 -3
  64. package/src/Images/Common/star-full.svg +0 -3
  65. package/src/Images/Common/star-outline.svg +0 -3
@@ -8,7 +8,7 @@ import React, {
8
8
  } from 'react';
9
9
  import { View, TouchableOpacity, Platform } from 'react-native';
10
10
  import { useNavigation, useFocusEffect } from '@react-navigation/native';
11
- import { IconFill } from '@ant-design/icons-react-native';
11
+ import { IconFill, IconOutline } from '@ant-design/icons-react-native';
12
12
  import { Icon } from '@ant-design/react-native';
13
13
  import moment from 'moment';
14
14
 
@@ -47,8 +47,6 @@ import { SensorDisplayItem } from './components/SensorDisplayItem';
47
47
  import { EmergencyCountdown } from './components/EmergencyCountdown';
48
48
  import { SensorConnectStatusViewHeader } from './components/SensorConnectStatusViewHeader';
49
49
  import PreventAccess from '../../commons/PreventAccess';
50
- import StarFull from '../../Images/Common/star-full.svg';
51
- import StarOutline from '../../Images/Common/star-outline.svg';
52
50
 
53
51
  import styles from './styles';
54
52
  import Routes from '../../utils/Route';
@@ -61,7 +59,7 @@ import { useReceiveNotifications } from '../../hooks';
61
59
  import useChipJsonConfiguration, {
62
60
  useConnectChipMqtt,
63
61
  } from '../../hooks/useMqtt';
64
- import { watchMultiConfigs } from '../../iot/Monitor';
62
+ import { realWatchMultiConfigs } from '../../iot/Monitor';
65
63
 
66
64
  const DeviceDetail = ({ route }) => {
67
65
  const configIdsTemp = useRef([]);
@@ -138,7 +136,8 @@ const DeviceDetail = ({ route }) => {
138
136
  }
139
137
 
140
138
  return action.some((item) => {
141
- return JSON.stringify(item?.configuration)?.includes(
139
+ const { configuration } = item?.configuration;
140
+ return JSON.stringify(configuration).includes(
142
141
  '"command_prefer_over_bluetooth":true'
143
142
  );
144
143
  });
@@ -330,7 +329,9 @@ const DeviceDetail = ({ route }) => {
330
329
 
331
330
  const listMenuItem = useMemo(() => {
332
331
  const menuItems = [];
333
- if (display.items.some((i) => getActionComponent(i.template))) {
332
+ if (
333
+ display.items.some((i) => getActionComponent(i.configuration.template))
334
+ ) {
334
335
  menuItems.push({
335
336
  route: Routes.ActivityLog,
336
337
  data: {
@@ -499,30 +500,35 @@ const DeviceDetail = ({ route }) => {
499
500
  let params = new URLSearchParams();
500
501
  const configIds = [];
501
502
 
502
- // todo Bang refactor widgets like dashboard
503
503
  display.items.map((item) => {
504
+ const type = item?.template || item?.type;
504
505
  if (!item.configuration) {
505
506
  return;
506
507
  }
507
- item.configuration.configs?.map((config) => {
508
- if (!configIds.includes(config.id)) {
509
- configIds.push(config.id);
510
- }
511
- });
512
- item.configuration.options?.map((option) => {
513
- if (!configIds.includes(option.config)) {
514
- configIds.push(option.config);
508
+ if (!['action', 'value'].includes(type)) {
509
+ return;
510
+ }
511
+ if (type === 'action') {
512
+ if (
513
+ [
514
+ 'on_off_button_action_template',
515
+ 'one_button_action_template',
516
+ ].includes(item.configuration.template)
517
+ ) {
518
+ !configIds.includes(item.configuration.configuration.config) &&
519
+ configIds.push(item.configuration.configuration.config);
515
520
  }
516
- });
517
- if (item.configuration.config) {
518
- !configIds.includes(item.configuration.config) &&
519
- configIds.push(item.configuration.config);
521
+ }
522
+ if (type === 'value') {
523
+ item.configuration.configs.map((config) => {
524
+ if (!configIds.includes(config.id)) {
525
+ configIds.push(config.id);
526
+ }
527
+ });
520
528
  }
521
529
  });
522
530
  configIdsTemp.current = configIds.filter(Boolean);
523
531
 
524
- watchMultiConfigs(configIdsTemp.current);
525
-
526
532
  configIds.map((id) => {
527
533
  params.append('config', id);
528
534
  });
@@ -676,7 +682,11 @@ const DeviceDetail = ({ route }) => {
676
682
  onPress={isFavorite ? removeFromFavorites : addToFavorites}
677
683
  accessibilityLabel={AccessibilityLabel.HEADER_DEVICE_BUTTON_STAR}
678
684
  >
679
- {isFavorite ? <StarFull /> : <StarOutline />}
685
+ {isFavorite ? (
686
+ <IconFill name="star" size={25} color={Colors.Yellow6} />
687
+ ) : (
688
+ <IconOutline name="star" size={25} />
689
+ )}
680
690
  </TouchableOpacity>
681
691
 
682
692
  {isShowSetupEmergencyContact && (
@@ -691,12 +701,7 @@ const DeviceDetail = ({ route }) => {
691
701
  ref={refMenuAction}
692
702
  accessibilityLabel={AccessibilityLabel.HEADER_DEVICE_BUTTON_MORE}
693
703
  >
694
- <Icon
695
- name={'ellipsis'}
696
- size={27}
697
- color={Colors.Black}
698
- style={styles.moreIcon}
699
- />
704
+ <Icon name={'more'} size={27} color={Colors.Black} />
700
705
  </TouchableOpacity>
701
706
  </View>
702
707
  ),
@@ -715,7 +720,7 @@ const DeviceDetail = ({ route }) => {
715
720
  }, [sensor]);
716
721
 
717
722
  useEffect(() => {
718
- appState === 'active' && watchMultiConfigs(configIdsTemp.current);
723
+ appState === 'active' && realWatchMultiConfigs(configIdsTemp.current);
719
724
  }, [appState]);
720
725
 
721
726
  const shouldRender =
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-unused-vars */
2
1
  import React from 'react';
3
2
  import { renderHook } from '@testing-library/react-hooks';
4
3
  import { useEvaluateValue, useGetEvaluateValue } from '../useEvaluateValue';
@@ -105,23 +104,22 @@ describe('Test useEvaluateValue', () => {
105
104
  expect(evaluateValue.current(2, 2).text).toBe(2);
106
105
  });
107
106
 
108
- // NOTE: Hinh will fix it later
109
- // it('test evaluate fetch from server if not exists', async () => {
110
- // const mock = new MockAdapter(api.axiosInstance);
111
- // mock.onGet(API.FETCH_VALUE_EVALUATION(111)).reply(200, {
112
- // unit_id: 1,
113
- // configs: [111],
114
- // });
115
-
116
- // const { result: evaluateValue } = renderHook(
117
- // () => useGetEvaluateValue(111),
118
- // {
119
- // wrapper: wrapper(valueEvaluations),
120
- // }
121
- // );
122
- // expect(evaluateValue.current).toBe(undefined);
123
- // await flushPromises();
124
-
125
- // expect(mock.history.get.length).toBe(1);
126
- // });
107
+ it('test evaluate fetch from server if not exists', async () => {
108
+ const mock = new MockAdapter(api.axiosInstance);
109
+ mock.onGet(API.FETCH_VALUE_EVALUATION(111)).reply(200, {
110
+ unit_id: 1,
111
+ configs: [111],
112
+ });
113
+
114
+ const { result: evaluateValue } = renderHook(
115
+ () => useGetEvaluateValue(111),
116
+ {
117
+ wrapper: wrapper(valueEvaluations),
118
+ }
119
+ );
120
+ expect(evaluateValue.current).toBe(undefined);
121
+ await flushPromises();
122
+
123
+ expect(mock.history.get.length).toBe(1);
124
+ });
127
125
  });
@@ -97,7 +97,4 @@ export default StyleSheet.create({
97
97
  marginLeft: 16,
98
98
  marginBottom: 16,
99
99
  },
100
- moreIcon: {
101
- transform: [{ rotate: '90deg' }],
102
- },
103
100
  });
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { act, create } from 'react-test-renderer';
3
3
  import MockAdapter from 'axios-mock-adapter';
4
- import { FlatList, RefreshControl } from 'react-native';
4
+ import { Animated, RefreshControl } from 'react-native';
5
5
  import { NavigationContext } from '@react-navigation/native';
6
6
 
7
7
  import { SCProvider } from '../../../context';
@@ -10,8 +10,7 @@ import Notification from '../index';
10
10
  import NotificationItem from '../components/NotificationItem';
11
11
  import { API } from '../../../configs';
12
12
  import api from '../../../utils/Apis/axios';
13
- import { Text } from '../../../commons';
14
- import AccessibilityLabel from '../../../configs/AccessibilityLabel';
13
+ import { WrapHeaderScrollable } from '../../../commons';
15
14
 
16
15
  const wrapComponent = () => (
17
16
  <SCProvider initState={mockSCStore({})}>
@@ -106,22 +105,17 @@ describe('test Notification', () => {
106
105
  tree = await create(wrapComponent());
107
106
  });
108
107
  const instance = tree.root;
109
- const flatlist = instance.findByType(FlatList);
108
+ const wrapHeaderScrollable = instance.findByType(WrapHeaderScrollable);
109
+ expect(wrapHeaderScrollable.props.disableLoadMore).toEqual(false);
110
+
111
+ const scrollView = instance.findByType(Animated.ScrollView);
110
112
  mock
111
113
  .onGet(API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(2, ''))
112
114
  .reply(200, response);
113
115
  await act(async () => {
114
- await flatlist.props.onMomentumScrollBegin();
115
- await flatlist.props.onEndReached();
116
+ scrollView.props.onMomentumScrollEnd();
116
117
  });
117
- const notificationItemTexts = instance.findAll(
118
- (el) =>
119
- el.type === Text &&
120
- el.props.accessibilityLabel === AccessibilityLabel.NotificationItemText
121
- );
122
- expect(notificationItemTexts[2].props.children).toBe(
123
- ' invited you to join '
124
- );
118
+ expect(wrapHeaderScrollable.props.disableLoadMore).toEqual(true);
125
119
  });
126
120
 
127
121
  it('test onRefresh', async () => {
@@ -30,7 +30,6 @@ const NotificationItem = memo(({ item }) => {
30
30
  bold={i % 2 !== 0}
31
31
  key={i}
32
32
  style={styles.textNotification}
33
- accessibilityLabel={AccessibilityLabel.NotificationItemText}
34
33
  >
35
34
  {i % 2 === 0 ? str : params[str]}
36
35
  </Text>
@@ -1,29 +1,55 @@
1
- import React, { memo, useState, useCallback, useEffect, useRef } from 'react';
2
- import { View, FlatList, ActivityIndicator } from 'react-native';
1
+ import React, { memo, useMemo, useState, useCallback, useEffect } from 'react';
2
+ import { View, TouchableOpacity } from 'react-native';
3
+ import { Icon } from '@ant-design/react-native';
3
4
  import { useFocusEffect } from '@react-navigation/native';
4
5
 
5
6
  import styles from './styles/indexStyles';
6
- import { API } from '../../configs';
7
+ import { API, Colors } from '../../configs';
7
8
  import { axiosGet } from '../../utils/Apis/axios';
9
+ import { useTranslations } from '../../hooks/Common/useTranslations';
8
10
  import NotificationItem from './components/NotificationItem';
11
+ import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
9
12
  import {
10
13
  watchNotificationData,
11
14
  unwatchNotificationData,
12
15
  } from '../../utils/Monitor';
13
16
  import { useSCContextSelector } from '../../context';
17
+ import { notImplemented } from '../../utils/Utils';
14
18
  import { useReceiveNotifications } from '../../hooks';
15
19
 
16
20
  const Notification = memo(() => {
17
- const onEndReachedCalledDuringMomentum = useRef(false);
18
- const user = useSCContextSelector((state) => state?.auth?.account?.user);
21
+ const t = useTranslations();
19
22
  const [page, setPage] = useState(1);
23
+ const user = useSCContextSelector((state) => state?.auth?.account?.user);
20
24
  const [notifications, setNotifications] = useState([]);
21
25
  const [maxPageNotification, setMaxPageNotification] = useState(1);
22
- const [isRefreshing, setIsRefreshing] = useState(false);
23
- const [isLoadMore, setIsLoadMore] = useState(false);
26
+
27
+ const rightComponent = useMemo(
28
+ () => (
29
+ <View style={styles.rightComponent}>
30
+ <TouchableOpacity
31
+ style={styles.iconPlus}
32
+ onPress={() => {
33
+ notImplemented(t);
34
+ }}
35
+ >
36
+ <Icon name={'plus'} size={27} color={Colors.Black} />
37
+ </TouchableOpacity>
38
+
39
+ <TouchableOpacity
40
+ onPress={() => {
41
+ notImplemented(t);
42
+ }}
43
+ >
44
+ <Icon name={'search'} size={27} color={Colors.Black} />
45
+ </TouchableOpacity>
46
+ </View>
47
+ ),
48
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ []
50
+ );
24
51
 
25
52
  const fetchNotifications = useCallback(async (pageParam) => {
26
- setIsLoadMore(true);
27
53
  const { success, data } = await axiosGet(
28
54
  API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(pageParam, '')
29
55
  );
@@ -31,22 +57,16 @@ const Notification = memo(() => {
31
57
  setNotifications((preState) => preState.concat(data.results));
32
58
  setMaxPageNotification(Math.ceil(data.count / 10));
33
59
  }
34
- setIsLoadMore(false);
35
- onEndReachedCalledDuringMomentum.current = false;
36
60
  }, []);
37
61
 
38
62
  const handleOnLoadMore = useCallback(() => {
39
- if (!onEndReachedCalledDuringMomentum.current) {
40
- onEndReachedCalledDuringMomentum.current = true;
41
- setPage((preState) => preState + 1);
42
- if (page < maxPageNotification) {
43
- fetchNotifications(page + 1);
44
- }
63
+ setPage((preState) => preState + 1);
64
+ if (page < maxPageNotification) {
65
+ fetchNotifications(page + 1);
45
66
  }
46
67
  }, [page, maxPageNotification, fetchNotifications]);
47
68
 
48
69
  const onRefresh = useCallback(async () => {
49
- setIsRefreshing(true);
50
70
  setPage(1);
51
71
  const { success, data } = await axiosGet(
52
72
  API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1, '')
@@ -55,20 +75,8 @@ const Notification = memo(() => {
55
75
  setNotifications(data.results);
56
76
  setMaxPageNotification(Math.ceil(data.count / 10));
57
77
  }
58
- setIsRefreshing(false);
59
78
  }, []);
60
79
 
61
- const Footer = useCallback(() => {
62
- if (!isLoadMore) {
63
- return null;
64
- }
65
- return (
66
- <View style={styles.footer}>
67
- <ActivityIndicator />
68
- </View>
69
- );
70
- }, [isLoadMore]);
71
-
72
80
  useReceiveNotifications(onRefresh);
73
81
 
74
82
  useEffect(() => {
@@ -85,20 +93,18 @@ const Notification = memo(() => {
85
93
 
86
94
  return (
87
95
  <View style={styles.wrap}>
88
- <FlatList
89
- keyExtractor={(item) => item.id}
90
- renderItem={({ item }) => <NotificationItem item={item} />}
91
- data={notifications}
92
- extraData={notifications}
96
+ <WrapHeaderScrollable
97
+ title={t('notifications')}
98
+ rightComponent={rightComponent}
99
+ onLoadMore={handleOnLoadMore}
93
100
  onRefresh={onRefresh}
94
- onEndReachedThreshold={0.5}
95
- onEndReached={handleOnLoadMore}
96
- refreshing={isRefreshing}
97
- onMomentumScrollBegin={() =>
98
- (onEndReachedCalledDuringMomentum.current = false)
99
- }
100
- ListFooterComponent={<Footer />}
101
- />
101
+ disableLoadMore={page >= maxPageNotification}
102
+ styleScrollView={styles.styleScrollView}
103
+ >
104
+ {notifications.map((item, index) => (
105
+ <NotificationItem item={item} key={index} />
106
+ ))}
107
+ </WrapHeaderScrollable>
102
108
  </View>
103
109
  );
104
110
  });
@@ -13,13 +13,10 @@ export default StyleSheet.create({
13
13
  marginRight: 18,
14
14
  paddingRight: 10,
15
15
  },
16
+ iconPlus: {
17
+ marginRight: 22,
18
+ },
16
19
  styleScrollView: {
17
20
  marginTop: -10,
18
21
  },
19
- footer: {
20
- width: '100%',
21
- height: 50,
22
- justifyContent: 'center',
23
- alignItems: 'center',
24
- },
25
22
  });
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import { FlatList, RefreshControl, TouchableOpacity, View } from 'react-native';
3
- import { useIsFocused } from '@react-navigation/native';
3
+ import { useIsFocused, useNavigation } from '@react-navigation/native';
4
4
 
5
5
  import { axiosGet } from '../../utils/Apis/axios';
6
6
  import { useTranslations } from '../../hooks/Common/useTranslations';
@@ -20,6 +20,7 @@ const Shared = () => {
20
20
  useBlockBackAndroid();
21
21
  const t = useTranslations();
22
22
  useTitleHeader(t('text_shared_with_me'));
23
+ const navigation = useNavigation();
23
24
  const [tab, setTabActiveState] = useState(0);
24
25
  const isFocused = useIsFocused();
25
26
  const [sharedUnits, setSharedUnits] = useState([]);
@@ -132,6 +133,7 @@ const Shared = () => {
132
133
  return (
133
134
  <SharedUnit
134
135
  key={`${item.id}-${item?.is_star}-${item?.is_pin}`}
136
+ navigation={navigation}
135
137
  item={item}
136
138
  index={index}
137
139
  renewItem={renewItem}
@@ -155,6 +157,7 @@ const Shared = () => {
155
157
  return (
156
158
  <SharedUnit
157
159
  key={`${item.id}-${item.is_star}-${item.is_pin}`}
160
+ navigation={navigation}
158
161
  item={item}
159
162
  index={index}
160
163
  renewItem={renewItem}
@@ -58,9 +58,7 @@ const InfoMemberUnit = memo(({ route }) => {
58
58
  if (stateAlertAction?.is_change) {
59
59
  hideAlertAction();
60
60
  if (itemSelected?.role?.is_owner) {
61
- setTimeout(() => {
62
- setIsShowWarning(true);
63
- }, 500);
61
+ setIsShowWarning(true);
64
62
  }
65
63
  } else {
66
64
  removeMember(
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useEffect } from 'react';
2
2
  import { IconOutline } from '@ant-design/icons-react-native';
3
3
  import { useNavigation, useIsFocused } from '@react-navigation/native';
4
- import { Platform, StyleSheet, TouchableOpacity, View } from 'react-native';
4
+ import { StyleSheet, TouchableOpacity, View } from 'react-native';
5
5
  import { useTranslations } from '../../hooks/Common/useTranslations';
6
6
 
7
7
  import { Colors } from '../../configs';
@@ -17,8 +17,6 @@ import { useSCContextSelector } from '../../context';
17
17
  import { useBackendPermission } from '../../utils/Permission/backend';
18
18
  import { ToastBottomHelper } from '../../utils/Utils';
19
19
 
20
- const isAndroid = Platform.OS === 'android';
21
-
22
20
  const MemberList = ({ route }) => {
23
21
  const t = useTranslations();
24
22
  const { navigate } = useNavigation();
@@ -71,16 +69,6 @@ const MemberList = ({ route }) => {
71
69
  hideStateAlertSharingMenu();
72
70
  }, [hideStateAlertSharingMenu, isOwner, leaveUnit, unit.name]);
73
71
 
74
- const getIconRight = useCallback(() => {
75
- if (isOwner) {
76
- if (isAndroid) {
77
- return 'plus-square';
78
- }
79
- return 'plus';
80
- }
81
- return 'ellipsis';
82
- }, [isOwner]);
83
-
84
72
  useEffect(() => {
85
73
  if (isFocused) {
86
74
  onRefresh();
@@ -91,13 +79,12 @@ const MemberList = ({ route }) => {
91
79
  <TouchableOpacity
92
80
  accessibilityLabel={AccessibilityLabel.MEMBER_LIST_RIGHT_HEADER_TOUCH}
93
81
  onPress={onPressRightHeader}
94
- style={[styles.rightHeader]}
82
+ style={styles.rightHeader}
95
83
  >
96
84
  <IconOutline
97
- name={getIconRight()}
85
+ name={isOwner ? 'plus' : 'more'}
98
86
  size={30}
99
87
  color={Colors.Black}
100
- style={{ transform: [{ rotate: isOwner ? '0deg' : '90deg' }] }}
101
88
  />
102
89
  </TouchableOpacity>
103
90
  );
@@ -131,7 +131,6 @@ describe('Test InfoMemberUnit', () => {
131
131
  });
132
132
 
133
133
  it('test change owner', async () => {
134
- jest.useFakeTimers();
135
134
  mock.onGet(API.SHARE.UNIT_MEMBER_INFO(1, 1)).reply(200, {
136
135
  id: 2,
137
136
  identity: 'owner',
@@ -164,7 +163,6 @@ describe('Test InfoMemberUnit', () => {
164
163
  await act(async () => {
165
164
  await alertAction.props.rightButtonClick();
166
165
  });
167
- jest.runAllTimers();
168
166
  expect(alertAction.props.visible).toEqual(false);
169
167
  expect(modalPopupCT.props.isVisible).toEqual(true);
170
168