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

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.65",
4
+ "version": "0.2.66",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -23,7 +23,7 @@ const EditDevice = memo(() => {
23
23
  const navigation = useNavigation();
24
24
  const { params = {} } = useRoute();
25
25
  const { sensor, setSensorNameDetail, sensorNameDetail } = params;
26
- const [inputName, setInputName] = useState('');
26
+ const [inputName, setInputName] = useState(sensorNameDetail || '');
27
27
  const [sensorName, setSensorName] = useState(sensorNameDetail || '');
28
28
  const { stateAlertAction, hideAlertAction, onShowRename, onShowDelete } =
29
29
  useEditDevice();
@@ -130,8 +130,8 @@ const EditDevice = memo(() => {
130
130
  >
131
131
  {!stateAlertAction.isDelete && (
132
132
  <_TextInput
133
- onChange={(text) => setInputName(text)}
134
- defaultValue={sensorName}
133
+ onChange={setInputName}
134
+ value={inputName}
135
135
  textInputStyle={styles.textInputStyle}
136
136
  wrapStyle={styles.textInputWrapStyle}
137
137
  selectionColor={Colors.Primary}
@@ -13,7 +13,6 @@ import {
13
13
  SafeAreaView,
14
14
  } from 'react-native';
15
15
  import { useNavigation } from '@react-navigation/native';
16
- import ImageResizer from 'react-native-image-resizer';
17
16
  import { useTranslations } from '../../hooks/Common/useTranslations';
18
17
 
19
18
  import { API, Colors } from '../../configs';
@@ -26,26 +25,6 @@ import { ToastBottomHelper } from '../../utils/Utils';
26
25
  import { TESTID } from '../../configs/Constants';
27
26
  import styles from './AddSubUnitStyles';
28
27
 
29
- const MAX_FILE_SIZE_BYTES = 1.5 * 1024 * 1024; // 1.5mb
30
-
31
- const prepareImageToUpload = async (image) => {
32
- if (!image || image.size < MAX_FILE_SIZE_BYTES) {
33
- return image;
34
- }
35
- const result = await ImageResizer.createResizedImage(
36
- image.path,
37
- 1280,
38
- 1280,
39
- 'JPEG',
40
- 70
41
- );
42
- return {
43
- fileName: result?.name,
44
- type: 'image/jpeg',
45
- uri: result?.uri,
46
- };
47
- };
48
-
49
28
  const AddSubUnit = ({ route }) => {
50
29
  const t = useTranslations();
51
30
  const { navigate, goBack } = useNavigation();
@@ -72,7 +51,6 @@ const AddSubUnit = ({ route }) => {
72
51
  address: location,
73
52
  background: wallpaper,
74
53
  };
75
- dataObj.background = await prepareImageToUpload(dataObj.background);
76
54
  const formData = createFormData(dataObj, ['background']);
77
55
  const { success, data } = await axiosPost(
78
56
  API.UNIT.CREATE_UNIT(),
@@ -99,7 +77,6 @@ const AddSubUnit = ({ route }) => {
99
77
  if (!awaitCreate.current) {
100
78
  awaitCreate.current = true;
101
79
  const dataObj = { name: roomName, background: wallpaper };
102
- dataObj.background = await prepareImageToUpload(dataObj.background);
103
80
  const formData = createFormData(dataObj, ['background']);
104
81
  const { success } = await axiosPost(
105
82
  API.SUB_UNIT.CREATE_SUB_UNIT(unit.id),
@@ -22,12 +22,12 @@ const TDSGuide = memo(() => {
22
22
  >
23
23
  {t('what_is_tds_title')}
24
24
  </Text>
25
- <Text type="Body">{t('what_is_tds_text')}</Text>
25
+ <Text style={styles.tdsText}>{t('what_is_tds_text')}</Text>
26
26
  <Text type="H3" semibold style={styles.titlePadding}>
27
27
  {t('tds_guidlines_title')}
28
28
  </Text>
29
29
  <>
30
- <Text type="Body">
30
+ <Text style={styles.tdsText}>
31
31
  {t('tds_guidlines_text_1')}
32
32
  {'\n'}
33
33
  {'\n'}
@@ -56,4 +56,7 @@ const styles = StyleSheet.create({
56
56
  paddingTop: 20,
57
57
  paddingBottom: 10,
58
58
  },
59
+ tdsText: {
60
+ fontSize: 15,
61
+ },
59
62
  });
@@ -2,7 +2,6 @@ import axios from 'axios';
2
2
  import { deleteData, getData, storeData } from '../Storage';
3
3
  import { ToastBottomHelper } from '../Utils';
4
4
  import NetInfo from '@react-native-community/netinfo';
5
- import { Platform } from 'react-native';
6
5
 
7
6
  export const replaceParams = (apiURL, params) => {
8
7
  let _result = apiURL;
@@ -166,9 +165,9 @@ export function createFormData(data, list_file_field) {
166
165
  }
167
166
 
168
167
  formData.append(key, {
169
- uri: Platform.OS === 'ios' ? item.sourceURL : item.path,
170
- type: item.mime,
171
168
  name: item.filename || item.path?.split('/').pop(),
169
+ type: item.mime,
170
+ uri: item.path,
172
171
  });
173
172
  return;
174
173
  }