@eohjsc/react-native-smart-city 0.3.17 → 0.3.18

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.3.17",
4
+ "version": "0.3.18",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -22,8 +22,8 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
22
22
 
23
23
  // eslint-disable-next-line no-unused-vars
24
24
  const [configValues, setConfigValues] = useConfigGlobalState('configValues');
25
- const [value, setValue] = useState();
26
25
  const valueDefault = 28;
26
+ const [value, setValue] = useState(valueDefault);
27
27
 
28
28
  useEffect(() => {
29
29
  if (sensor?.device_type === DEVICE_TYPE.LG_THINQ) {
@@ -40,15 +40,12 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
40
40
 
41
41
  useEffect(() => {
42
42
  if (!config) {
43
- setValue(valueDefault);
44
43
  return;
45
44
  }
46
45
 
47
46
  const configValue = configValues[config];
48
47
  if (configValue !== null && configValue !== undefined) {
49
48
  setValue(configValue);
50
- } else {
51
- setValue(valueDefault);
52
49
  }
53
50
  // eslint-disable-next-line react-hooks/exhaustive-deps
54
51
  }, [JSON.stringify(configValues)]);
@@ -64,7 +64,7 @@ const AddCommonSelectSubUnit = ({ route }) => {
64
64
  const fetchDetails = useCallback(async () => {
65
65
  const { success, data } = await axiosGet(
66
66
  API.UNIT.UNIT_DETAIL(unit_id),
67
- {},
67
+ { headers: { 'Cache-Control': 'no-cache' } },
68
68
  true
69
69
  );
70
70
  if (success) {
@@ -13,7 +13,7 @@ const useConnectDevices = (new_sensor, station_id, unit_id) => {
13
13
  const fetchDetails = useCallback(async () => {
14
14
  const { success: fetchSuccess, data: unit } = await axiosGet(
15
15
  API.UNIT.UNIT_DETAIL(unit_id),
16
- {},
16
+ { headers: { 'Cache-Control': 'no-cache' } },
17
17
  true
18
18
  );
19
19
  const station = unit.stations.find((item) => item.id === station_id);
@@ -27,7 +27,7 @@ const AddNewDevice = memo(({ route }) => {
27
27
  const fetchDetails = useCallback(async () => {
28
28
  const { success, data } = await axiosGet(
29
29
  API.UNIT.UNIT_DETAIL(unit_id),
30
- {},
30
+ { headers: { 'Cache-Control': 'no-cache' } },
31
31
  true
32
32
  );
33
33
  if (success) {
@@ -9,7 +9,7 @@ const useConnectGateway = (unit_id) => {
9
9
  const fetchDetails = useCallback(async () => {
10
10
  const { success: fetchSuccess, data: unit } = await axiosGet(
11
11
  API.UNIT.UNIT_DETAIL(unit_id),
12
- {},
12
+ { headers: { 'Cache-Control': 'no-cache' } },
13
13
  true
14
14
  );
15
15
  return { fetchSuccess, unit };
@@ -11,7 +11,7 @@ export default (unit) => {
11
11
  setIsLoading(true);
12
12
  const { success, data } = await axiosGet(
13
13
  API.UNIT.UNIT_DETAIL(unit?.id),
14
- {},
14
+ { headers: { 'Cache-Control': 'no-cache' } },
15
15
  true
16
16
  );
17
17
  if (success) {
@@ -24,7 +24,7 @@ const AddLGDevice = memo(({ route }) => {
24
24
  const fetchDetails = useCallback(async () => {
25
25
  const { success, data } = await axiosGet(
26
26
  API.UNIT.UNIT_DETAIL(unit_id),
27
- {},
27
+ { headers: { 'Cache-Control': 'no-cache' } },
28
28
  true
29
29
  );
30
30
  if (success) {
@@ -257,6 +257,7 @@ const UnitDetail = ({ route }) => {
257
257
  unit={unit}
258
258
  favoriteDevices={favoriteDevices}
259
259
  favoriteAutomates={favoriteAutomates}
260
+ wrapItemStyle={styles.wrapItemStyle}
260
261
  />
261
262
  );
262
263
  }
@@ -1,5 +1,10 @@
1
1
  import { StyleSheet } from 'react-native';
2
- import { Colors } from '../../configs';
2
+ import { Colors, Constants } from '../../configs';
3
+
4
+ const marginItem = 12;
5
+ const marginHorizontal = 16;
6
+ const widthItem = (Constants.width - marginHorizontal * 2 - marginItem) / 2;
7
+ const heightItem = (widthItem / 166) * 126;
3
8
 
4
9
  export default StyleSheet.create({
5
10
  container: {
@@ -71,6 +76,10 @@ export default StyleSheet.create({
71
76
  margin: 0,
72
77
  padding: 0,
73
78
  },
79
+ wrapItemStyle: {
80
+ height: heightItem,
81
+ marginVertical: 0,
82
+ },
74
83
  camera: {
75
84
  width: 1,
76
85
  height: 1,
@@ -93,7 +93,7 @@ const UnitSummary = memo(({ route }) => {
93
93
  const fetchUnitDetail = useCallback(async () => {
94
94
  const { success, data } = await axiosGet(
95
95
  API.UNIT.UNIT_DETAIL(unit?.id),
96
- {},
96
+ { headers: { 'Cache-Control': 'no-cache' } },
97
97
  true
98
98
  );
99
99
  if (success) {