@widergy/mobile-ui 0.35.6 → 0.35.7

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,10 @@
1
+ ## [0.35.7](https://github.com/widergy/mobile-ui/compare/v0.35.6...v0.35.7) (2022-11-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * now blob gets converted to file when returning ([#230](https://github.com/widergy/mobile-ui/issues/230)) ([7d1c01f](https://github.com/widergy/mobile-ui/commit/7d1c01f0d06eb5c0bb098316512adc23f8c4f3ab))
7
+
1
8
  ## [0.35.6](https://github.com/widergy/mobile-ui/compare/v0.35.5...v0.35.6) (2022-10-28)
2
9
 
3
10
 
@@ -5,7 +5,7 @@ import DocumentPicker from 'react-native-document-picker';
5
5
  import { isEmpty } from '@widergy/web-utils/lib/array';
6
6
 
7
7
  import Picker from '../Picker';
8
- import { retrieveFile, isImageByUri } from '../../utils/fileUtils.js';
8
+ import { retrieveFile, isImageByUri, blobToFile } from '../../utils/fileUtils.js';
9
9
 
10
10
  import { UPLOAD_ICON, DEFAULT_ALLOWED_TYPES, DEFAULT_MAX_SIZE } from './constants';
11
11
  import filePickerPropTypes from './propTypes';
@@ -62,7 +62,7 @@ class FilePicker extends Component {
62
62
  }
63
63
  }
64
64
  if (onChange) {
65
- onChange(avoidRetrieveFile ? { document } : { file });
65
+ onChange(avoidRetrieveFile ? { document } : { file: blobToFile(file, document.type) });
66
66
  }
67
67
  this.setState({ fileName: document.name });
68
68
  } catch (err) {
@@ -12,7 +12,7 @@ export const isImageByUri = uri => {
12
12
  return uCaseUri.includes('.JPG') || uCaseUri.includes('.JPEG') || uCaseUri.includes('PNG');
13
13
  };
14
14
 
15
- const blobToFile = (blob, type) => new File([blob], blob.data.name, { type });
15
+ export const blobToFile = (blob, type) => new File([blob], blob.data.name, { type });
16
16
 
17
17
  export const retrieveFile = async (uri, type) => {
18
18
  const uriToUse = IS_IOS ? uri.replace('file://', '') : uri;
@@ -33,7 +33,7 @@ export const retrieveFile = async (uri, type) => {
33
33
  blob = await res.blob();
34
34
  }
35
35
 
36
- return blobToFile(blob, type);
36
+ return blob;
37
37
  };
38
38
 
39
39
  export const MEGABYTE = 1024 * 1024;
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": "0.35.6",
5
+ "version": "0.35.7",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [