Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-image-picker

Package Overview
Dependencies
Maintainers
24
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-image-picker - npm Package Compare versions

Comparing version 10.1.4 to 10.2.0

8

build/ExponentImagePicker.web.d.ts

@@ -1,12 +0,14 @@

import { PermissionResponse } from 'unimodules-permissions-interface';
import { PermissionResponse } from 'expo-modules-core';
import { ImagePickerMultipleResult, ImagePickerResult, MediaTypeOptions } from './ImagePicker.types';
declare const _default: {
readonly name: string;
launchImageLibraryAsync({ mediaTypes, allowsMultipleSelection, }: {
launchImageLibraryAsync({ mediaTypes, allowsMultipleSelection, base64, }: {
mediaTypes?: MediaTypeOptions | undefined;
allowsMultipleSelection?: boolean | undefined;
base64?: boolean | undefined;
}): Promise<ImagePickerResult | ImagePickerMultipleResult>;
launchCameraAsync({ mediaTypes, allowsMultipleSelection, }: {
launchCameraAsync({ mediaTypes, allowsMultipleSelection, base64, }: {
mediaTypes?: MediaTypeOptions | undefined;
allowsMultipleSelection?: boolean | undefined;
base64?: boolean | undefined;
}): Promise<ImagePickerResult | ImagePickerMultipleResult>;

@@ -13,0 +15,0 @@ getCameraPermissionsAsync(): Promise<PermissionResponse>;

import { Platform } from '@unimodules/core';
import { PermissionStatus } from 'unimodules-permissions-interface';
import { PermissionStatus } from 'expo-modules-core';
import { v4 } from 'uuid';

@@ -14,3 +14,3 @@ import { MediaTypeOptions, } from './ImagePicker.types';

},
async launchImageLibraryAsync({ mediaTypes = MediaTypeOptions.Images, allowsMultipleSelection = false, }) {
async launchImageLibraryAsync({ mediaTypes = MediaTypeOptions.Images, allowsMultipleSelection = false, base64 = false, }) {
// SSR guard

@@ -23,5 +23,6 @@ if (!Platform.isDOMAvailable) {

allowsMultipleSelection,
base64,
});
},
async launchCameraAsync({ mediaTypes = MediaTypeOptions.Images, allowsMultipleSelection = false, }) {
async launchCameraAsync({ mediaTypes = MediaTypeOptions.Images, allowsMultipleSelection = false, base64 = false, }) {
// SSR guard

@@ -35,2 +36,3 @@ if (!Platform.isDOMAvailable) {

capture: true,
base64,
});

@@ -66,3 +68,3 @@ },

}
function openFileBrowserAsync({ mediaTypes, capture = false, allowsMultipleSelection = false, }) {
function openFileBrowserAsync({ mediaTypes, capture = false, allowsMultipleSelection = false, base64, }) {
const mediaTypeFormat = MediaTypeInput[mediaTypes];

@@ -85,3 +87,3 @@ const input = document.createElement('input');

if (!allowsMultipleSelection) {
const img = await readFile(input.files[0]);
const img = await readFile(input.files[0], { base64 });
resolve({

@@ -93,3 +95,3 @@ cancelled: false,

else {
const imgs = await Promise.all(Array.from(input.files).map(readFile));
const imgs = await Promise.all(Array.from(input.files).map(file => readFile(file, { base64 })));
resolve({

@@ -107,3 +109,3 @@ cancelled: false,

}
function readFile(targetFile) {
function readFile(targetFile, options) {
return new Promise((resolve, reject) => {

@@ -128,2 +130,8 @@ const reader = new FileReader();

height: image.naturalHeight ?? image.height,
// The blob's result cannot be directly decoded as Base64 without
// first removing the Data-URL declaration preceding the
// Base64-encoded data. To retrieve only the Base64 encoded string,
// first remove data:*/*;base64, from the result.
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
...(options.base64 && { base64: uri.substr(uri.indexOf(',') + 1) }),
});

@@ -130,0 +138,0 @@ image.onerror = () => returnRaw();

@@ -1,2 +0,2 @@

import { PermissionStatus, PermissionExpiration } from 'unimodules-permissions-interface';
import { PermissionStatus, PermissionExpiration } from 'expo-modules-core';
import { CameraPermissionResponse, CameraRollPermissionResponse, MediaLibraryPermissionResponse, ImagePickerResult, ImagePickerErrorResult, MediaTypeOptions, ImagePickerOptions, VideoExportPreset, ExpandImagePickerResult } from './ImagePicker.types';

@@ -3,0 +3,0 @@ export declare function getCameraPermissionsAsync(): Promise<CameraPermissionResponse>;

import { UnavailabilityError, CodedError } from '@unimodules/core';
import { PermissionStatus } from 'unimodules-permissions-interface';
import { PermissionStatus } from 'expo-modules-core';
import ExponentImagePicker from './ExponentImagePicker';

@@ -4,0 +4,0 @@ import { MediaTypeOptions, VideoExportPreset, } from './ImagePicker.types';

@@ -1,2 +0,2 @@

import { PermissionResponse } from 'unimodules-permissions-interface';
import { PermissionResponse } from 'expo-modules-core';
export { PermissionResponse as CameraPermissionResponse };

@@ -81,2 +81,3 @@ export declare type MediaLibraryPermissionResponse = PermissionResponse & {

allowsMultipleSelection: boolean;
base64: boolean;
};

@@ -83,0 +84,0 @@ export declare type ExpandImagePickerResult<T extends ImagePickerOptions | OpenFileBrowserOptions> = T extends {

@@ -11,6 +11,16 @@ # Changelog

## 10.1.4 — 2021-04-16
### 💡 Others
_This version does not introduce any user-facing changes._
## 10.2.0 — 2021-06-16
### 🐛 Bug fixes
- Fixed `base64` return on web. ([#12529](https://github.com/expo/expo/pull/12529) by [@simonezuccala](https://github.com/simonezuccala) and [@misterdev](https://github.com/misterdev))
- Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
- Fixed cases where Picker & Camera would be transparent on iOS 14.5. ([#12897](https://github.com/expo/expo/pull/12897) by [@cruzach](https://github.com/cruzach))
### 💡 Others
- Migrated from `unimodules-file-system-interface` and `unimodules-permissions-interface` to `expo-modules-core`. ([#12961](https://github.com/expo/expo/pull/12961) by [@tsapeta](https://github.com/tsapeta))
## 10.1.3 — 2021-04-13

@@ -17,0 +27,0 @@

{
"name": "expo-image-picker",
"version": "10.1.4",
"version": "10.2.0",
"description": "Provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.",

@@ -39,10 +39,9 @@ "main": "build/ImagePicker.js",

"unimodulePeerDependencies": {
"@unimodules/core": "*",
"unimodules-permissions-interface": "*"
"@unimodules/core": "*"
},
"dependencies": {
"@expo/config-plugins": "^1.0.18",
"expo-permissions": "~12.0.1",
"uuid": "7.0.2",
"unimodules-permissions-interface": "~6.1.0"
"@expo/config-plugins": "^2.0.0",
"expo-modules-core": "~0.1.1",
"expo-permissions": "~12.1.0",
"uuid": "7.0.2"
},

@@ -52,3 +51,3 @@ "devDependencies": {

},
"gitHead": "3f978ec39f1cc69d9672c68dd7ae8b13083c91ff"
"gitHead": "c80d4c938920c5111e34c2dbca3a6bf500dff0e1"
}
import { Platform } from '@unimodules/core';
import { PermissionResponse, PermissionStatus } from 'unimodules-permissions-interface';
import { PermissionResponse, PermissionStatus } from 'expo-modules-core';
import { v4 } from 'uuid';

@@ -28,2 +28,3 @@

allowsMultipleSelection = false,
base64 = false,
}): Promise<ImagePickerResult | ImagePickerMultipleResult> {

@@ -37,2 +38,3 @@ // SSR guard

allowsMultipleSelection,
base64,
});

@@ -44,2 +46,3 @@ },

allowsMultipleSelection = false,
base64 = false,
}): Promise<ImagePickerResult | ImagePickerMultipleResult> {

@@ -54,2 +57,3 @@ // SSR guard

capture: true,
base64,
});

@@ -93,2 +97,3 @@ },

allowsMultipleSelection = false,
base64,
}: T): Promise<ExpandImagePickerResult<T>> {

@@ -114,3 +119,3 @@ const mediaTypeFormat = MediaTypeInput[mediaTypes];

if (!allowsMultipleSelection) {
const img: ImageInfo = await readFile(input.files[0]);
const img: ImageInfo = await readFile(input.files[0], { base64 });
resolve({

@@ -121,3 +126,5 @@ cancelled: false,

} else {
const imgs: ImageInfo[] = await Promise.all(Array.from(input.files).map(readFile));
const imgs: ImageInfo[] = await Promise.all(
Array.from(input.files).map(file => readFile(file, { base64 }))
);
resolve({

@@ -137,3 +144,3 @@ cancelled: false,

function readFile(targetFile: Blob): Promise<ImageInfo> {
function readFile(targetFile: Blob, options: { base64: boolean }): Promise<ImageInfo> {
return new Promise((resolve, reject) => {

@@ -161,2 +168,8 @@ const reader = new FileReader();

height: image.naturalHeight ?? image.height,
// The blob's result cannot be directly decoded as Base64 without
// first removing the Data-URL declaration preceding the
// Base64-encoded data. To retrieve only the Base64 encoded string,
// first remove data:*/*;base64, from the result.
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
...(options.base64 && { base64: uri.substr(uri.indexOf(',') + 1) }),
});

@@ -163,0 +176,0 @@ image.onerror = () => returnRaw();

import { UnavailabilityError, CodedError } from '@unimodules/core';
import { PermissionStatus, PermissionExpiration } from 'unimodules-permissions-interface';
import { PermissionStatus, PermissionExpiration } from 'expo-modules-core';

@@ -4,0 +4,0 @@ import ExponentImagePicker from './ExponentImagePicker';

@@ -1,2 +0,2 @@

import { PermissionResponse } from 'unimodules-permissions-interface';
import { PermissionResponse } from 'expo-modules-core';

@@ -85,2 +85,3 @@ export { PermissionResponse as CameraPermissionResponse };

allowsMultipleSelection: boolean;
base64: boolean;
};

@@ -87,0 +88,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc