@widergy/mobile-ui 2.3.0 → 2.3.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.3.2](https://github.com/widergy/mobile-ui/compare/v2.3.1...v2.3.2) (2025-12-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * updates npm token ([dd3df0d](https://github.com/widergy/mobile-ui/commit/dd3df0d2ada2c974f40472ed212d8f46cda1134c))
7
+
8
+ ## [2.3.1](https://github.com/widergy/mobile-ui/compare/v2.3.0...v2.3.1) (2025-12-05)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * [UGOVAES-1094] multiplePicker fixes ([#468](https://github.com/widergy/mobile-ui/issues/468)) ([51a8fc9](https://github.com/widergy/mobile-ui/commit/51a8fc970303bf5f927a5bb592103f091b7181b1))
14
+
1
15
  # [2.3.0](https://github.com/widergy/mobile-ui/compare/v2.2.0...v2.3.0) (2025-12-01)
2
16
 
3
17
 
@@ -31,13 +31,6 @@ class FilePicker extends Component {
31
31
  allowedPDFUploadSizes,
32
32
  pdfFormatError
33
33
  } = this.props;
34
-
35
- const getRealFileType = mimeType => {
36
- if (!mimeType || typeof mimeType !== 'string') return null;
37
- const parts = mimeType.split('/');
38
- return parts[1]?.toLowerCase() || null;
39
- };
40
-
41
34
  try {
42
35
  const normalizeTypes = types => {
43
36
  if (!types || types.length === 0) return DEFAULT_ALLOWED_TYPES;
@@ -78,8 +71,7 @@ class FilePicker extends Component {
78
71
  onMaxSizeError(document.size, maxFileByteSize);
79
72
  return;
80
73
  }
81
- const realFileType = getRealFileType(document.type);
82
- const file = !avoidRetrieveFile && (await retrieveFile(document.uri, realFileType));
74
+ const file = !avoidRetrieveFile && (await retrieveFile(document.uri, document.type));
83
75
 
84
76
  if (file && isPDF && !isEmpty(allowedPDFUploadSizes)) {
85
77
  const isWrongFormat = await pdfAspectRatioValidation(file, allowedPDFUploadSizes);
@@ -93,7 +85,7 @@ class FilePicker extends Component {
93
85
  }
94
86
  }
95
87
  if (onChange) {
96
- onChange(avoidRetrieveFile ? { document } : { file: blobToFile(file, realFileType) });
88
+ onChange(avoidRetrieveFile ? { document } : { file: blobToFile(file, document.type) });
97
89
  }
98
90
  this.setState({ fileName: document.name });
99
91
  } catch (err) {
@@ -57,14 +57,7 @@ const ImagePickerComponent = ({
57
57
  onError('No se pudo obtener el archivo');
58
58
  return;
59
59
  }
60
- const getRealFileType = mimeType => {
61
- if (!mimeType || typeof mimeType !== 'string') return null;
62
- const parts = mimeType.split('/');
63
- return parts[1]?.toLowerCase() || null;
64
- };
65
- const realFileType = getRealFileType(item.type);
66
-
67
- const file = !avoidRetrieveFile && (await retrieveFile(item.uri, realFileType));
60
+ const file = !avoidRetrieveFile && (await retrieveFile(item.uri, item.type));
68
61
  if (!avoidRetrieveFile && !file) {
69
62
  onError(response.errorCode);
70
63
  return;
@@ -79,12 +79,6 @@ const MultipleFilePicker = ({
79
79
 
80
80
  const remainingSlots = () => Math.max((maxFiles || 0) - uploadedFiles.length, 0);
81
81
 
82
- const getRealFileType = mimeType => {
83
- if (!mimeType || typeof mimeType !== 'string') return null;
84
- const parts = mimeType.split('/');
85
- return parts[1]?.toLowerCase() || null;
86
- };
87
-
88
82
  const handleAssets = async response => {
89
83
  if (!response || response.didCancel) {
90
84
  return;
@@ -95,17 +89,18 @@ const MultipleFilePicker = ({
95
89
  }
96
90
  closeDrawer();
97
91
  response.assets.forEach(async asset => {
98
- const realFileType = getRealFileType(asset.mimeType);
99
- const file = await retrieveFile(asset.uri, realFileType);
92
+ // We should use mimeType instead of type:
93
+ // asset.type -> "video" | "image".
94
+ const file = await retrieveFile(asset.uri, asset.mimeType);
100
95
  if (!file) {
101
96
  onError(response.errorCode || 'No se pudo obtener el archivo');
102
97
  return;
103
98
  }
104
- if (isFileTypeInvalid({ type: asset.type }, allowedTypes, fileTypeError, onError)) return;
99
+ if (isFileTypeInvalid({ type: asset.mimeType }, allowedTypes, fileTypeError, onError)) return;
105
100
  if (isFileSizeInvaid({ size: file.size }, maxFileByteSize, onMaxSizeError)) return;
106
101
  setNewFile({
107
102
  uploadFile: { name: file.data.name, size: file.data.size },
108
- rawFile: blobToFile(file, realFileType)
103
+ rawFile: blobToFile(file, asset.mimeType)
109
104
  });
110
105
  });
111
106
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "2.3.0",
5
+ "version": "2.3.2",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [