expo-image-picker 56.0.6 → 56.0.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 +10 -0
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +1 -1
- package/build/ExponentImagePicker.web.d.ts +1 -1
- package/build/ExponentImagePicker.web.d.ts.map +1 -1
- package/build/ExponentImagePicker.web.js +2 -1
- package/build/ExponentImagePicker.web.js.map +1 -1
- package/build/ImagePicker.d.ts +1 -2
- package/build/ImagePicker.d.ts.map +1 -1
- package/build/ImagePicker.js +2 -1
- package/build/ImagePicker.js.map +1 -1
- package/build/ImagePicker.types.d.ts +1 -1
- package/build/ImagePicker.types.d.ts.map +1 -1
- package/build/ImagePicker.types.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/{56.0.6/expo.modules.imagepicker-56.0.6.aar → 56.0.7/expo.modules.imagepicker-56.0.7.aar} +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/{56.0.6/expo.modules.imagepicker-56.0.6.module → 56.0.7/expo.modules.imagepicker-56.0.7.module} +17 -17
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/{56.0.6/expo.modules.imagepicker-56.0.6.pom → 56.0.7/expo.modules.imagepicker-56.0.7.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.7/expo.modules.imagepicker-56.0.7.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/maven-metadata.xml.sha512 +1 -1
- package/package.json +3 -3
- package/src/ExponentImagePicker.web.ts +2 -2
- package/src/ImagePicker.ts +6 -9
- package/src/ImagePicker.types.ts +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/56.0.6/expo.modules.imagepicker-56.0.6.pom.sha512 +0 -1
- /package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/{56.0.6/expo.modules.imagepicker-56.0.6-sources.jar → 56.0.7/expo.modules.imagepicker-56.0.7-sources.jar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/{56.0.6/expo.modules.imagepicker-56.0.6-sources.jar.md5 → 56.0.7/expo.modules.imagepicker-56.0.7-sources.jar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/{56.0.6/expo.modules.imagepicker-56.0.6-sources.jar.sha1 → 56.0.7/expo.modules.imagepicker-56.0.7-sources.jar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/{56.0.6/expo.modules.imagepicker-56.0.6-sources.jar.sha256 → 56.0.7/expo.modules.imagepicker-56.0.7-sources.jar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/{56.0.6/expo.modules.imagepicker-56.0.6-sources.jar.sha512 → 56.0.7/expo.modules.imagepicker-56.0.7-sources.jar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 56.0.7 — 2026-05-13
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [Android] Follow system day/night theme in crop activity. ([#44944](https://github.com/expo/expo/pull/44944) by [@jeferson-sb](https://github.com/jeferson-sb))
|
|
18
|
+
|
|
19
|
+
### 💡 Others
|
|
20
|
+
|
|
21
|
+
- Updated permission hooks and permission type imports to be imported from `expo` instead of `expo-modules-core` ([#45565](https://github.com/expo/expo/pull/45565) by [@Wenszel](https://github.com/Wenszel))
|
|
22
|
+
|
|
13
23
|
## 56.0.6 — 2026-05-11
|
|
14
24
|
|
|
15
25
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -4,13 +4,13 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '56.0.
|
|
7
|
+
version = '56.0.7'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.imagepicker"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
versionCode 22
|
|
13
|
-
versionName "56.0.
|
|
13
|
+
versionName "56.0.7"
|
|
14
14
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
15
15
|
}
|
|
16
16
|
testOptions {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
tools:replace="android:exported" />
|
|
30
30
|
<activity
|
|
31
31
|
android:name="expo.modules.imagepicker.ExpoCropImageActivity"
|
|
32
|
-
android:theme="@style/
|
|
32
|
+
android:theme="@style/Theme.AppCompat.DayNight"
|
|
33
33
|
android:exported="false"
|
|
34
34
|
tools:replace="android:exported" />
|
|
35
35
|
<!-- https://developer.android.com/guide/topics/manifest/provider-element.html -->
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PermissionResponse } from 'expo';
|
|
2
2
|
import type { ImagePickerOptions, ImagePickerResult } from './ImagePicker.types';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
launchImageLibraryAsync({ mediaTypes, allowsMultipleSelection, base64, }: ImagePickerOptions): Promise<ImagePickerResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExponentImagePicker.web.d.ts","sourceRoot":"","sources":["../src/ExponentImagePicker.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ExponentImagePicker.web.d.ts","sourceRoot":"","sources":["../src/ExponentImagePicker.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,MAAM,CAAC;AAGjE,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAGlB,MAAM,qBAAqB,CAAC;;8EAexB,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;oFAiB/C,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;;;gDA2BA,OAAO;oDAGH,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;;AApD7F,wBAuDE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PermissionStatus
|
|
1
|
+
import { PermissionStatus } from 'expo';
|
|
2
|
+
import { Platform } from 'expo-modules-core';
|
|
2
3
|
import { CameraType } from './ImagePicker.types';
|
|
3
4
|
import { parseMediaTypes } from './utils';
|
|
4
5
|
const MediaTypeInput = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExponentImagePicker.web.js","sourceRoot":"","sources":["../src/ExponentImagePicker.web.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H,CAAC;AAED;;;GAGG;AACH,SAAS,qBAAqB,CAAC,UAAuB;IACpD,MAAM,kBAAkB,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC;IACxF,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,SAAS,IAAI,kBAAkB,EAAE,CAAC;QAC3C,mCAAmC;QACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YAChD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PermissionResponse } from 'expo-modules-core';\nimport { PermissionStatus, Platform } from 'expo-modules-core';\n\nimport type {\n ImagePickerAsset,\n ImagePickerOptions,\n ImagePickerResult,\n MediaType,\n OpenFileBrowserOptions,\n} from './ImagePicker.types';\nimport { CameraType } from './ImagePicker.types';\nimport { parseMediaTypes } from './utils';\n\nconst MediaTypeInput: Record<MediaType, string> = {\n images: 'image/*',\n videos: 'video/mp4,video/quicktime,video/x-m4v,video/*',\n livePhotos: '',\n};\n\nexport default {\n async launchImageLibraryAsync({\n mediaTypes = ['images'] as MediaType[],\n allowsMultipleSelection = false,\n base64 = false,\n }: ImagePickerOptions): Promise<ImagePickerResult> {\n // SSR guard\n if (!Platform.isDOMAvailable) {\n return { canceled: true, assets: null };\n }\n return await openFileBrowserAsync({\n mediaTypes,\n allowsMultipleSelection,\n base64,\n });\n },\n\n async launchCameraAsync({\n mediaTypes = ['images'] as MediaType[],\n allowsMultipleSelection = false,\n base64 = false,\n cameraType,\n }: ImagePickerOptions): Promise<ImagePickerResult> {\n // SSR guard\n if (!Platform.isDOMAvailable) {\n return { canceled: true, assets: null };\n }\n return await openFileBrowserAsync({\n mediaTypes,\n allowsMultipleSelection,\n capture: cameraType ?? true,\n base64,\n });\n },\n\n /*\n * Delegate to expo-permissions to request camera permissions\n */\n async getCameraPermissionsAsync() {\n return permissionGrantedResponse();\n },\n async requestCameraPermissionsAsync() {\n return permissionGrantedResponse();\n },\n\n /*\n * Camera roll permissions don't need to be requested on web, so we always\n * respond with granted.\n */\n async getMediaLibraryPermissionsAsync(_writeOnly: boolean) {\n return permissionGrantedResponse();\n },\n async requestMediaLibraryPermissionsAsync(_writeOnly: boolean): Promise<PermissionResponse> {\n return permissionGrantedResponse();\n },\n};\n\nfunction permissionGrantedResponse(): PermissionResponse {\n return {\n status: PermissionStatus.GRANTED,\n expires: 'never',\n granted: true,\n canAskAgain: true,\n };\n}\n\n/**\n * Opens a file browser dialog or camera on supported platforms and returns the selected files.\n * Handles both single and multiple file selection.\n */\nfunction openFileBrowserAsync({\n mediaTypes,\n capture = false,\n allowsMultipleSelection = false,\n base64,\n}: OpenFileBrowserOptions): Promise<ImagePickerResult> {\n const parsedMediaTypes = parseMediaTypes(mediaTypes);\n const mediaTypeFormat = createMediaTypeFormat(parsedMediaTypes);\n\n const input = document.createElement('input');\n input.style.display = 'none';\n input.setAttribute('type', 'file');\n input.setAttribute('accept', mediaTypeFormat);\n input.setAttribute('id', String(Math.random()));\n input.setAttribute('data-testid', 'file-input');\n if (allowsMultipleSelection) {\n input.setAttribute('multiple', 'multiple');\n }\n if (capture) {\n switch (capture) {\n case true:\n input.setAttribute('capture', 'camera');\n break;\n case CameraType.front:\n input.setAttribute('capture', 'user');\n break;\n case CameraType.back:\n input.setAttribute('capture', 'environment');\n }\n }\n document.body.appendChild(input);\n\n return new Promise((resolve) => {\n input.addEventListener('change', async () => {\n if (input.files?.length) {\n const files = allowsMultipleSelection ? input.files : [input.files[0]];\n\n try {\n const assets: ImagePickerAsset[] = await Promise.all(\n Array.from(files)\n .filter((file) => file != null)\n .map((file) => readFile(file, { base64 }))\n );\n resolve({ canceled: false, assets });\n } catch (error) {\n resolve(Promise.reject(error));\n }\n } else {\n resolve({ canceled: true, assets: null });\n }\n document.body.removeChild(input);\n });\n input.addEventListener('cancel', () => {\n input.dispatchEvent(new Event('change'));\n });\n\n const event = new MouseEvent('click');\n input.dispatchEvent(event);\n });\n}\n\n/**\n * Gets metadata for an image file using a blob URL\n * TODO (Hirbod): add exif support for feature parity with native\n */\nasync function getImageMetadata(blobUrl: string): Promise<{ width: number; height: number }> {\n return new Promise((resolve) => {\n const image = new Image();\n image.onload = () => {\n resolve({\n width: image.naturalWidth ?? image.width,\n height: image.naturalHeight ?? image.height,\n });\n };\n image.onerror = () => resolve({ width: 0, height: 0 });\n image.src = blobUrl;\n });\n}\n\n/**\n * Gets metadata for a video file using a blob URL\n */\nasync function getVideoMetadata(\n blobUrl: string\n): Promise<{ width: number; height: number; duration: number }> {\n return new Promise((resolve) => {\n const video = document.createElement('video');\n video.preload = 'metadata';\n video.onloadedmetadata = () => {\n resolve({\n width: video.videoWidth,\n height: video.videoHeight,\n duration: video.duration,\n });\n };\n video.onerror = () => resolve({ width: 0, height: 0, duration: 0 });\n video.src = blobUrl;\n });\n}\n\n/**\n * Reads a file as base64\n */\nasync function readFileAsBase64(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = () => {\n reject(new Error('Failed to read the selected media because the operation failed.'));\n };\n reader.onload = (event: ProgressEvent<FileReader>) => {\n const result = event.target?.result;\n if (typeof result !== 'string') {\n reject(new Error('Failed to read file as base64'));\n return;\n }\n // Remove the data URL prefix to get just the base64 data\n resolve(result.split(',')?.[1] ?? '');\n };\n reader.readAsDataURL(file);\n });\n}\n\n/**\n * Reads a file and returns its data as an ImagePickerAsset.\n * Handles both base64 and blob URL modes, and extracts metadata for images and videos.\n */\nasync function readFile(targetFile: File, options: { base64: boolean }): Promise<ImagePickerAsset> {\n const mimeType = targetFile.type;\n const baseUri = URL.createObjectURL(targetFile);\n\n try {\n let metadata: { width: number; height: number; duration?: number };\n let base64: string | undefined;\n\n if (mimeType.startsWith('image/')) {\n metadata = await getImageMetadata(baseUri);\n } else if (mimeType.startsWith('video/')) {\n metadata = await getVideoMetadata(baseUri);\n } else {\n throw new Error(`Unsupported file type: ${mimeType}. Only images and videos are supported.`);\n }\n\n if (options.base64) {\n base64 = await readFileAsBase64(targetFile);\n }\n\n return {\n uri: baseUri,\n width: metadata.width,\n height: metadata.height,\n type: mimeType.startsWith('image/') ? 'image' : 'video',\n mimeType,\n fileName: targetFile.name,\n fileSize: targetFile.size,\n file: targetFile,\n ...(metadata.duration !== undefined && { duration: metadata.duration }),\n ...(base64 && { base64 }),\n };\n } catch (error) {\n throw error;\n }\n}\n\n/**\n * Creates the accept attribute value for the file input based on the requested media types.\n * Filters out livePhotos as they're not supported on web.\n */\nfunction createMediaTypeFormat(mediaTypes: MediaType[]): string {\n const filteredMediaTypes = mediaTypes.filter((mediaType) => mediaType !== 'livePhotos');\n if (filteredMediaTypes.length === 0) {\n return 'image/*';\n }\n let result = '';\n for (const mediaType of filteredMediaTypes) {\n // Make sure the types don't repeat\n if (!result.includes(MediaTypeInput[mediaType])) {\n result = result.concat(',', MediaTypeInput[mediaType]);\n }\n }\n return result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ExponentImagePicker.web.js","sourceRoot":"","sources":["../src/ExponentImagePicker.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAS7C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,cAAc,GAA8B;IAChD,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,+CAA+C;IACvD,UAAU,EAAE,EAAE;CACf,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AC;IAChB,KAAK,MAAM,SAAS,IAAI,kBAAkB,EAAE,CAAC;QAC3C,mCAAmC;QACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YAChD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { type PermissionResponse, PermissionStatus } from 'expo';\nimport { Platform } from 'expo-modules-core';\n\nimport type {\n ImagePickerAsset,\n ImagePickerOptions,\n ImagePickerResult,\n MediaType,\n OpenFileBrowserOptions,\n} from './ImagePicker.types';\nimport { CameraType } from './ImagePicker.types';\nimport { parseMediaTypes } from './utils';\n\nconst MediaTypeInput: Record<MediaType, string> = {\n images: 'image/*',\n videos: 'video/mp4,video/quicktime,video/x-m4v,video/*',\n livePhotos: '',\n};\n\nexport default {\n async launchImageLibraryAsync({\n mediaTypes = ['images'] as MediaType[],\n allowsMultipleSelection = false,\n base64 = false,\n }: ImagePickerOptions): Promise<ImagePickerResult> {\n // SSR guard\n if (!Platform.isDOMAvailable) {\n return { canceled: true, assets: null };\n }\n return await openFileBrowserAsync({\n mediaTypes,\n allowsMultipleSelection,\n base64,\n });\n },\n\n async launchCameraAsync({\n mediaTypes = ['images'] as MediaType[],\n allowsMultipleSelection = false,\n base64 = false,\n cameraType,\n }: ImagePickerOptions): Promise<ImagePickerResult> {\n // SSR guard\n if (!Platform.isDOMAvailable) {\n return { canceled: true, assets: null };\n }\n return await openFileBrowserAsync({\n mediaTypes,\n allowsMultipleSelection,\n capture: cameraType ?? true,\n base64,\n });\n },\n\n /*\n * Delegate to expo-permissions to request camera permissions\n */\n async getCameraPermissionsAsync() {\n return permissionGrantedResponse();\n },\n async requestCameraPermissionsAsync() {\n return permissionGrantedResponse();\n },\n\n /*\n * Camera roll permissions don't need to be requested on web, so we always\n * respond with granted.\n */\n async getMediaLibraryPermissionsAsync(_writeOnly: boolean) {\n return permissionGrantedResponse();\n },\n async requestMediaLibraryPermissionsAsync(_writeOnly: boolean): Promise<PermissionResponse> {\n return permissionGrantedResponse();\n },\n};\n\nfunction permissionGrantedResponse(): PermissionResponse {\n return {\n status: PermissionStatus.GRANTED,\n expires: 'never',\n granted: true,\n canAskAgain: true,\n };\n}\n\n/**\n * Opens a file browser dialog or camera on supported platforms and returns the selected files.\n * Handles both single and multiple file selection.\n */\nfunction openFileBrowserAsync({\n mediaTypes,\n capture = false,\n allowsMultipleSelection = false,\n base64,\n}: OpenFileBrowserOptions): Promise<ImagePickerResult> {\n const parsedMediaTypes = parseMediaTypes(mediaTypes);\n const mediaTypeFormat = createMediaTypeFormat(parsedMediaTypes);\n\n const input = document.createElement('input');\n input.style.display = 'none';\n input.setAttribute('type', 'file');\n input.setAttribute('accept', mediaTypeFormat);\n input.setAttribute('id', String(Math.random()));\n input.setAttribute('data-testid', 'file-input');\n if (allowsMultipleSelection) {\n input.setAttribute('multiple', 'multiple');\n }\n if (capture) {\n switch (capture) {\n case true:\n input.setAttribute('capture', 'camera');\n break;\n case CameraType.front:\n input.setAttribute('capture', 'user');\n break;\n case CameraType.back:\n input.setAttribute('capture', 'environment');\n }\n }\n document.body.appendChild(input);\n\n return new Promise((resolve) => {\n input.addEventListener('change', async () => {\n if (input.files?.length) {\n const files = allowsMultipleSelection ? input.files : [input.files[0]];\n\n try {\n const assets: ImagePickerAsset[] = await Promise.all(\n Array.from(files)\n .filter((file) => file != null)\n .map((file) => readFile(file, { base64 }))\n );\n resolve({ canceled: false, assets });\n } catch (error) {\n resolve(Promise.reject(error));\n }\n } else {\n resolve({ canceled: true, assets: null });\n }\n document.body.removeChild(input);\n });\n input.addEventListener('cancel', () => {\n input.dispatchEvent(new Event('change'));\n });\n\n const event = new MouseEvent('click');\n input.dispatchEvent(event);\n });\n}\n\n/**\n * Gets metadata for an image file using a blob URL\n * TODO (Hirbod): add exif support for feature parity with native\n */\nasync function getImageMetadata(blobUrl: string): Promise<{ width: number; height: number }> {\n return new Promise((resolve) => {\n const image = new Image();\n image.onload = () => {\n resolve({\n width: image.naturalWidth ?? image.width,\n height: image.naturalHeight ?? image.height,\n });\n };\n image.onerror = () => resolve({ width: 0, height: 0 });\n image.src = blobUrl;\n });\n}\n\n/**\n * Gets metadata for a video file using a blob URL\n */\nasync function getVideoMetadata(\n blobUrl: string\n): Promise<{ width: number; height: number; duration: number }> {\n return new Promise((resolve) => {\n const video = document.createElement('video');\n video.preload = 'metadata';\n video.onloadedmetadata = () => {\n resolve({\n width: video.videoWidth,\n height: video.videoHeight,\n duration: video.duration,\n });\n };\n video.onerror = () => resolve({ width: 0, height: 0, duration: 0 });\n video.src = blobUrl;\n });\n}\n\n/**\n * Reads a file as base64\n */\nasync function readFileAsBase64(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = () => {\n reject(new Error('Failed to read the selected media because the operation failed.'));\n };\n reader.onload = (event: ProgressEvent<FileReader>) => {\n const result = event.target?.result;\n if (typeof result !== 'string') {\n reject(new Error('Failed to read file as base64'));\n return;\n }\n // Remove the data URL prefix to get just the base64 data\n resolve(result.split(',')?.[1] ?? '');\n };\n reader.readAsDataURL(file);\n });\n}\n\n/**\n * Reads a file and returns its data as an ImagePickerAsset.\n * Handles both base64 and blob URL modes, and extracts metadata for images and videos.\n */\nasync function readFile(targetFile: File, options: { base64: boolean }): Promise<ImagePickerAsset> {\n const mimeType = targetFile.type;\n const baseUri = URL.createObjectURL(targetFile);\n\n try {\n let metadata: { width: number; height: number; duration?: number };\n let base64: string | undefined;\n\n if (mimeType.startsWith('image/')) {\n metadata = await getImageMetadata(baseUri);\n } else if (mimeType.startsWith('video/')) {\n metadata = await getVideoMetadata(baseUri);\n } else {\n throw new Error(`Unsupported file type: ${mimeType}. Only images and videos are supported.`);\n }\n\n if (options.base64) {\n base64 = await readFileAsBase64(targetFile);\n }\n\n return {\n uri: baseUri,\n width: metadata.width,\n height: metadata.height,\n type: mimeType.startsWith('image/') ? 'image' : 'video',\n mimeType,\n fileName: targetFile.name,\n fileSize: targetFile.size,\n file: targetFile,\n ...(metadata.duration !== undefined && { duration: metadata.duration }),\n ...(base64 && { base64 }),\n };\n } catch (error) {\n throw error;\n }\n}\n\n/**\n * Creates the accept attribute value for the file input based on the requested media types.\n * Filters out livePhotos as they're not supported on web.\n */\nfunction createMediaTypeFormat(mediaTypes: MediaType[]): string {\n const filteredMediaTypes = mediaTypes.filter((mediaType) => mediaType !== 'livePhotos');\n if (filteredMediaTypes.length === 0) {\n return 'image/*';\n }\n let result = '';\n for (const mediaType of filteredMediaTypes) {\n // Make sure the types don't repeat\n if (!result.includes(MediaTypeInput[mediaType])) {\n result = result.concat(',', MediaTypeInput[mediaType]);\n }\n }\n return result;\n}\n"]}
|
package/build/ImagePicker.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { PermissionStatus } from 'expo-modules-core';
|
|
1
|
+
import { PermissionStatus, type PermissionExpiration, type PermissionHookOptions, type PermissionResponse } from 'expo';
|
|
3
2
|
import type { CameraPermissionResponse, ImagePickerErrorResult, ImagePickerOptions, ImagePickerResult, MediaLibraryPermissionResponse } from './ImagePicker.types';
|
|
4
3
|
/**
|
|
5
4
|
* Checks user's permissions for accessing camera.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePicker.d.ts","sourceRoot":"","sources":["../src/ImagePicker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ImagePicker.d.ts","sourceRoot":"","sources":["../src/ImagePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,MAAM,CAAC;AAId,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;AAmC7B;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAEnF;AAGD;;;;GAIG;AACH,wBAAsB,+BAA+B,CACnD,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC,8BAA8B,CAAC,CAEzC;AAGD;;;;GAIG;AACH,wBAAsB,6BAA6B,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAEvF;AAGD;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC,8BAA8B,CAAC,CAGzC;AAGD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B;gBAEvB,OAAO;wJAKrB,CAAC;AAGH;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,4JAG/B,CAAC;AAGH;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CACpD,iBAAiB,GAAG,sBAAsB,GAAG,IAAI,CAClD,CAKA;AAGD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAM5B;AAGD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAc5B;AAED,cAAc,qBAAqB,CAAC;AAEpC,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/build/ImagePicker.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PermissionStatus, createPermissionHook, } from 'expo';
|
|
2
|
+
import { CodedError, UnavailabilityError } from 'expo-modules-core';
|
|
2
3
|
import ExponentImagePicker from './ExponentImagePicker';
|
|
3
4
|
import { mapDeprecatedOptions } from './utils';
|
|
4
5
|
function validateOptions(options) {
|
package/build/ImagePicker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePicker.js","sourceRoot":"","sources":["../src/ImagePicker.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAQxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,SAAS,eAAe,CAAC,OAA2B;IAClD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAEtD,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC;QAEtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,+BAA+B,CAAC,IAAI,CAAC,6BAA6B,CACnE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,2BAA2B,OAAO,oCAAoC,CACvE,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,IAAI,gBAAgB,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,oCAAoC,gBAAgB,kCAAkC,CACvF,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,cAAc;AACd;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,OAAO,mBAAmB,CAAC,yBA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,CACrC,UAA8B,EAAE;IAEhC,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,CAAC;QAC3C,MAAM,IAAI,mBAAmB,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,aAAa,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACpD,OAAO,MAAM,mBAAmB,CAAC,iBAAiB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,UAA8B,EAAE;IAEhC,MAAM,aAAa,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,CAAC;QACjD,MAAM,IAAI,mBAAmB,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,aAAa,EAAE,aAAa,IAAI,aAAa,CAAC,uBAAuB,EAAE,CAAC;QAC1E,OAAO,CAAC,IAAI,CACV,qHAAqH;YACnH,2FAA2F;YAC3F,sBAAsB,CACzB,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,mBAAmB,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC;AAC1E,CAAC;AAED,cAAc,qBAAqB,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import type {\n PermissionExpiration,\n PermissionHookOptions,\n PermissionResponse,\n} from 'expo-modules-core';\nimport {\n CodedError,\n createPermissionHook,\n PermissionStatus,\n UnavailabilityError,\n} from 'expo-modules-core';\n\nimport ExponentImagePicker from './ExponentImagePicker';\nimport type {\n CameraPermissionResponse,\n ImagePickerErrorResult,\n ImagePickerOptions,\n ImagePickerResult,\n MediaLibraryPermissionResponse,\n} from './ImagePicker.types';\nimport { mapDeprecatedOptions } from './utils';\n\nfunction validateOptions(options: ImagePickerOptions) {\n const { aspect, quality, videoMaxDuration } = options;\n\n if (aspect != null) {\n const [x, y] = aspect;\n\n if (x <= 0 || y <= 0) {\n throw new CodedError(\n 'ERR_INVALID_ARGUMENT',\n `Invalid aspect ratio values ${x}:${y}. Provide positive numbers.`\n );\n }\n }\n\n if (quality && (quality < 0 || quality > 1)) {\n throw new CodedError(\n 'ERR_INVALID_ARGUMENT',\n `Invalid 'quality' value ${quality}. Provide a value between 0 and 1.`\n );\n }\n\n if (videoMaxDuration && videoMaxDuration < 0) {\n throw new CodedError(\n 'ERR_INVALID_ARGUMENT',\n `Invalid 'videoMaxDuration' value ${videoMaxDuration}. Provide a non-negative number.`\n );\n }\n\n return options;\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing camera.\n * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerapermissionresponse).\n */\nexport async function getCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.getCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing photos.\n * @param writeOnly Whether to request write or read and write permissions. Defaults to `false`\n * @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).\n */\nexport async function getMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n return ExponentImagePicker.getMediaLibraryPermissionsAsync(writeOnly);\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing camera. This does nothing on web because the\n * browser camera is not used.\n * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerarollpermissionresponse).\n */\nexport async function requestCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.requestCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing user's photo. This method does nothing on web.\n * @param writeOnly Whether to request write or read and write permissions. Defaults to `false`\n * @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).\n */\nexport async function requestMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n const imagePickerMethod = ExponentImagePicker.requestMediaLibraryPermissionsAsync;\n return imagePickerMethod(writeOnly);\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the media library.\n * This uses both `requestMediaLibraryPermissionsAsync` and `getMediaLibraryPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = ImagePicker.useMediaLibraryPermissions();\n * ```\n */\nexport const useMediaLibraryPermissions = createPermissionHook<\n MediaLibraryPermissionResponse,\n { writeOnly?: boolean }\n>({\n // TODO(cedric): permission requesters should have an options param or a different requester\n getMethod: (options) => getMediaLibraryPermissionsAsync(options?.writeOnly),\n requestMethod: (options) => requestMediaLibraryPermissionsAsync(options?.writeOnly),\n});\n\n// @needsAudit\n/**\n * Check or request permissions to access the camera.\n * This uses both `requestCameraPermissionsAsync` and `getCameraPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = ImagePicker.useCameraPermissions();\n * ```\n */\nexport const useCameraPermissions = createPermissionHook({\n getMethod: getCameraPermissionsAsync,\n requestMethod: requestCameraPermissionsAsync,\n});\n\n// @needsAudit\n/**\n * Android system sometimes kills the `MainActivity` after the `ImagePicker` finishes. When this\n * happens, we lose the data selected using the `ImagePicker`. However, you can retrieve the lost\n * data by calling `getPendingResultAsync`. You can test this functionality by turning on\n * `Don't keep activities` in the developer options.\n * @return\n * - **On Android:** a promise that resolves to an object of exactly same type as in\n * `ImagePicker.launchImageLibraryAsync` or `ImagePicker.launchCameraAsync` if the `ImagePicker`\n * finished successfully. Otherwise, an object of type [`ImagePickerErrorResult`](#imagepickerimagepickererrorresult).\n * - **On other platforms:** `null`\n */\nexport async function getPendingResultAsync(): Promise<\n ImagePickerResult | ImagePickerErrorResult | null\n> {\n if (ExponentImagePicker.getPendingResultAsync) {\n return ExponentImagePicker.getPendingResultAsync();\n }\n return null;\n}\n\n// @needsAudit\n/**\n * Display the system UI for taking a photo with the camera. Requires `Permissions.CAMERA`.\n * On Android and iOS 10 `Permissions.CAMERA_ROLL` is also required. On mobile web, this must be\n * called immediately in a user interaction like a button press, otherwise the browser will block\n * the request without a warning.\n * > **Note:** Make sure that you handle `MainActivity` destruction on **Android**. See [ImagePicker.getPendingResultAsync](#imagepickergetpendingresultasync).\n * > **Notes for Web:** The system UI can only be shown after user activation (e.g. a `Button` press).\n * Therefore, calling `launchCameraAsync` in `componentDidMount`, for example, will **not** work as\n * intended. The `cancelled` event will not be returned in the browser due to platform restrictions\n * and inconsistencies across browsers.\n * @param options An `ImagePickerOptions` object.\n * @return A promise that resolves to an object with `canceled` and `assets` fields.\n * When the user canceled the action the `assets` is always `null`, otherwise it's an array of\n * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).\n */\nexport async function launchCameraAsync(\n options: ImagePickerOptions = {}\n): Promise<ImagePickerResult> {\n if (!ExponentImagePicker.launchCameraAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchCameraAsync');\n }\n const mappedOptions = mapDeprecatedOptions(options);\n return await ExponentImagePicker.launchCameraAsync(validateOptions(mappedOptions));\n}\n\n// @needsAudit\n/**\n * Display the system UI for choosing an image or a video from the phone's library.\n * Requires `Permissions.MEDIA_LIBRARY` on iOS 10 only. On mobile web, this must be called\n * immediately in a user interaction like a button press, otherwise the browser will block the\n * request without a warning.\n *\n * **Animated GIFs support:** On Android, if the selected image is an animated GIF, the result image will be an\n * animated GIF too if and only if `quality` is explicitly set to `1.0` and `allowsEditing` is set to `false`.\n * Otherwise compression and/or cropper will pick the first frame of the GIF and return it as the\n * result (on Android the result will be a PNG). On iOS, both quality and cropping are supported.\n *\n * > **Notes for Web:** The system UI can only be shown after user activation (e.g. a `Button` press).\n * Therefore, calling `launchImageLibraryAsync` in `componentDidMount`, for example, will **not**\n * work as intended. The `cancelled` event will not be returned in the browser due to platform\n * restrictions and inconsistencies across browsers.\n * @param options An object extended by [`ImagePickerOptions`](#imagepickeroptions).\n * @return A promise that resolves to an object with `canceled` and `assets` fields.\n * When the user canceled the action the `assets` is always `null`, otherwise it's an array of\n * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).\n */\nexport async function launchImageLibraryAsync(\n options: ImagePickerOptions = {}\n): Promise<ImagePickerResult> {\n const mappedOptions = mapDeprecatedOptions(options);\n\n if (!ExponentImagePicker.launchImageLibraryAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchImageLibraryAsync');\n }\n if (mappedOptions?.allowsEditing && mappedOptions.allowsMultipleSelection) {\n console.warn(\n '[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.' +\n \"Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' \" +\n 'to fix this warning.'\n );\n }\n return await ExponentImagePicker.launchImageLibraryAsync(mappedOptions);\n}\n\nexport * from './ImagePicker.types';\n\nexport type { PermissionExpiration, PermissionHookOptions, PermissionResponse };\nexport { PermissionStatus };\n"]}
|
|
1
|
+
{"version":3,"file":"ImagePicker.js","sourceRoot":"","sources":["../src/ImagePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GAIrB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAQxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,SAAS,eAAe,CAAC,OAA2B;IAClD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAEtD,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC;QAEtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,UAAU,CAClB,sBA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ACV,qHAAqH;YACnH,2FAA2F;YAC3F,sBAAsB,CACzB,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,mBAAmB,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC;AAC1E,CAAC;AAED,cAAc,qBAAqB,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import {\n PermissionStatus,\n createPermissionHook,\n type PermissionExpiration,\n type PermissionHookOptions,\n type PermissionResponse,\n} from 'expo';\nimport { CodedError, UnavailabilityError } from 'expo-modules-core';\n\nimport ExponentImagePicker from './ExponentImagePicker';\nimport type {\n CameraPermissionResponse,\n ImagePickerErrorResult,\n ImagePickerOptions,\n ImagePickerResult,\n MediaLibraryPermissionResponse,\n} from './ImagePicker.types';\nimport { mapDeprecatedOptions } from './utils';\n\nfunction validateOptions(options: ImagePickerOptions) {\n const { aspect, quality, videoMaxDuration } = options;\n\n if (aspect != null) {\n const [x, y] = aspect;\n\n if (x <= 0 || y <= 0) {\n throw new CodedError(\n 'ERR_INVALID_ARGUMENT',\n `Invalid aspect ratio values ${x}:${y}. Provide positive numbers.`\n );\n }\n }\n\n if (quality && (quality < 0 || quality > 1)) {\n throw new CodedError(\n 'ERR_INVALID_ARGUMENT',\n `Invalid 'quality' value ${quality}. Provide a value between 0 and 1.`\n );\n }\n\n if (videoMaxDuration && videoMaxDuration < 0) {\n throw new CodedError(\n 'ERR_INVALID_ARGUMENT',\n `Invalid 'videoMaxDuration' value ${videoMaxDuration}. Provide a non-negative number.`\n );\n }\n\n return options;\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing camera.\n * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerapermissionresponse).\n */\nexport async function getCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.getCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing photos.\n * @param writeOnly Whether to request write or read and write permissions. Defaults to `false`\n * @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).\n */\nexport async function getMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n return ExponentImagePicker.getMediaLibraryPermissionsAsync(writeOnly);\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing camera. This does nothing on web because the\n * browser camera is not used.\n * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerarollpermissionresponse).\n */\nexport async function requestCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.requestCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing user's photo. This method does nothing on web.\n * @param writeOnly Whether to request write or read and write permissions. Defaults to `false`\n * @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).\n */\nexport async function requestMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n const imagePickerMethod = ExponentImagePicker.requestMediaLibraryPermissionsAsync;\n return imagePickerMethod(writeOnly);\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the media library.\n * This uses both `requestMediaLibraryPermissionsAsync` and `getMediaLibraryPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = ImagePicker.useMediaLibraryPermissions();\n * ```\n */\nexport const useMediaLibraryPermissions = createPermissionHook<\n MediaLibraryPermissionResponse,\n { writeOnly?: boolean }\n>({\n // TODO(cedric): permission requesters should have an options param or a different requester\n getMethod: (options) => getMediaLibraryPermissionsAsync(options?.writeOnly),\n requestMethod: (options) => requestMediaLibraryPermissionsAsync(options?.writeOnly),\n});\n\n// @needsAudit\n/**\n * Check or request permissions to access the camera.\n * This uses both `requestCameraPermissionsAsync` and `getCameraPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = ImagePicker.useCameraPermissions();\n * ```\n */\nexport const useCameraPermissions = createPermissionHook({\n getMethod: getCameraPermissionsAsync,\n requestMethod: requestCameraPermissionsAsync,\n});\n\n// @needsAudit\n/**\n * Android system sometimes kills the `MainActivity` after the `ImagePicker` finishes. When this\n * happens, we lose the data selected using the `ImagePicker`. However, you can retrieve the lost\n * data by calling `getPendingResultAsync`. You can test this functionality by turning on\n * `Don't keep activities` in the developer options.\n * @return\n * - **On Android:** a promise that resolves to an object of exactly same type as in\n * `ImagePicker.launchImageLibraryAsync` or `ImagePicker.launchCameraAsync` if the `ImagePicker`\n * finished successfully. Otherwise, an object of type [`ImagePickerErrorResult`](#imagepickerimagepickererrorresult).\n * - **On other platforms:** `null`\n */\nexport async function getPendingResultAsync(): Promise<\n ImagePickerResult | ImagePickerErrorResult | null\n> {\n if (ExponentImagePicker.getPendingResultAsync) {\n return ExponentImagePicker.getPendingResultAsync();\n }\n return null;\n}\n\n// @needsAudit\n/**\n * Display the system UI for taking a photo with the camera. Requires `Permissions.CAMERA`.\n * On Android and iOS 10 `Permissions.CAMERA_ROLL` is also required. On mobile web, this must be\n * called immediately in a user interaction like a button press, otherwise the browser will block\n * the request without a warning.\n * > **Note:** Make sure that you handle `MainActivity` destruction on **Android**. See [ImagePicker.getPendingResultAsync](#imagepickergetpendingresultasync).\n * > **Notes for Web:** The system UI can only be shown after user activation (e.g. a `Button` press).\n * Therefore, calling `launchCameraAsync` in `componentDidMount`, for example, will **not** work as\n * intended. The `cancelled` event will not be returned in the browser due to platform restrictions\n * and inconsistencies across browsers.\n * @param options An `ImagePickerOptions` object.\n * @return A promise that resolves to an object with `canceled` and `assets` fields.\n * When the user canceled the action the `assets` is always `null`, otherwise it's an array of\n * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).\n */\nexport async function launchCameraAsync(\n options: ImagePickerOptions = {}\n): Promise<ImagePickerResult> {\n if (!ExponentImagePicker.launchCameraAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchCameraAsync');\n }\n const mappedOptions = mapDeprecatedOptions(options);\n return await ExponentImagePicker.launchCameraAsync(validateOptions(mappedOptions));\n}\n\n// @needsAudit\n/**\n * Display the system UI for choosing an image or a video from the phone's library.\n * Requires `Permissions.MEDIA_LIBRARY` on iOS 10 only. On mobile web, this must be called\n * immediately in a user interaction like a button press, otherwise the browser will block the\n * request without a warning.\n *\n * **Animated GIFs support:** On Android, if the selected image is an animated GIF, the result image will be an\n * animated GIF too if and only if `quality` is explicitly set to `1.0` and `allowsEditing` is set to `false`.\n * Otherwise compression and/or cropper will pick the first frame of the GIF and return it as the\n * result (on Android the result will be a PNG). On iOS, both quality and cropping are supported.\n *\n * > **Notes for Web:** The system UI can only be shown after user activation (e.g. a `Button` press).\n * Therefore, calling `launchImageLibraryAsync` in `componentDidMount`, for example, will **not**\n * work as intended. The `cancelled` event will not be returned in the browser due to platform\n * restrictions and inconsistencies across browsers.\n * @param options An object extended by [`ImagePickerOptions`](#imagepickeroptions).\n * @return A promise that resolves to an object with `canceled` and `assets` fields.\n * When the user canceled the action the `assets` is always `null`, otherwise it's an array of\n * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).\n */\nexport async function launchImageLibraryAsync(\n options: ImagePickerOptions = {}\n): Promise<ImagePickerResult> {\n const mappedOptions = mapDeprecatedOptions(options);\n\n if (!ExponentImagePicker.launchImageLibraryAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchImageLibraryAsync');\n }\n if (mappedOptions?.allowsEditing && mappedOptions.allowsMultipleSelection) {\n console.warn(\n '[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.' +\n \"Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' \" +\n 'to fix this warning.'\n );\n }\n return await ExponentImagePicker.launchImageLibraryAsync(mappedOptions);\n}\n\nexport * from './ImagePicker.types';\n\nexport type { PermissionExpiration, PermissionHookOptions, PermissionResponse };\nexport { PermissionStatus };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePicker.types.d.ts","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ImagePicker.types.d.ts","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAG/C;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAG1D;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,kBAAkB,GAAG;IAChE;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;CAC/C,CAAC;AAGF;;GAEG;AACH,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAG7C,oBAAY,iBAAiB;IAC3B;;;;OAIG;IACH,WAAW,IAAI;IACf;;;;OAIG;IACH,UAAU,IAAI;IACd;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,YAAY,IAAI;IAChB;;;;OAIG;IACH,YAAY,IAAI;IAChB;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,KAAK;CACpB;AAGD,oBAAY,kCAAkC;IAC5C;;OAEG;IACH,IAAI,IAAI;IACR;;OAEG;IACH,MAAM,IAAI;IACV;;OAEG;IACH,GAAG,IAAI;IACP;;OAE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AuB,CAAC,CAAC,SAAS,kBAAkB,GAAG,sBAAsB,IACvF,CAAC,SAAS;IAAE,uBAAuB,EAAE,IAAI,CAAA;CAAE,GAAG,iBAAiB,GAAG,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePicker.types.js","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAsBA,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,+BAAW,CAAA;IACX;;OAEG;IACH,qCAAiB,CAAA;IACjB;;OAEG;IACH,qCAAiB,CAAA;AACnB,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B;AA0BD,cAAc;AACd,MAAM,CAAN,IAAY,iBAmEX;AAnED,WAAY,iBAAiB;IAC3B;;;;OAIG;IACH,uEAAe,CAAA;IACf;;;;OAIG;IACH,qEAAc,CAAA;IACd;;;;OAIG;IACH,2EAAiB,CAAA;IACjB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,yEAAgB,CAAA;IAChB;;;;OAIG;IACH,yEAAgB,CAAA;IAChB;;;;OAIG;IACH,2EAAiB,CAAA;IACjB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,8EAAmB,CAAA;AACrB,CAAC,EAnEW,iBAAiB,KAAjB,iBAAiB,QAmE5B;AAED,cAAc;AACd,MAAM,CAAN,IAAY,kCAyBX;AAzBD,WAAY,kCAAkC;IAC5C;;OAEG;IACH,2FAAQ,CAAA;IACR;;OAEG;IACH,+FAAU,CAAA;IACV;;OAEG;IACH,yFAAO,CAAA;IACP;;OAEG;IACH,uGAAc,CAAA;IACd;;OAEG;IACH,+GAAkB,CAAA;IAClB;;OAEG;IACH,6GAAiB,CAAA;AACnB,CAAC,EAzBW,kCAAkC,KAAlC,kCAAkC,QAyB7C;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAoCX;AApCD,WAAY,8BAA8B;IACxC;;OAEG;IACH,4DAA0B,CAAA;IAC1B;;OAEG;IACH,0DAAwB,CAAA;IACxB;;OAEG;IACH,0DAAwB,CAAA;IACxB;;OAEG;IACH,oEAAkC,CAAA;IAClC;;OAEG;IACH,qEAAmC,CAAA;IACnC;;OAEG;IACH,6EAA2C,CAAA;IAC3C;;OAEG;IACH,qDAAmB,CAAA;IACnB;;;;;OAKG;IACH,yDAAuB,CAAA;AACzB,CAAC,EApCW,8BAA8B,KAA9B,8BAA8B,QAoCzC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,6CAaX;AAbD,WAAY,6CAA6C;IACvD;;OAEG;IACH,wEAAuB,CAAA;IACvB;;OAEG;IACH,0EAAyB,CAAA;IACzB;;OAEG;IACH,oEAAmB,CAAA;AACrB,CAAC,EAbW,6CAA6C,KAA7C,6CAA6C,QAaxD;AAED,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACpB;;OAEG;IACH,2BAAa,CAAA;IACb;;OAEG;IACH,6BAAe,CAAA;AACjB,CAAC,EATW,UAAU,KAAV,UAAU,QASrB","sourcesContent":["import type { PermissionResponse } from 'expo-modules-core';\n\n// @needsAudit\n/**\n * Alias for `PermissionResponse` type exported by `expo-modules-core`.\n */\nexport type CameraPermissionResponse = PermissionResponse;\n\n// @needsAudit\n/**\n * Extends `PermissionResponse` type exported by `expo-modules-core`, containing additional iOS-specific field.\n */\nexport type MediaLibraryPermissionResponse = PermissionResponse & {\n /**\n * Indicates if your app has access to the whole or only part of the photo library. Possible values are:\n * - `'all'` if the user granted your app access to the whole photo library\n * - `'limited'` if the user granted your app access only to selected photos (only available on Android API 34+ and iOS 14.0+)\n * - `'none'` if user denied or hasn't yet granted the permission\n */\n accessPrivileges?: 'all' | 'limited' | 'none';\n};\n\n// @needsAudit\n/**\n * @deprecated To set media types available in the image picker use an array of [`MediaType`](#mediatype) instead.\n */\nexport enum MediaTypeOptions {\n /**\n * Images and videos.\n */\n All = 'All',\n /**\n * Only videos.\n */\n Videos = 'Videos',\n /**\n * Only images.\n */\n Images = 'Images',\n}\n\n/**\n * Media types that can be picked by the image picker.\n * - `'images'` - for images.\n * - `'videos'` - for videos.\n * - `'livePhotos'` - for live photos (iOS only).\n *\n * > When the `livePhotos` type is added to the media types array and a live photo is selected,\n * > the resulting `ImagePickerAsset` will contain an unaltered image and the `pairedVideoAsset` field will contain a\n * > video asset paired with the image. This option will be ignored when the `allowsEditing` option is enabled. Due\n * > to platform limitations live photos are returned at original quality, regardless of the `quality` option.\n *\n * > When on Android or Web `livePhotos` type passed as a media type will be ignored.\n */\nexport type MediaType = 'images' | 'videos' | 'livePhotos';\n\n/**\n * The default tab with which the image picker will be opened.\n * - `'photos'` - the photos/videos tab will be opened.\n * - `'albums'` - the albums tab will be opened.\n *\n * @platform android\n */\nexport type DefaultTab = 'photos' | 'albums';\n\n// @needsAudit\nexport enum VideoExportPreset {\n /**\n * Resolution: __Unchanged__ •\n * Video compression: __None__ •\n * Audio compression: __None__\n */\n Passthrough = 0,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n LowQuality = 1,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n MediumQuality = 2,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n HighestQuality = 3,\n /**\n * Resolution: __640 × 480__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_640x480 = 4,\n /**\n * Resolution: __960 × 540__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_960x540 = 5,\n /**\n * Resolution: __1280 × 720__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_1280x720 = 6,\n /**\n * Resolution: __1920 × 1080__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_1920x1080 = 7,\n /**\n * Resolution: __3840 × 2160__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_3840x2160 = 8,\n /**\n * Resolution: __1920 × 1080__ •\n * Video compression: __HEVC__ •\n * Audio compression: __AAC__\n */\n HEVC_1920x1080 = 9,\n /**\n * Resolution: __3840 × 2160__ •\n * Video compression: __HEVC__ •\n * Audio compression: __AAC__\n */\n HEVC_3840x2160 = 10,\n}\n\n// @needsAudit\nexport enum UIImagePickerControllerQualityType {\n /**\n * Highest available resolution.\n */\n High = 0,\n /**\n * Depends on the device.\n */\n Medium = 1,\n /**\n * Depends on the device.\n */\n Low = 2,\n /**\n * 640 × 480\n */\n VGA640x480 = 3,\n /**\n * 1280 × 720\n */\n IFrame1280x720 = 4,\n /**\n * 960 × 540\n */\n IFrame960x540 = 5,\n}\n\n/**\n * Picker presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).\n *\n * @platform ios\n */\nexport enum UIImagePickerPresentationStyle {\n /**\n * A presentation style in which the presented picker covers the screen.\n */\n FULL_SCREEN = 'fullScreen',\n /**\n * A presentation style that partially covers the underlying content.\n */\n PAGE_SHEET = 'pageSheet',\n /**\n * A presentation style that displays the picker centered in the screen.\n */\n FORM_SHEET = 'formSheet',\n /**\n * A presentation style where the picker is displayed over the app's content.\n */\n CURRENT_CONTEXT = 'currentContext',\n /**\n * A presentation style in which the picker view covers the screen.\n */\n OVER_FULL_SCREEN = 'overFullScreen',\n /**\n * A presentation style where the picker is displayed over the app's content.\n */\n OVER_CURRENT_CONTEXT = 'overCurrentContext',\n /**\n * A presentation style where the picker is displayed in a popover view.\n */\n POPOVER = 'popover',\n /**\n * The default presentation style chosen by the system.\n * On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.\n *\n * @platform ios\n */\n AUTOMATIC = 'automatic',\n}\n\n/**\n * Picker preferred asset representation mode. Its values are directly mapped to the [`PHPickerConfigurationAssetRepresentationMode`](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode).\n *\n * @platform ios\n */\nexport enum UIImagePickerPreferredAssetRepresentationMode {\n /**\n * A mode that indicates that the system chooses the appropriate asset representation.\n */\n Automatic = 'automatic',\n /**\n * A mode that uses the most compatible asset representation.\n */\n Compatible = 'compatible',\n /**\n * A mode that uses the current representation to avoid transcoding, if possible.\n */\n Current = 'current',\n}\n\nexport enum CameraType {\n /**\n * Back/rear camera.\n */\n back = 'back',\n /**\n * Front camera\n */\n front = 'front',\n}\n\n/**\n * @hidden\n * @deprecated Use `ImagePickerAsset` instead\n */\nexport type ImageInfo = ImagePickerAsset;\n\n/**\n * Represents an asset (image or video) returned by the image picker or camera.\n */\nexport type ImagePickerAsset = {\n /**\n * URI to the local image or video file (usable as the source of an `Image` element, in the case of\n * an image) and `width` and `height` specify the dimensions of the media.\n */\n uri: string;\n /**\n * The unique ID that represents the picked image or video, if picked from the library. It can be used\n * by [expo-media-library](./media-library) to manage the picked asset.\n *\n * > This might be `null` when the ID is unavailable or the user gave limited permission to access the media library.\n * > On Android, the ID is unavailable when the user selects a photo by directly browsing file system.\n *\n * @platform android\n * @platform ios\n */\n assetId?: string | null;\n /**\n * Width of the image or video. Can be `0` if the system did not provide the width.\n */\n width: number;\n /**\n * Height of the image or video. Can be `0` if the system did not provide the height.\n */\n height: number;\n /**\n * The type of the asset.\n * - `'image'` - for images.\n * - `'video'` - for videos.\n * - `'livePhoto'` - for live photos. (iOS only)\n * - `'pairedVideo'` - for videos paired with photos, which can be combined to create a live photo. (iOS only)\n * - `null` - when the type could not be determined. This is rare but can happen with some Android ContentProviders.\n */\n type?: 'image' | 'video' | 'livePhoto' | 'pairedVideo' | null;\n /**\n * Preferred filename to use when saving this item. This might be `null` when the name is unavailable\n * or user gave limited permission to access the media library.\n *\n */\n fileName?: string | null;\n /**\n * File size of the picked image or video, in bytes.\n *\n */\n fileSize?: number;\n /**\n * The `exif` field is included if the `exif` option is truthy, and is an object containing the\n * image's EXIF data. The names of this object's properties are EXIF tags and the values are the\n * respective EXIF values for those tags.\n *\n * @platform android\n * @platform ios\n */\n exif?: Record<string, any> | null;\n /**\n * When the `base64` option is truthy, it is a Base64-encoded string of the selected image's JPEG data, otherwise `null`.\n * If you prepend this with `'data:image/jpeg;base64,'` to create a data URI,\n * you can use it as the source of an `Image` element; for example:\n * ```ts\n * <Image\n * source={{ uri: 'data:image/jpeg;base64,' + asset.base64 }}\n * style={{ width: 200, height: 200 }}\n * />\n * ```\n */\n base64?: string | null;\n /**\n * Length of the video in milliseconds or `null` if the asset is not a video.\n */\n duration?: number | null;\n /**\n * The MIME type of the selected asset or `null` if could not be determined.\n */\n mimeType?: string;\n /**\n * Contains information about the video paired with the image file. This property is only set when `livePhotos` media type was present in the `mediaTypes` array when launching the picker and a live photo was selected.\n *\n * @platform ios\n */\n pairedVideoAsset?: ImagePickerAsset | null;\n\n /**\n * The web `File` object containing the selected media. This property is web-only and can be used to upload to a server with `FormData`.\n *\n * @platform web\n */\n file?: File;\n};\n\n// @needsAudit\nexport type ImagePickerErrorResult = {\n /**\n * The error code.\n */\n code: string;\n /**\n * The error message.\n */\n message: string;\n /**\n * The exception which caused the error.\n */\n exception?: string;\n};\n\n// @needsAudit\n/**\n * Type representing successful and canceled pick result.\n */\nexport type ImagePickerResult = ImagePickerSuccessResult | ImagePickerCanceledResult;\n\n/**\n * Type representing successful pick result.\n */\nexport type ImagePickerSuccessResult = {\n /**\n * Boolean flag set to `false` showing that the request was successful.\n */\n canceled: false;\n /**\n * An array of picked assets.\n */\n assets: ImagePickerAsset[];\n};\n\n/**\n * Type representing canceled pick result.\n */\nexport type ImagePickerCanceledResult = {\n /**\n * Boolean flag set to `true` showing that the request was canceled.\n */\n canceled: true;\n /**\n * `null` signifying that the request was canceled.\n */\n assets: null;\n};\n\n/**\n * @hidden\n * @deprecated Use `ImagePickerResult` instead.\n */\nexport type ImagePickerCancelledResult = ImagePickerCanceledResult;\n\n/**\n * @hidden\n * @deprecated `ImagePickerMultipleResult` has been deprecated in favor of `ImagePickerResult`.\n */\nexport type ImagePickerMultipleResult = ImagePickerResult;\n\n/**\n * The shape of the crop area.\n */\nexport type CropShape = 'rectangle' | 'oval';\n\n// @needsAudit\nexport type ImagePickerOptions = {\n /**\n * Whether to show a UI to edit the image after it is picked. On Android the user can crop and\n * rotate the image and on iOS simply crop it.\n *\n * > - Cropping multiple images is not supported - this option is mutually exclusive with `allowsMultipleSelection`.\n * > - On iOS, this option is ignored if `allowsMultipleSelection` is enabled.\n * > - On iOS cropping a `.bmp` image will convert it to `.png`.\n *\n * @default false\n * @platform android\n * @platform ios\n */\n allowsEditing?: boolean;\n /**\n * An array with two entries `[x, y]` specifying the aspect ratio to maintain if the user is\n * allowed to edit the image (by passing `allowsEditing: true`). This is only applicable on\n * Android, since on iOS the crop rectangle is always a square.\n */\n aspect?: [number, number];\n /**\n * Specify the shape of the crop area if the user is allowed to edit the image\n * (by passing `allowsEditing: true`). This option is only applicable on Android.\n *\n * @default rectangle\n * @platform android\n */\n shape?: CropShape;\n /**\n * Specify the quality of compression, from `0` to `1`. `0` means compress for small size,\n * `1` means compress for maximum quality.\n * > Note: If the selected image has been compressed before, the size of the output file may be\n * > bigger than the size of the original image.\n *\n * > Note: On iOS, if a `.bmp` or `.png` image is selected from the library, this option is ignored.\n *\n * @default 1.0\n * @platform android\n * @platform ios\n */\n quality?: number;\n /**\n * Choose what type of media to pick.\n * @default 'images'\n */\n mediaTypes?: MediaType | MediaType[] | MediaTypeOptions;\n /**\n * Whether to also include the EXIF data for the image. On iOS the EXIF data does not include GPS\n * tags in the camera case.\n *\n * @platform android\n * @platform ios\n */\n exif?: boolean;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64?: boolean;\n /**\n * Specify preset which will be used to compress selected video.\n * @default ImagePicker.VideoExportPreset.Passthrough\n * @platform ios 11+\n * @deprecated See [`videoExportPreset`](https://developer.apple.com/documentation/uikit/uiimagepickercontroller/2890964-videoexportpreset?language=objc)\n * in Apple documentation.\n */\n videoExportPreset?: VideoExportPreset;\n /**\n * Specify the quality of recorded videos. Defaults to the highest quality available for the device.\n * @default ImagePicker.UIImagePickerControllerQualityType.High\n * @platform ios\n */\n videoQuality?: UIImagePickerControllerQualityType;\n /**\n * Whether or not to allow selecting multiple media files at once.\n *\n * > Cropping multiple images is not supported - this option is mutually exclusive with `allowsEditing`.\n * > If this option is enabled, then `allowsEditing` is ignored.\n *\n * @default false\n * @platform android\n * @platform ios 14+\n * @platform web\n */\n allowsMultipleSelection?: boolean;\n /**\n * The maximum number of items that user can select. Applicable when `allowsMultipleSelection` is enabled.\n * Setting the value to `0` sets the selection limit to the maximum that the system supports.\n *\n * @platform android\n * @platform ios 14+\n * @default 0\n */\n selectionLimit?: number;\n /**\n * Whether to display number badges when assets are selected. The badges are numbered\n * in selection order. Assets are then returned in the exact same order they were selected.\n *\n * > Assets should be returned in the selection order regardless of this option,\n * > but there is no guarantee that it is always true when this option is disabled.\n *\n * @platform ios 15+\n * @default false\n */\n orderedSelection?: boolean;\n /**\n * Choose the default tab with which the image picker will be opened.\n * @default 'photos'\n * @platform android\n */\n defaultTab?: DefaultTab;\n /**\n * Maximum duration, in seconds, for video recording. Setting this to `0` disables the limit.\n * Defaults to `0` (no limit).\n * - **On iOS**, when `allowsEditing` is set to `true`, maximum duration is limited to 10 minutes.\n * This limit is applied automatically, if `0` or no value is specified.\n * - **On Android**, effect of this option depends on support of installed camera app.\n * - **On Web** this option has no effect - the limit is browser-dependant.\n */\n videoMaxDuration?: number;\n /**\n * Choose [presentation style](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle?language=objc)\n * to customize view during taking photo/video.\n * @default ImagePicker.UIImagePickerPresentationStyle.Automatic\n * @platform ios\n */\n presentationStyle?: UIImagePickerPresentationStyle;\n /**\n * Selects the camera-facing type. The `CameraType` enum provides two options:\n * `front` for the front-facing camera and `back` for the back-facing camera.\n * - **On Android**, the behavior of this option may vary based on the camera app installed on the device.\n * - **On Web**, if this option is not provided, use \"camera\" as the default value of internal input element for backwards compatibility.\n * @default CameraType.back\n */\n cameraType?: CameraType;\n /**\n * Choose [preferred asset representation mode](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode)\n * to use when loading assets.\n * @default ImagePicker.UIImagePickerPreferredAssetRepresentationMode.Automatic\n * @platform ios 14+\n */\n preferredAssetRepresentationMode?: UIImagePickerPreferredAssetRepresentationMode;\n /**\n * Uses the legacy image picker on Android. This will allow media to be selected from outside the users photo library.\n * @platform android\n * @default false\n */\n legacy?: boolean;\n /**\n * When enabled, allows the picker to access and download media from iCloud or other remote sources\n * if the asset is not stored locally on the device.\n *\n * For videos, this option applies only when [`videoExportPreset`](#videoexportpreset) is set to `Passthrough`.\n * In all other cases, the video will be downloaded from iCloud automatically.\n *\n * @platform ios\n * @default false\n */\n shouldDownloadFromNetwork?: boolean;\n};\n\n/**\n * @hidden\n * @deprecated Only used internally.\n */\nexport type OpenFileBrowserOptions = {\n /**\n * Choose what type of media to pick.\n * @default 'images'\n */\n mediaTypes: MediaType | MediaType[] | MediaTypeOptions;\n // @docsMissing\n capture?: boolean | CameraType;\n /**\n * Whether or not to allow selecting multiple media files at once.\n * @platform web\n */\n allowsMultipleSelection: boolean;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64: boolean;\n};\n\n/**\n * @hidden\n * @deprecated Use `ImagePickerResult` or `OpenFileBrowserOptions` instead.\n */\nexport type ExpandImagePickerResult<T extends ImagePickerOptions | OpenFileBrowserOptions> =\n T extends { allowsMultipleSelection: true } ? ImagePickerResult : ImagePickerResult;\n"]}
|
|
1
|
+
{"version":3,"file":"ImagePicker.types.js","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAsBA,cAAc;AACd;;GAEG;AACH,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAE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nB;;;;;OAKG;IACH,yDAAuB,CAAA;AACzB,CAAC,EApCW,8BAA8B,KAA9B,8BAA8B,QAoCzC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,6CAaX;AAbD,WAAY,6CAA6C;IACvD;;OAEG;IACH,wEAAuB,CAAA;IACvB;;OAEG;IACH,0EAAyB,CAAA;IACzB;;OAEG;IACH,oEAAmB,CAAA;AACrB,CAAC,EAbW,6CAA6C,KAA7C,6CAA6C,QAaxD;AAED,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACpB;;OAEG;IACH,2BAAa,CAAA;IACb;;OAEG;IACH,6BAAe,CAAA;AACjB,CAAC,EATW,UAAU,KAAV,UAAU,QASrB","sourcesContent":["import type { PermissionResponse } from 'expo';\n\n// @needsAudit\n/**\n * Alias for `PermissionResponse` type exported by `expo-modules-core`.\n */\nexport type CameraPermissionResponse = PermissionResponse;\n\n// @needsAudit\n/**\n * Extends `PermissionResponse` type exported by `expo-modules-core`, containing additional iOS-specific field.\n */\nexport type MediaLibraryPermissionResponse = PermissionResponse & {\n /**\n * Indicates if your app has access to the whole or only part of the photo library. Possible values are:\n * - `'all'` if the user granted your app access to the whole photo library\n * - `'limited'` if the user granted your app access only to selected photos (only available on Android API 34+ and iOS 14.0+)\n * - `'none'` if user denied or hasn't yet granted the permission\n */\n accessPrivileges?: 'all' | 'limited' | 'none';\n};\n\n// @needsAudit\n/**\n * @deprecated To set media types available in the image picker use an array of [`MediaType`](#mediatype) instead.\n */\nexport enum MediaTypeOptions {\n /**\n * Images and videos.\n */\n All = 'All',\n /**\n * Only videos.\n */\n Videos = 'Videos',\n /**\n * Only images.\n */\n Images = 'Images',\n}\n\n/**\n * Media types that can be picked by the image picker.\n * - `'images'` - for images.\n * - `'videos'` - for videos.\n * - `'livePhotos'` - for live photos (iOS only).\n *\n * > When the `livePhotos` type is added to the media types array and a live photo is selected,\n * > the resulting `ImagePickerAsset` will contain an unaltered image and the `pairedVideoAsset` field will contain a\n * > video asset paired with the image. This option will be ignored when the `allowsEditing` option is enabled. Due\n * > to platform limitations live photos are returned at original quality, regardless of the `quality` option.\n *\n * > When on Android or Web `livePhotos` type passed as a media type will be ignored.\n */\nexport type MediaType = 'images' | 'videos' | 'livePhotos';\n\n/**\n * The default tab with which the image picker will be opened.\n * - `'photos'` - the photos/videos tab will be opened.\n * - `'albums'` - the albums tab will be opened.\n *\n * @platform android\n */\nexport type DefaultTab = 'photos' | 'albums';\n\n// @needsAudit\nexport enum VideoExportPreset {\n /**\n * Resolution: __Unchanged__ •\n * Video compression: __None__ •\n * Audio compression: __None__\n */\n Passthrough = 0,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n LowQuality = 1,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n MediumQuality = 2,\n /**\n * Resolution: __Depends on the device__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n HighestQuality = 3,\n /**\n * Resolution: __640 × 480__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_640x480 = 4,\n /**\n * Resolution: __960 × 540__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_960x540 = 5,\n /**\n * Resolution: __1280 × 720__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_1280x720 = 6,\n /**\n * Resolution: __1920 × 1080__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_1920x1080 = 7,\n /**\n * Resolution: __3840 × 2160__ •\n * Video compression: __H.264__ •\n * Audio compression: __AAC__\n */\n H264_3840x2160 = 8,\n /**\n * Resolution: __1920 × 1080__ •\n * Video compression: __HEVC__ •\n * Audio compression: __AAC__\n */\n HEVC_1920x1080 = 9,\n /**\n * Resolution: __3840 × 2160__ •\n * Video compression: __HEVC__ •\n * Audio compression: __AAC__\n */\n HEVC_3840x2160 = 10,\n}\n\n// @needsAudit\nexport enum UIImagePickerControllerQualityType {\n /**\n * Highest available resolution.\n */\n High = 0,\n /**\n * Depends on the device.\n */\n Medium = 1,\n /**\n * Depends on the device.\n */\n Low = 2,\n /**\n * 640 × 480\n */\n VGA640x480 = 3,\n /**\n * 1280 × 720\n */\n IFrame1280x720 = 4,\n /**\n * 960 × 540\n */\n IFrame960x540 = 5,\n}\n\n/**\n * Picker presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).\n *\n * @platform ios\n */\nexport enum UIImagePickerPresentationStyle {\n /**\n * A presentation style in which the presented picker covers the screen.\n */\n FULL_SCREEN = 'fullScreen',\n /**\n * A presentation style that partially covers the underlying content.\n */\n PAGE_SHEET = 'pageSheet',\n /**\n * A presentation style that displays the picker centered in the screen.\n */\n FORM_SHEET = 'formSheet',\n /**\n * A presentation style where the picker is displayed over the app's content.\n */\n CURRENT_CONTEXT = 'currentContext',\n /**\n * A presentation style in which the picker view covers the screen.\n */\n OVER_FULL_SCREEN = 'overFullScreen',\n /**\n * A presentation style where the picker is displayed over the app's content.\n */\n OVER_CURRENT_CONTEXT = 'overCurrentContext',\n /**\n * A presentation style where the picker is displayed in a popover view.\n */\n POPOVER = 'popover',\n /**\n * The default presentation style chosen by the system.\n * On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.\n *\n * @platform ios\n */\n AUTOMATIC = 'automatic',\n}\n\n/**\n * Picker preferred asset representation mode. Its values are directly mapped to the [`PHPickerConfigurationAssetRepresentationMode`](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode).\n *\n * @platform ios\n */\nexport enum UIImagePickerPreferredAssetRepresentationMode {\n /**\n * A mode that indicates that the system chooses the appropriate asset representation.\n */\n Automatic = 'automatic',\n /**\n * A mode that uses the most compatible asset representation.\n */\n Compatible = 'compatible',\n /**\n * A mode that uses the current representation to avoid transcoding, if possible.\n */\n Current = 'current',\n}\n\nexport enum CameraType {\n /**\n * Back/rear camera.\n */\n back = 'back',\n /**\n * Front camera\n */\n front = 'front',\n}\n\n/**\n * @hidden\n * @deprecated Use `ImagePickerAsset` instead\n */\nexport type ImageInfo = ImagePickerAsset;\n\n/**\n * Represents an asset (image or video) returned by the image picker or camera.\n */\nexport type ImagePickerAsset = {\n /**\n * URI to the local image or video file (usable as the source of an `Image` element, in the case of\n * an image) and `width` and `height` specify the dimensions of the media.\n */\n uri: string;\n /**\n * The unique ID that represents the picked image or video, if picked from the library. It can be used\n * by [expo-media-library](./media-library) to manage the picked asset.\n *\n * > This might be `null` when the ID is unavailable or the user gave limited permission to access the media library.\n * > On Android, the ID is unavailable when the user selects a photo by directly browsing file system.\n *\n * @platform android\n * @platform ios\n */\n assetId?: string | null;\n /**\n * Width of the image or video. Can be `0` if the system did not provide the width.\n */\n width: number;\n /**\n * Height of the image or video. Can be `0` if the system did not provide the height.\n */\n height: number;\n /**\n * The type of the asset.\n * - `'image'` - for images.\n * - `'video'` - for videos.\n * - `'livePhoto'` - for live photos. (iOS only)\n * - `'pairedVideo'` - for videos paired with photos, which can be combined to create a live photo. (iOS only)\n * - `null` - when the type could not be determined. This is rare but can happen with some Android ContentProviders.\n */\n type?: 'image' | 'video' | 'livePhoto' | 'pairedVideo' | null;\n /**\n * Preferred filename to use when saving this item. This might be `null` when the name is unavailable\n * or user gave limited permission to access the media library.\n *\n */\n fileName?: string | null;\n /**\n * File size of the picked image or video, in bytes.\n *\n */\n fileSize?: number;\n /**\n * The `exif` field is included if the `exif` option is truthy, and is an object containing the\n * image's EXIF data. The names of this object's properties are EXIF tags and the values are the\n * respective EXIF values for those tags.\n *\n * @platform android\n * @platform ios\n */\n exif?: Record<string, any> | null;\n /**\n * When the `base64` option is truthy, it is a Base64-encoded string of the selected image's JPEG data, otherwise `null`.\n * If you prepend this with `'data:image/jpeg;base64,'` to create a data URI,\n * you can use it as the source of an `Image` element; for example:\n * ```ts\n * <Image\n * source={{ uri: 'data:image/jpeg;base64,' + asset.base64 }}\n * style={{ width: 200, height: 200 }}\n * />\n * ```\n */\n base64?: string | null;\n /**\n * Length of the video in milliseconds or `null` if the asset is not a video.\n */\n duration?: number | null;\n /**\n * The MIME type of the selected asset or `null` if could not be determined.\n */\n mimeType?: string;\n /**\n * Contains information about the video paired with the image file. This property is only set when `livePhotos` media type was present in the `mediaTypes` array when launching the picker and a live photo was selected.\n *\n * @platform ios\n */\n pairedVideoAsset?: ImagePickerAsset | null;\n\n /**\n * The web `File` object containing the selected media. This property is web-only and can be used to upload to a server with `FormData`.\n *\n * @platform web\n */\n file?: File;\n};\n\n// @needsAudit\nexport type ImagePickerErrorResult = {\n /**\n * The error code.\n */\n code: string;\n /**\n * The error message.\n */\n message: string;\n /**\n * The exception which caused the error.\n */\n exception?: string;\n};\n\n// @needsAudit\n/**\n * Type representing successful and canceled pick result.\n */\nexport type ImagePickerResult = ImagePickerSuccessResult | ImagePickerCanceledResult;\n\n/**\n * Type representing successful pick result.\n */\nexport type ImagePickerSuccessResult = {\n /**\n * Boolean flag set to `false` showing that the request was successful.\n */\n canceled: false;\n /**\n * An array of picked assets.\n */\n assets: ImagePickerAsset[];\n};\n\n/**\n * Type representing canceled pick result.\n */\nexport type ImagePickerCanceledResult = {\n /**\n * Boolean flag set to `true` showing that the request was canceled.\n */\n canceled: true;\n /**\n * `null` signifying that the request was canceled.\n */\n assets: null;\n};\n\n/**\n * @hidden\n * @deprecated Use `ImagePickerResult` instead.\n */\nexport type ImagePickerCancelledResult = ImagePickerCanceledResult;\n\n/**\n * @hidden\n * @deprecated `ImagePickerMultipleResult` has been deprecated in favor of `ImagePickerResult`.\n */\nexport type ImagePickerMultipleResult = ImagePickerResult;\n\n/**\n * The shape of the crop area.\n */\nexport type CropShape = 'rectangle' | 'oval';\n\n// @needsAudit\nexport type ImagePickerOptions = {\n /**\n * Whether to show a UI to edit the image after it is picked. On Android the user can crop and\n * rotate the image and on iOS simply crop it.\n *\n * > - Cropping multiple images is not supported - this option is mutually exclusive with `allowsMultipleSelection`.\n * > - On iOS, this option is ignored if `allowsMultipleSelection` is enabled.\n * > - On iOS cropping a `.bmp` image will convert it to `.png`.\n *\n * @default false\n * @platform android\n * @platform ios\n */\n allowsEditing?: boolean;\n /**\n * An array with two entries `[x, y]` specifying the aspect ratio to maintain if the user is\n * allowed to edit the image (by passing `allowsEditing: true`). This is only applicable on\n * Android, since on iOS the crop rectangle is always a square.\n */\n aspect?: [number, number];\n /**\n * Specify the shape of the crop area if the user is allowed to edit the image\n * (by passing `allowsEditing: true`). This option is only applicable on Android.\n *\n * @default rectangle\n * @platform android\n */\n shape?: CropShape;\n /**\n * Specify the quality of compression, from `0` to `1`. `0` means compress for small size,\n * `1` means compress for maximum quality.\n * > Note: If the selected image has been compressed before, the size of the output file may be\n * > bigger than the size of the original image.\n *\n * > Note: On iOS, if a `.bmp` or `.png` image is selected from the library, this option is ignored.\n *\n * @default 1.0\n * @platform android\n * @platform ios\n */\n quality?: number;\n /**\n * Choose what type of media to pick.\n * @default 'images'\n */\n mediaTypes?: MediaType | MediaType[] | MediaTypeOptions;\n /**\n * Whether to also include the EXIF data for the image. On iOS the EXIF data does not include GPS\n * tags in the camera case.\n *\n * @platform android\n * @platform ios\n */\n exif?: boolean;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64?: boolean;\n /**\n * Specify preset which will be used to compress selected video.\n * @default ImagePicker.VideoExportPreset.Passthrough\n * @platform ios 11+\n * @deprecated See [`videoExportPreset`](https://developer.apple.com/documentation/uikit/uiimagepickercontroller/2890964-videoexportpreset?language=objc)\n * in Apple documentation.\n */\n videoExportPreset?: VideoExportPreset;\n /**\n * Specify the quality of recorded videos. Defaults to the highest quality available for the device.\n * @default ImagePicker.UIImagePickerControllerQualityType.High\n * @platform ios\n */\n videoQuality?: UIImagePickerControllerQualityType;\n /**\n * Whether or not to allow selecting multiple media files at once.\n *\n * > Cropping multiple images is not supported - this option is mutually exclusive with `allowsEditing`.\n * > If this option is enabled, then `allowsEditing` is ignored.\n *\n * @default false\n * @platform android\n * @platform ios 14+\n * @platform web\n */\n allowsMultipleSelection?: boolean;\n /**\n * The maximum number of items that user can select. Applicable when `allowsMultipleSelection` is enabled.\n * Setting the value to `0` sets the selection limit to the maximum that the system supports.\n *\n * @platform android\n * @platform ios 14+\n * @default 0\n */\n selectionLimit?: number;\n /**\n * Whether to display number badges when assets are selected. The badges are numbered\n * in selection order. Assets are then returned in the exact same order they were selected.\n *\n * > Assets should be returned in the selection order regardless of this option,\n * > but there is no guarantee that it is always true when this option is disabled.\n *\n * @platform ios 15+\n * @default false\n */\n orderedSelection?: boolean;\n /**\n * Choose the default tab with which the image picker will be opened.\n * @default 'photos'\n * @platform android\n */\n defaultTab?: DefaultTab;\n /**\n * Maximum duration, in seconds, for video recording. Setting this to `0` disables the limit.\n * Defaults to `0` (no limit).\n * - **On iOS**, when `allowsEditing` is set to `true`, maximum duration is limited to 10 minutes.\n * This limit is applied automatically, if `0` or no value is specified.\n * - **On Android**, effect of this option depends on support of installed camera app.\n * - **On Web** this option has no effect - the limit is browser-dependant.\n */\n videoMaxDuration?: number;\n /**\n * Choose [presentation style](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle?language=objc)\n * to customize view during taking photo/video.\n * @default ImagePicker.UIImagePickerPresentationStyle.Automatic\n * @platform ios\n */\n presentationStyle?: UIImagePickerPresentationStyle;\n /**\n * Selects the camera-facing type. The `CameraType` enum provides two options:\n * `front` for the front-facing camera and `back` for the back-facing camera.\n * - **On Android**, the behavior of this option may vary based on the camera app installed on the device.\n * - **On Web**, if this option is not provided, use \"camera\" as the default value of internal input element for backwards compatibility.\n * @default CameraType.back\n */\n cameraType?: CameraType;\n /**\n * Choose [preferred asset representation mode](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode)\n * to use when loading assets.\n * @default ImagePicker.UIImagePickerPreferredAssetRepresentationMode.Automatic\n * @platform ios 14+\n */\n preferredAssetRepresentationMode?: UIImagePickerPreferredAssetRepresentationMode;\n /**\n * Uses the legacy image picker on Android. This will allow media to be selected from outside the users photo library.\n * @platform android\n * @default false\n */\n legacy?: boolean;\n /**\n * When enabled, allows the picker to access and download media from iCloud or other remote sources\n * if the asset is not stored locally on the device.\n *\n * For videos, this option applies only when [`videoExportPreset`](#videoexportpreset) is set to `Passthrough`.\n * In all other cases, the video will be downloaded from iCloud automatically.\n *\n * @platform ios\n * @default false\n */\n shouldDownloadFromNetwork?: boolean;\n};\n\n/**\n * @hidden\n * @deprecated Only used internally.\n */\nexport type OpenFileBrowserOptions = {\n /**\n * Choose what type of media to pick.\n * @default 'images'\n */\n mediaTypes: MediaType | MediaType[] | MediaTypeOptions;\n // @docsMissing\n capture?: boolean | CameraType;\n /**\n * Whether or not to allow selecting multiple media files at once.\n * @platform web\n */\n allowsMultipleSelection: boolean;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64: boolean;\n};\n\n/**\n * @hidden\n * @deprecated Use `ImagePickerResult` or `OpenFileBrowserOptions` instead.\n */\nexport type ExpandImagePickerResult<T extends ImagePickerOptions | OpenFileBrowserOptions> =\n T extends { allowsMultipleSelection: true } ? ImagePickerResult : ImagePickerResult;\n"]}
|
package/expo-module.config.json
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
71fb0af8984a8c8a076019e4a3739909
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c8e9f29bdf8d7f4e96a577306fd529896e463731
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
40751a28d2a163a3da2d50f47298caf2c77acb92bc240db9731e80b1ef17b6ab
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0bdd49281c9f26074fc9c5fd19ab8657b9cf7f21fb34d627c559bf030110f151d6eb3e377537c4e151c510a0418454fde2a42e31246691e941732c3979eb2a25
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.imagepicker",
|
|
6
|
-
"version": "56.0.
|
|
6
|
+
"version": "56.0.7",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.imagepicker-56.0.
|
|
28
|
-
"url": "expo.modules.imagepicker-56.0.
|
|
29
|
-
"size":
|
|
30
|
-
"sha512": "
|
|
31
|
-
"sha256": "
|
|
32
|
-
"sha1": "
|
|
33
|
-
"md5": "
|
|
27
|
+
"name": "expo.modules.imagepicker-56.0.7.aar",
|
|
28
|
+
"url": "expo.modules.imagepicker-56.0.7.aar",
|
|
29
|
+
"size": 163859,
|
|
30
|
+
"sha512": "0bdd49281c9f26074fc9c5fd19ab8657b9cf7f21fb34d627c559bf030110f151d6eb3e377537c4e151c510a0418454fde2a42e31246691e941732c3979eb2a25",
|
|
31
|
+
"sha256": "40751a28d2a163a3da2d50f47298caf2c77acb92bc240db9731e80b1ef17b6ab",
|
|
32
|
+
"sha1": "c8e9f29bdf8d7f4e96a577306fd529896e463731",
|
|
33
|
+
"md5": "71fb0af8984a8c8a076019e4a3739909"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
},
|
|
@@ -116,13 +116,13 @@
|
|
|
116
116
|
],
|
|
117
117
|
"files": [
|
|
118
118
|
{
|
|
119
|
-
"name": "expo.modules.imagepicker-56.0.
|
|
120
|
-
"url": "expo.modules.imagepicker-56.0.
|
|
121
|
-
"size":
|
|
122
|
-
"sha512": "
|
|
123
|
-
"sha256": "
|
|
124
|
-
"sha1": "
|
|
125
|
-
"md5": "
|
|
119
|
+
"name": "expo.modules.imagepicker-56.0.7.aar",
|
|
120
|
+
"url": "expo.modules.imagepicker-56.0.7.aar",
|
|
121
|
+
"size": 163859,
|
|
122
|
+
"sha512": "0bdd49281c9f26074fc9c5fd19ab8657b9cf7f21fb34d627c559bf030110f151d6eb3e377537c4e151c510a0418454fde2a42e31246691e941732c3979eb2a25",
|
|
123
|
+
"sha256": "40751a28d2a163a3da2d50f47298caf2c77acb92bc240db9731e80b1ef17b6ab",
|
|
124
|
+
"sha1": "c8e9f29bdf8d7f4e96a577306fd529896e463731",
|
|
125
|
+
"md5": "71fb0af8984a8c8a076019e4a3739909"
|
|
126
126
|
}
|
|
127
127
|
]
|
|
128
128
|
},
|
|
@@ -136,8 +136,8 @@
|
|
|
136
136
|
},
|
|
137
137
|
"files": [
|
|
138
138
|
{
|
|
139
|
-
"name": "expo.modules.imagepicker-56.0.
|
|
140
|
-
"url": "expo.modules.imagepicker-56.0.
|
|
139
|
+
"name": "expo.modules.imagepicker-56.0.7-sources.jar",
|
|
140
|
+
"url": "expo.modules.imagepicker-56.0.7-sources.jar",
|
|
141
141
|
"size": 25135,
|
|
142
142
|
"sha512": "da0b109c6c9642027b32caf9a88d88fd1e9d767bdc16e7a2efac95b79a368c919c2a2aa7cc290dd5773904d6083a10f44c94d6556f8c2efe117ef33daf769fd0",
|
|
143
143
|
"sha256": "d792d28babec3ba84b947476d855bcf862fca02162215c0d1190647660fff573",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
723da9aa19b7876ad9e36a340fe68fa2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
807570288236909c1f4e164f07e9e40802e99079
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1a8037108968dde517a747af4534cd147d09c27be4e3982fdedd78ed665f67fd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c4d9cb7e8a47db587a179f38739b5508f1d55329542c7389604cc1c2532cae734fcf82f5ad6eca0281bf509bfccc63634e0aaa2ec858515f843739ffd166fc90
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.imagepicker</artifactId>
|
|
12
|
-
<version>56.0.
|
|
12
|
+
<version>56.0.7</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.imagepicker</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bdf976c6c493b209bd01ae45500be29d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bc55cd74253cb5351b50230196ef96046d622aeb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f4382a831f78c5e557f26dac52b0ca28611e739b7a674d09cd50267c73c636ee
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4742554d2e9b35ee67d138b15cf6c4729130588c3f4a671c5ecaf11a346ddc0ea4e46f74231ac4824a2c1bc20aa81df34c30edc8fa7f49a31591c28c3e9becd6
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.imagepicker</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>56.0.
|
|
7
|
-
<release>56.0.
|
|
6
|
+
<latest>56.0.7</latest>
|
|
7
|
+
<release>56.0.7</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>56.0.
|
|
9
|
+
<version>56.0.7</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20260513103322</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
0a1b9dcb09365c954fa1d9c00092110a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
03173e2c5c31fe5eb6cebfe264f3606eb8aa8add
|
package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
e3b1ec057f5a91ffe35b72636fd67f393af24236e8c6cf31da66560872ba7acb
|
package/local-maven-repo/host/exp/exponent/expo.modules.imagepicker/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
25526844da788ed6584aa3de61e07b41b548c337d8762608999ea4cff9bf1b1cccfe78b3195f43a169499258ec6d104698689c850cf5b8c37407db1be06df661
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-image-picker",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.7",
|
|
4
4
|
"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.",
|
|
5
5
|
"main": "build/ImagePicker.js",
|
|
6
6
|
"types": "build/ImagePicker.d.ts",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"@testing-library/react": "^16.3.0",
|
|
34
34
|
"@testing-library/user-event": "^14.6.1",
|
|
35
35
|
"@types/node": "^22.14.0",
|
|
36
|
-
"expo": "56.0.0-preview.
|
|
36
|
+
"expo": "56.0.0-preview.10",
|
|
37
37
|
"expo-module-scripts": "56.0.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"expo": "*"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "40f0a6f6711d93762e0506b37e6e077e4bd9a541",
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "expo-module build",
|
|
45
45
|
"clean": "expo-module clean",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type PermissionResponse, PermissionStatus } from 'expo';
|
|
2
|
+
import { Platform } from 'expo-modules-core';
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
5
|
ImagePickerAsset,
|
package/src/ImagePicker.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
PermissionExpiration,
|
|
3
|
-
PermissionHookOptions,
|
|
4
|
-
PermissionResponse,
|
|
5
|
-
} from 'expo-modules-core';
|
|
6
1
|
import {
|
|
7
|
-
CodedError,
|
|
8
|
-
createPermissionHook,
|
|
9
2
|
PermissionStatus,
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
createPermissionHook,
|
|
4
|
+
type PermissionExpiration,
|
|
5
|
+
type PermissionHookOptions,
|
|
6
|
+
type PermissionResponse,
|
|
7
|
+
} from 'expo';
|
|
8
|
+
import { CodedError, UnavailabilityError } from 'expo-modules-core';
|
|
12
9
|
|
|
13
10
|
import ExponentImagePicker from './ExponentImagePicker';
|
|
14
11
|
import type {
|
package/src/ImagePicker.types.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f26fddc1df506f4793cabbf57965cb14
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1578351bdf0988d444f435d83a6789ba76cdd625
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d60ef964d9fc94320cd3ef6fb401b419db7cf5bcac6920b3c122a9f5c79e8143
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a24560e10a527440b734b5a5f10697aec36975aac353efc6524b54b0ffac279c941a17a4813104c6cd60fa46396d05c9489ed34ad58846b491a9851eaaecb915
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
86895fcf58748891c3cb89f99e8bf07d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b919b90b049c713215abe344e682fc3b54e0e570
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b48d3245541fe3fab7402a484669e510e3ffe139d8601cd592d435f6403c36d1
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
21c2fa02ab98e170222b75163fab6c104cfe8433df20755d06ee94b9189c8a82007da4ddeeaf9f4c9242e86cb5b747ad3f414a6cede2b0f8dc32470d1d8b1c43
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d2d44eefc928cdba71174ba084ccc0d9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ee988318dde6f3f7fa076bf4e812ce0a44300191
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a9f07ab87e805d141557de5a62530c6998521a00cadb08216f0de4a7793cdef0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e0bf6da9624383933c36790ad26ad2c7d1b379a0008a8bf9e20cf5a233e849c37b3db85d4f8de5c06261b1896513f8d7b407752d4b24b873f400a33bf8e077ca
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|