@eohjsc/react-native-smart-city 0.7.36 → 0.7.37

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.7.36",
4
+ "version": "0.7.37",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -151,7 +151,7 @@ const styles = StyleSheet.create({
151
151
  androidStyle: {
152
152
  lineHeight: 22,
153
153
  includeFontPadding: false,
154
- marginBottom: 8,
154
+ marginVertical: 8,
155
155
  },
156
156
  lineHeight20: {
157
157
  lineHeight: 20,
@@ -10,7 +10,7 @@ export default StyleSheet.create({
10
10
  paddingLeft: 7,
11
11
  paddingRight: 10,
12
12
  paddingBottom: 6,
13
- paddingTop: getStatusBarHeight() + 20,
13
+ paddingTop: getStatusBarHeight() + 30,
14
14
  },
15
15
  separator: {
16
16
  borderBottomWidth: 0.5,
@@ -10,7 +10,7 @@ import { AccessibilityLabel } from '../../configs/Constants';
10
10
 
11
11
  const screenHeight = Constants.height;
12
12
  const default_height = 45;
13
- const paddingIos = getStatusBarHeight() + 20;
13
+ const paddingIos = getStatusBarHeight() + 30;
14
14
  export const title_height = 44;
15
15
  export const heightHeader = default_height + title_height + paddingIos;
16
16
 
@@ -1,5 +1,5 @@
1
1
  import React, { memo, useCallback } from 'react';
2
- import { FlatList, StyleSheet, View } from 'react-native';
2
+ import { StyleSheet, View } from 'react-native';
3
3
  import { useTranslations } from '../../hooks/Common/useTranslations';
4
4
 
5
5
  import { Colors } from '../../configs';
@@ -8,7 +8,6 @@ import ImageButton from '../ImageButton';
8
8
  import { ModalCustom } from '../Modal';
9
9
  import packageJson from '../../../package.json';
10
10
 
11
- const keyExtractor = (item) => item.id.toString();
12
11
  const MenuActionAddnew = memo(
13
12
  ({ visible, hideModal, dataActions, onItemClick }) => {
14
13
  const t = useTranslations();
@@ -21,25 +20,6 @@ const MenuActionAddnew = memo(
21
20
  [onItemClick]
22
21
  );
23
22
 
24
- const renderItem = useCallback(
25
- ({ item }) => {
26
- return (
27
- <View
28
- style={{
29
- ...styles.action,
30
- flexBasis: `${100 / numColumns}%`,
31
- }}
32
- >
33
- <ImageButton onPress={() => onPress(item)} image={item.image} />
34
- <View style={styles.actionTextWrap}>
35
- <Text styles={styles.actionText}>{item.text}</Text>
36
- </View>
37
- </View>
38
- );
39
- },
40
- [numColumns, onPress]
41
- );
42
-
43
23
  return (
44
24
  <ModalCustom
45
25
  isVisible={visible}
@@ -53,15 +33,23 @@ const MenuActionAddnew = memo(
53
33
  <Text style={styles.modalHeaderText}>{t('add_new')}</Text>
54
34
  </View>
55
35
 
56
- <FlatList
57
- bounces={false}
58
- numColumns={numColumns}
59
- contentContainerStyle={styles.actionWrapper}
60
- data={dataActions}
61
- keyExtractor={keyExtractor}
62
- renderItem={renderItem}
63
- scrollIndicatorInsets={{ right: 1 }}
64
- />
36
+ <View style={styles.actionWrapper}>
37
+ {dataActions.map((item) => (
38
+ <View
39
+ key={item.id.toString()}
40
+ style={[styles.action, { width: `${100 / numColumns}%` }]}
41
+ >
42
+ <ImageButton
43
+ onPress={() => onPress(item)}
44
+ image={item.image}
45
+ />
46
+ <View style={styles.actionTextWrap}>
47
+ <Text style={styles.actionText}>{item.text}</Text>
48
+ </View>
49
+ </View>
50
+ ))}
51
+ </View>
52
+
65
53
  <View style={styles.modalHeader}>
66
54
  <Text
67
55
  style={styles.modalHeaderText}
@@ -88,7 +76,6 @@ const styles = StyleSheet.create({
88
76
  borderRadius: 10,
89
77
  },
90
78
  modalWrapper: {
91
- flex: 1,
92
79
  flexDirection: 'column',
93
80
  backgroundColor: Colors.White,
94
81
  borderRadius: 10,
@@ -110,7 +97,8 @@ const styles = StyleSheet.create({
110
97
  },
111
98
  actionWrapper: {
112
99
  padding: 16,
113
- flex: 1,
100
+ flexDirection: 'row',
101
+ flexWrap: 'wrap',
114
102
  },
115
103
  action: {
116
104
  marginBottom: 25,
@@ -106,8 +106,7 @@ const HeaderUnit = memo(({ transparent, unit }) => {
106
106
 
107
107
  export default HeaderUnit;
108
108
 
109
- const stickyHeaderHeight =
110
- Device.TopbarHeight + (Device.isIOS ? 0 : StatusBar.currentHeight);
109
+ const stickyHeaderHeight = Device.TopbarHeight + (Device.isIOS ? 0 : 30);
111
110
 
112
111
  const styles = StyleSheet.create({
113
112
  container: {
@@ -10,8 +10,7 @@ import FImage from '../FImage';
10
10
  import { useTranslations } from '../../hooks/Common/useTranslations';
11
11
  import ParallaxScrollView from '../../libs/react-native-parallax-scroll-view';
12
12
 
13
- const stickyHeaderHeight =
14
- Device.TopbarHeight + (Device.isIOS ? 0 : StatusBar.currentHeight);
13
+ const stickyHeaderHeight = Device.TopbarHeight + (Device.isIOS ? 0 : 30);
15
14
 
16
15
  const WrapParallaxScrollView = ({ children, unit, onRefresh }) => {
17
16
  const { name = '', background } = unit;
@@ -17,6 +17,6 @@ export default {
17
17
  isIOS: Platform.OS === 'ios',
18
18
  isIphoneX,
19
19
  ToolbarHeight: isIphoneX ? 44 : Platform.OS === 'ios' ? 20 : 0,
20
- TopbarHeight: isIphoneX ? 88 : Platform.OS === 'ios' ? 64 : 44, //incule toolbar
20
+ TopbarHeight: isIphoneX ? 88 : Platform.OS === 'ios' ? 64 : 50, //incule toolbar
21
21
  androidSmallHeight: Platform.OS === 'android' && height < 600,
22
22
  };
@@ -34,7 +34,6 @@ const Automate = () => {
34
34
  const isFocused = useIsFocused();
35
35
  const { setOptions, navigate } = useNavigation();
36
36
  const [automatesData, setAutomatesData] = useState([]);
37
- const [isLoading, setIsLoading] = useState(false);
38
37
  const { name: currentRouteName } = useRoute();
39
38
  const starredScriptIds = useSCContextSelector(
40
39
  (state) => state.automate.starredScriptIds
@@ -55,8 +54,11 @@ const Automate = () => {
55
54
  }, [automatesData, starredScriptIds]);
56
55
 
57
56
  const getAutomates = useCallback(async () => {
58
- setIsLoading(true);
59
- const { success, data } = await axiosGet(API.AUTOMATE.GET_SMART());
57
+ const { success, data } = await axiosGet(
58
+ API.AUTOMATE.GET_SMART(),
59
+ {},
60
+ true
61
+ );
60
62
  if (success && data && data.length) {
61
63
  const multiUnit = data[0];
62
64
  const haveAutomates = data
@@ -67,7 +69,6 @@ const Automate = () => {
67
69
  .filter((unit) => !unit.automates.length);
68
70
  setAutomatesData([multiUnit, ...haveAutomates, ...notHaveAutomates]);
69
71
  }
70
- setIsLoading(false);
71
72
  }, []);
72
73
 
73
74
  const onPressItem = useCallback(
@@ -224,7 +225,6 @@ const Automate = () => {
224
225
 
225
226
  return (
226
227
  <View style={styles.wrap}>
227
- {isLoading && <Loading />}
228
228
  <FlatList
229
229
  keyExtractor={keyExtractor}
230
230
  data={sortedAutomateData}
@@ -51,7 +51,9 @@ const Notification = memo(() => {
51
51
 
52
52
  const fetchNotifications = useCallback(async (pageParam) => {
53
53
  const { success, data } = await axiosGet(
54
- API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(pageParam)
54
+ API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(pageParam),
55
+ {},
56
+ true
55
57
  );
56
58
  if (success) {
57
59
  setNotifications((preState) => preState.concat(data.results));
@@ -69,7 +71,9 @@ const Notification = memo(() => {
69
71
  const onRefresh = useCallback(async () => {
70
72
  setPage(1);
71
73
  const { success, data } = await axiosGet(
72
- API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1)
74
+ API.NOTIFICATION.LIST_EOH_NOTIFICATIONS(1),
75
+ {},
76
+ true
73
77
  );
74
78
  if (success) {
75
79
  setNotifications(data.results);
@@ -51,7 +51,8 @@ const Shared = () => {
51
51
  const filterSharedUnits = useCallback(async (field, config) => {
52
52
  const { success, data } = await axiosGet(
53
53
  API.UNIT.FILTER_SHARED_UNITS(field),
54
- config
54
+ config,
55
+ true
55
56
  );
56
57
  if (success) {
57
58
  setSharedUnits(data);
@@ -9,7 +9,7 @@ export default StyleSheet.create({
9
9
  wrap: {
10
10
  flex: 1,
11
11
  backgroundColor: Colors.Gray2,
12
- paddingTop: getStatusBarHeight() + 10,
12
+ paddingTop: getStatusBarHeight() + 30,
13
13
  },
14
14
  padding: {
15
15
  paddingHorizontal: 16,