@widergy/mobile-ui 2.0.2 → 2.1.1

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.1.1](https://github.com/widergy/mobile-ui/compare/v2.1.0...v2.1.1) (2025-10-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * attachment upload failure ([#461](https://github.com/widergy/mobile-ui/issues/461)) ([49ed4d1](https://github.com/widergy/mobile-ui/commit/49ed4d1a5100b259c579325cc6cf36af5e33ea04))
7
+
8
+ # [2.1.0](https://github.com/widergy/mobile-ui/compare/v2.0.2...v2.1.0) (2025-10-17)
9
+
10
+
11
+ ### Features
12
+
13
+ * with back button option ([#460](https://github.com/widergy/mobile-ui/issues/460)) ([f730f54](https://github.com/widergy/mobile-ui/commit/f730f54c4c2c7498040ae434c4c6948cf679aaa4))
14
+
1
15
  ## [2.0.2](https://github.com/widergy/mobile-ui/compare/v2.0.1...v2.0.2) (2025-10-08)
2
16
 
3
17
 
@@ -31,6 +31,13 @@ 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
+
34
41
  try {
35
42
  const normalizeTypes = types => {
36
43
  if (!types || types.length === 0) return DEFAULT_ALLOWED_TYPES;
@@ -71,7 +78,8 @@ class FilePicker extends Component {
71
78
  onMaxSizeError(document.size, maxFileByteSize);
72
79
  return;
73
80
  }
74
- const file = !avoidRetrieveFile && (await retrieveFile(document.uri, document.type));
81
+ const realFileType = getRealFileType(document.type);
82
+ const file = !avoidRetrieveFile && (await retrieveFile(document.uri, realFileType));
75
83
 
76
84
  if (file && isPDF && !isEmpty(allowedPDFUploadSizes)) {
77
85
  const isWrongFormat = await pdfAspectRatioValidation(file, allowedPDFUploadSizes);
@@ -85,7 +93,7 @@ class FilePicker extends Component {
85
93
  }
86
94
  }
87
95
  if (onChange) {
88
- onChange(avoidRetrieveFile ? { document } : { file: blobToFile(file, document.type) });
96
+ onChange(avoidRetrieveFile ? { document } : { file: blobToFile(file, realFileType) });
89
97
  }
90
98
  this.setState({ fileName: document.name });
91
99
  } catch (err) {
@@ -57,7 +57,14 @@ const ImagePickerComponent = ({
57
57
  onError('No se pudo obtener el archivo');
58
58
  return;
59
59
  }
60
- const file = !avoidRetrieveFile && (await retrieveFile(item.uri, item.type));
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));
61
68
  if (!avoidRetrieveFile && !file) {
62
69
  onError(response.errorCode);
63
70
  return;
@@ -79,6 +79,12 @@ 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
+
82
88
  const handleAssets = async response => {
83
89
  if (!response || response.didCancel) {
84
90
  return;
@@ -89,7 +95,8 @@ const MultipleFilePicker = ({
89
95
  }
90
96
  closeDrawer();
91
97
  response.assets.forEach(async asset => {
92
- const file = await retrieveFile(asset.uri, asset.type);
98
+ const realFileType = getRealFileType(asset.mimeType);
99
+ const file = await retrieveFile(asset.uri, realFileType);
93
100
  if (!file) {
94
101
  onError(response.errorCode || 'No se pudo obtener el archivo');
95
102
  return;
@@ -98,7 +105,7 @@ const MultipleFilePicker = ({
98
105
  if (isFileSizeInvaid({ size: file.size }, maxFileByteSize, onMaxSizeError)) return;
99
106
  setNewFile({
100
107
  uploadFile: { name: file.data.name, size: file.data.size },
101
- rawFile: blobToFile(file, asset.type)
108
+ rawFile: blobToFile(file, realFileType)
102
109
  });
103
110
  });
104
111
  };
@@ -20,7 +20,7 @@ const UTTopbar = ({
20
20
  stages,
21
21
  stepsCount,
22
22
  theme,
23
- topbar: { colorTheme = 'light', goBack, title, Icon } = {}
23
+ topbar: { colorTheme = 'light', goBack, title, Icon, withBackButton = true } = {}
24
24
  }) => {
25
25
  const ownTheme = theme.UTWorkflowContainer?.topbar?.[colorTheme];
26
26
 
@@ -41,15 +41,17 @@ const UTTopbar = ({
41
41
  return (
42
42
  <View>
43
43
  <View style={[ownStyles.container, ownTheme?.container]}>
44
- <UTButton
45
- dataTestId={goBackTestId}
46
- Icon={Icon || 'IconArrowLeft'}
47
- onPress={goBack}
48
- style={{
49
- root: ownStyles.goBack
50
- }}
51
- variant="text"
52
- />
44
+ {withBackButton && (
45
+ <UTButton
46
+ dataTestId={goBackTestId}
47
+ Icon={Icon || 'IconArrowLeft'}
48
+ onPress={goBack}
49
+ style={{
50
+ root: ownStyles.goBack
51
+ }}
52
+ variant="text"
53
+ />
54
+ )}
53
55
  <UTLabel
54
56
  colorTheme={ownTheme?.text || 'dark'}
55
57
  dataTestId={titleTestId}
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.0.2",
5
+ "version": "2.1.1",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [