@eohjsc/react-native-smart-city 0.2.64 → 0.2.65

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.2.64",
4
+ "version": "0.2.65",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -59,7 +59,7 @@ const AllCamera = () => {
59
59
  navigate(Routes.PlaybackCamera, { item, thumbnail });
60
60
  };
61
61
 
62
- const CameraItem = ({ item }) => {
62
+ const CameraItem = ({ item, width, height }) => {
63
63
  return (
64
64
  <View style={styles.wrap}>
65
65
  {!!item && (
@@ -74,6 +74,8 @@ const AllCamera = () => {
74
74
  amount={amount}
75
75
  handleFullScreen={handleFullScreen}
76
76
  goToPlayBack={goToPlayBack(item, thumbnail)}
77
+ width={width}
78
+ height={height}
77
79
  />
78
80
  )}
79
81
  </View>
@@ -88,12 +90,32 @@ const AllCamera = () => {
88
90
  ) : amount === 4 ? (
89
91
  <>
90
92
  <View style={styles.row}>
91
- <CameraItem key={item?.id} item={item[0]} />
92
- <CameraItem key={item?.id} item={item[1]} />
93
+ <CameraItem
94
+ key={item?.id}
95
+ item={item[0]}
96
+ width={188}
97
+ height={112}
98
+ />
99
+ <CameraItem
100
+ key={item?.id}
101
+ item={item[1]}
102
+ width={188}
103
+ height={112}
104
+ />
93
105
  </View>
94
106
  <View style={styles.row}>
95
- <CameraItem key={item?.id} item={item[2]} />
96
- <CameraItem key={item?.id} item={item[3]} />
107
+ <CameraItem
108
+ key={item?.id}
109
+ item={item[2]}
110
+ width={188}
111
+ height={112}
112
+ />
113
+ <CameraItem
114
+ key={item?.id}
115
+ item={item[3]}
116
+ width={188}
117
+ height={112}
118
+ />
97
119
  </View>
98
120
  </>
99
121
  ) : (
@@ -56,6 +56,13 @@ const AddSubUnit = ({ route }) => {
56
56
  const [showImagePicker, setShowImagePicker] = useState(false);
57
57
  let awaitCreate = useRef(false);
58
58
 
59
+ const cleanData = () => {
60
+ setRoomName('');
61
+ setWallpaper('');
62
+ setImageUrl('');
63
+ awaitCreate.current = false;
64
+ };
65
+
59
66
  const goDone = useCallback(async () => {
60
67
  if (isAddUnit) {
61
68
  if (!awaitCreate.current) {
@@ -82,6 +89,7 @@ const AddSubUnit = ({ route }) => {
82
89
  routeName: Routes.DashboardStack,
83
90
  },
84
91
  });
92
+ cleanData();
85
93
  } else {
86
94
  awaitCreate.current = false;
87
95
  ToastBottomHelper.error(t('text_create_unit_fail'));
@@ -93,7 +101,7 @@ const AddSubUnit = ({ route }) => {
93
101
  const dataObj = { name: roomName, background: wallpaper };
94
102
  dataObj.background = await prepareImageToUpload(dataObj.background);
95
103
  const formData = createFormData(dataObj, ['background']);
96
- const { success, data } = await axiosPost(
104
+ const { success } = await axiosPost(
97
105
  API.SUB_UNIT.CREATE_SUB_UNIT(unit.id),
98
106
  formData,
99
107
  {
@@ -115,10 +123,12 @@ const AddSubUnit = ({ route }) => {
115
123
  screen: Routes.UnitDetail,
116
124
  params: {
117
125
  unitId: unit.id,
118
- unitData: data,
126
+ unitData: unit,
119
127
  isAddSubUnit: true,
128
+ routeName: Routes.DashboardStack,
120
129
  },
121
130
  });
131
+ cleanData();
122
132
  } else {
123
133
  awaitCreate.current = false;
124
134
  ToastBottomHelper.error(t('text_create_sub_unit_fail'));
@@ -188,6 +198,7 @@ const AddSubUnit = ({ route }) => {
188
198
  textInputStyle={styles.roomName}
189
199
  wrapStyle={styles.textInput}
190
200
  selectionColor={Colors.Primary}
201
+ value={roomName}
191
202
  />
192
203
 
193
204
  {isAddUnit && (
@@ -161,7 +161,8 @@ describe('Test AddSubUnit', () => {
161
161
  screen: Routes.UnitDetail,
162
162
  params: {
163
163
  unitId: route.params.unit.id,
164
- unitData: response.data,
164
+ unitData: route.params.unit,
165
+ routeName: 'DashboardStack',
165
166
  isAddSubUnit: true,
166
167
  },
167
168
  });
@@ -30,7 +30,9 @@ import { AUTOMATE_TYPE } from '../../configs/Constants';
30
30
 
31
31
  const UnitDetail = ({ route }) => {
32
32
  const t = useTranslations();
33
+
33
34
  const { unitId, unitData, isOneTap, routeName, isAddSubUnit } = route.params;
35
+
34
36
  const isFocused = useIsFocused();
35
37
  const { stateData, setAction } = useContext(SCContext);
36
38
  const { navigate } = useNavigation();
@@ -253,7 +255,7 @@ const UnitDetail = ({ route }) => {
253
255
  };
254
256
 
255
257
  const renderDetailSubUnit = () => {
256
- if (station.isFavorites) {
258
+ if (station?.isFavorites) {
257
259
  return (
258
260
  <SubUnitFavorites
259
261
  unit={unit}
@@ -450,9 +450,9 @@ const styles = StyleSheet.create({
450
450
  position: 'absolute',
451
451
  fontSize: 20,
452
452
  transform: [{ rotate: '90deg' }],
453
- left: -28,
453
+ left: -40,
454
454
  bottom: 8,
455
- width: 115,
455
+ width: 150,
456
456
  height: 28,
457
457
  textAlign: 'center',
458
458
  },