expo-image-picker 12.0.2 → 13.1.0
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 +41 -1
- package/README.md +49 -9
- package/android/build.gradle +29 -13
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/expo/modules/imagepicker/ImagePickerConstants.kt +2 -0
- package/android/src/main/java/expo/modules/imagepicker/ImagePickerModule.kt +6 -2
- package/android/src/main/java/expo/modules/imagepicker/ImagePickerUtils.kt +6 -1
- package/android/src/main/java/expo/modules/imagepicker/tasks/ImageResultTask.kt +1 -1
- package/build/ExponentImagePicker.d.ts +1 -0
- package/build/ExponentImagePicker.d.ts.map +1 -0
- package/build/ExponentImagePicker.web.d.ts +1 -0
- package/build/ExponentImagePicker.web.d.ts.map +1 -0
- package/build/ImagePicker.d.ts +8 -7
- package/build/ImagePicker.d.ts.map +1 -0
- package/build/ImagePicker.js +5 -6
- package/build/ImagePicker.js.map +1 -1
- package/build/ImagePicker.types.d.ts +81 -17
- package/build/ImagePicker.types.d.ts.map +1 -0
- package/build/ImagePicker.types.js +72 -10
- package/build/ImagePicker.types.js.map +1 -1
- package/expo-module.config.json +6 -0
- package/ios/{EXImagePicker.podspec → ExpoImagePicker.podspec} +10 -3
- package/ios/ImagePickerExceptions.swift +105 -0
- package/ios/ImagePickerHandler.swift +72 -0
- package/ios/ImagePickerModule.swift +162 -0
- package/ios/ImagePickerOptions.swift +170 -0
- package/ios/ImagePickerPermissionRequesters.swift +137 -0
- package/ios/ImagePickerResponse.swift +68 -0
- package/ios/MediaHandler.swift +347 -0
- package/ios/StatusBarVisibilityController.swift +52 -0
- package/ios/UIImage+fixOrientation.swift +82 -0
- package/package.json +4 -3
- package/plugin/build/withImagePicker.d.ts +9 -7
- package/plugin/build/withImagePicker.js +58 -43
- package/plugin/src/withImagePicker.ts +80 -50
- package/src/ImagePicker.ts +7 -6
- package/src/ImagePicker.types.ts +80 -18
- package/ios/EXImagePicker/EXImagePicker.h +0 -12
- package/ios/EXImagePicker/EXImagePicker.m +0 -632
- package/ios/EXImagePicker/Permissions/EXImagePickerCameraPermissionRequester.h +0 -7
- package/ios/EXImagePicker/Permissions/EXImagePickerCameraPermissionRequester.m +0 -54
- package/ios/EXImagePicker/Permissions/EXImagePickerMediaLibraryPermissionRequester.h +0 -13
- package/ios/EXImagePicker/Permissions/EXImagePickerMediaLibraryPermissionRequester.m +0 -84
- package/ios/EXImagePicker/Permissions/EXImagePickerMediaLibraryWriteOnlyPermissionRequester.h +0 -7
- package/ios/EXImagePicker/Permissions/EXImagePickerMediaLibraryWriteOnlyPermissionRequester.m +0 -21
- package/unimodule.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -10,7 +10,47 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## 13.1.0 — 2022-04-25
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- [plugin] Added ability to disable permissions. ([#17168](https://github.com/expo/expo/pull/17168) by [@EvanBacon](https://github.com/EvanBacon))
|
|
18
|
+
|
|
19
|
+
## 13.0.1 — 2022-04-20
|
|
20
|
+
|
|
21
|
+
_This version does not introduce any user-facing changes._
|
|
22
|
+
|
|
23
|
+
## 13.0.0 — 2022-04-18
|
|
24
|
+
|
|
25
|
+
### 🛠 Breaking changes
|
|
26
|
+
|
|
27
|
+
- On Android migrated cropping library from `com.theartofdev.edmodo:android-image-cropper@2.8.0` (available from `jcenter()`) to `com.github.CanHub:Android-Image-Cropper@1.1.1` (available from `jitpack.io`). ([#11647](https://github.com/expo/expo/pull/11647) by [@bbarthec](https://github.com/bbarthec))
|
|
28
|
+
|
|
29
|
+
### 🎉 New features
|
|
30
|
+
|
|
31
|
+
- Native module on iOS is now written in Swift using the new API. ([#15977](https://github.com/expo/expo/pull/15977) by [@bbarthec](https://github.com/bbarthec))
|
|
32
|
+
|
|
33
|
+
### 🐛 Bug fixes
|
|
34
|
+
|
|
35
|
+
- Fixed crashes on Android after image is picked by adding missing dependency `expo-image-loader`. ([#17019](https://github.com/expo/expo/pull/17019) by [@M1ST4KE](https://github.com/M1ST4KE))
|
|
36
|
+
- Fix failure on Android when `allowsEditing` is `true` and non-jpeg file picked. ([#16615](https://github.com/expo/expo/pull/16615) by [@mnightingale](https://github.com/mnightingale))
|
|
37
|
+
|
|
38
|
+
### ⚠ Notices
|
|
39
|
+
|
|
40
|
+
- Deleted the `UIImagePickerPresentationStyle.BlurOverFullScreen` option as it does not work on iOS. ([#16925](https://github.com/expo/expo/pull/16925) by [@barthap](https://github.com/barthap))
|
|
41
|
+
- Deprecated all `PascalCase` values of the `UIImagePickerPresentationStyle` enum. Use their `SNAKE_UPPERCASE` counterparts instead. ([#16925](https://github.com/expo/expo/pull/16925) by [@barthap](https://github.com/barthap))
|
|
42
|
+
- Underlying values of the `UIImagePickerPresentationStyle` are now strings. They were integers before. ([#16925](https://github.com/expo/expo/pull/16925) by [@barthap](https://github.com/barthap))
|
|
43
|
+
|
|
44
|
+
### 💡 Others
|
|
45
|
+
|
|
46
|
+
- Updated `@expo/config-plugins` from `4.0.2` to `4.0.14` ([#15621](https://github.com/expo/expo/pull/15621) by [@EvanBacon](https://github.com/EvanBacon))
|
|
47
|
+
- Export missing `PermissionResponse` type. ([#15744](https://github.com/expo/expo/pull/15744) by [@Simek](https://github.com/Simek))
|
|
48
|
+
|
|
49
|
+
### ⚠️ Notices
|
|
50
|
+
|
|
51
|
+
- On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
|
|
52
|
+
|
|
53
|
+
## 12.0.2 - 2022-02-01
|
|
14
54
|
|
|
15
55
|
### 🐛 Bug fixes
|
|
16
56
|
|
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@ Provides access to the system's UI for selecting images and videos from the phon
|
|
|
4
4
|
|
|
5
5
|
# API documentation
|
|
6
6
|
|
|
7
|
-
- [Documentation for the
|
|
8
|
-
- [Documentation for the latest stable release](https://docs.expo.
|
|
7
|
+
- [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/imagepicker.md)
|
|
8
|
+
- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/imagepicker/)
|
|
9
9
|
|
|
10
10
|
# Installation in managed Expo projects
|
|
11
11
|
|
|
12
|
-
For
|
|
12
|
+
For [managed](https://docs.expo.dev/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/imagepicker/).
|
|
13
13
|
|
|
14
14
|
# Installation in bare React Native projects
|
|
15
15
|
|
|
@@ -23,6 +23,8 @@ expo install expo-image-picker
|
|
|
23
23
|
|
|
24
24
|
### Configure for iOS
|
|
25
25
|
|
|
26
|
+
> This is only required for usage in bare React Native apps.
|
|
27
|
+
|
|
26
28
|
Add `NSPhotoLibraryUsageDescription`, `NSCameraUsageDescription`, and `NSMicrophoneUsageDescription` keys to your `Info.plist`:
|
|
27
29
|
|
|
28
30
|
```xml
|
|
@@ -38,6 +40,8 @@ Run `npx pod-install` after installing the npm package.
|
|
|
38
40
|
|
|
39
41
|
### Configure for Android
|
|
40
42
|
|
|
43
|
+
> This is only required for usage in bare React Native apps.
|
|
44
|
+
|
|
41
45
|
This package automatically adds the `CAMERA`, `READ_EXTERNAL_STORAGE`, and `WRITE_EXTERNAL_STORAGE` permissions. They are used when picking images from the camera directly, or from the camera roll.
|
|
42
46
|
|
|
43
47
|
```xml
|
|
@@ -47,13 +51,49 @@ This package automatically adds the `CAMERA`, `READ_EXTERNAL_STORAGE`, and `WRIT
|
|
|
47
51
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
48
52
|
```
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
## Config Plugin
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
> This plugin is applied automatically in EAS Build, only add the config plugin if you want to pass in extra properties.
|
|
57
|
+
|
|
58
|
+
After installing this npm package, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"expo": {
|
|
63
|
+
"plugins": ["expo-image-picker"]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Next, rebuild your app as described in the ["Adding custom native code"](https://docs.expo.io/workflow/customizing/) guide.
|
|
69
|
+
|
|
70
|
+
### API
|
|
71
|
+
|
|
72
|
+
The plugin provides props for extra customization. Every time you change the props or plugins, you'll need to rebuild (and `prebuild`) the native app. If no extra properties are added, defaults will be used.
|
|
73
|
+
|
|
74
|
+
- `photosPermission` (_string | false_): Sets the iOS `NSPhotoLibraryUsageDescription` permission message to the `Info.plist`. Setting `false` will skip adding the permission on iOS and **does not** skip the permission on Android. Defaults to `Allow $(PRODUCT_NAME) to access your photos`.
|
|
75
|
+
- `cameraPermission` (_string | false_): Sets the iOS `NSCameraUsageDescription` permission message to the `Info.plist`. Setting `false` will skip adding the permission on iOS and **does not** skip the permission on Android. Defaults to `Allow $(PRODUCT_NAME) to access your camera`.
|
|
76
|
+
- `microphonePermission` (_string | false_): Sets the iOS `NSCameraUsageDescription` permission message to the `Info.plist`. Setting `false` will skip adding the permission on iOS and skips adding the `android.permission.RECORD_AUDIO` Android permission. Defaults to `Allow $(PRODUCT_NAME) to access your photos`.
|
|
77
|
+
|
|
78
|
+
### Example
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"expo": {
|
|
83
|
+
"plugins": [
|
|
84
|
+
[
|
|
85
|
+
"expo-image-picker",
|
|
86
|
+
{
|
|
87
|
+
"photosPermission": "custom photos permission",
|
|
88
|
+
"cameraPermission": "Allow $(PRODUCT_NAME) to open the camera",
|
|
89
|
+
|
|
90
|
+
"//": "Disables the microphone permission",
|
|
91
|
+
"microphonePermission": false
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
57
97
|
```
|
|
58
98
|
|
|
59
99
|
# Contributing
|
package/android/build.gradle
CHANGED
|
@@ -3,24 +3,38 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '
|
|
6
|
+
version = '13.1.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
10
|
+
if (expoModulesCorePlugin.exists()) {
|
|
11
|
+
apply from: expoModulesCorePlugin
|
|
12
|
+
applyKotlinExpoModulesCorePlugin()
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
10
16
|
ext.safeExtGet = { prop, fallback ->
|
|
11
17
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
12
18
|
}
|
|
13
19
|
|
|
20
|
+
// Ensures backward compatibility
|
|
21
|
+
ext.getKotlinVersion = {
|
|
22
|
+
if (ext.has("kotlinVersion")) {
|
|
23
|
+
ext.kotlinVersion()
|
|
24
|
+
} else {
|
|
25
|
+
ext.safeExtGet("kotlinVersion", "1.6.10")
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
repositories {
|
|
15
30
|
mavenCentral()
|
|
16
31
|
}
|
|
17
32
|
|
|
18
33
|
dependencies {
|
|
19
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${
|
|
34
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
20
35
|
}
|
|
21
36
|
}
|
|
22
37
|
|
|
23
|
-
|
|
24
38
|
// Creating sources with comments
|
|
25
39
|
task androidSourcesJar(type: Jar) {
|
|
26
40
|
classifier = 'sources'
|
|
@@ -45,34 +59,36 @@ afterEvaluate {
|
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
android {
|
|
48
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
62
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 31)
|
|
49
63
|
|
|
50
64
|
compileOptions {
|
|
51
|
-
sourceCompatibility JavaVersion.
|
|
52
|
-
targetCompatibility JavaVersion.
|
|
65
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
66
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
kotlinOptions {
|
|
70
|
+
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
53
71
|
}
|
|
54
72
|
|
|
55
73
|
defaultConfig {
|
|
56
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
57
|
-
targetSdkVersion safeExtGet("targetSdkVersion",
|
|
75
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
58
76
|
versionCode 22
|
|
59
|
-
versionName "
|
|
77
|
+
versionName "13.1.0"
|
|
60
78
|
}
|
|
61
79
|
lintOptions {
|
|
62
80
|
abortOnError false
|
|
63
81
|
}
|
|
64
|
-
kotlinOptions {
|
|
65
|
-
jvmTarget = JavaVersion.VERSION_1_8
|
|
66
|
-
}
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
dependencies {
|
|
70
85
|
implementation project(':expo-modules-core')
|
|
71
86
|
|
|
72
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${
|
|
87
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
73
88
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3")
|
|
74
89
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1")
|
|
75
|
-
|
|
90
|
+
implementation "com.github.CanHub:Android-Image-Cropper:1.1.1"
|
|
91
|
+
implementation "androidx.exifinterface:exifinterface:1.3.3"
|
|
76
92
|
api "androidx.legacy:legacy-support-v4:1.0.0"
|
|
77
93
|
api 'commons-codec:commons-codec:1.10'
|
|
78
94
|
api 'commons-io:commons-io:2.6'
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<application>
|
|
12
12
|
<activity
|
|
13
|
-
android:name="com.
|
|
13
|
+
android:name="com.canhub.cropper.CropImageActivity"
|
|
14
14
|
android:theme="@style/Base.Theme.AppCompat"/>
|
|
15
15
|
<!-- https://developer.android.com/guide/topics/manifest/provider-element.html -->
|
|
16
16
|
<provider
|
|
@@ -26,6 +26,8 @@ object ImagePickerConstants {
|
|
|
26
26
|
const val COROUTINE_CANCELED = "Coroutine canceled by module destruction."
|
|
27
27
|
const val PROMISES_CANCELED = "Module destroyed, all promises canceled."
|
|
28
28
|
const val UNKNOWN_EXCEPTION = "Unknown exception."
|
|
29
|
+
const val ERR_CROPPING_FAILURE = "ERR_CROPPING_FAILURE"
|
|
30
|
+
const val CROPPING_FAILURE_MESSAGE = "Cropping operation failed"
|
|
29
31
|
|
|
30
32
|
const val OPTION_QUALITY = "quality"
|
|
31
33
|
const val OPTION_ALLOWS_EDITING = "allowsEditing"
|
|
@@ -10,7 +10,7 @@ import android.net.Uri
|
|
|
10
10
|
import android.os.Bundle
|
|
11
11
|
import android.provider.MediaStore
|
|
12
12
|
import android.util.Log
|
|
13
|
-
import com.
|
|
13
|
+
import com.canhub.cropper.CropImage
|
|
14
14
|
import expo.modules.core.ExportedModule
|
|
15
15
|
import expo.modules.core.ModuleRegistry
|
|
16
16
|
import expo.modules.core.ModuleRegistryDelegate
|
|
@@ -356,7 +356,11 @@ class ImagePickerModule(
|
|
|
356
356
|
val contentResolver = activity.application.contentResolver
|
|
357
357
|
|
|
358
358
|
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
|
|
359
|
-
val result = CropImage.getActivityResult(intent)
|
|
359
|
+
val result = CropImage.getActivityResult(intent).ifNull {
|
|
360
|
+
promise.reject(ImagePickerConstants.ERR_CROPPING_FAILURE, ImagePickerConstants.CROPPING_FAILURE_MESSAGE)
|
|
361
|
+
return
|
|
362
|
+
}
|
|
363
|
+
|
|
360
364
|
val exporter = CropImageExporter(result.rotation, result.cropRect, pickerOptions.isBase64)
|
|
361
365
|
ImageResultTask(
|
|
362
366
|
promise,
|
|
@@ -9,6 +9,7 @@ import androidx.core.content.FileProvider
|
|
|
9
9
|
import androidx.exifinterface.media.ExifInterface
|
|
10
10
|
import expo.modules.core.utilities.FileUtilities.generateOutputPath
|
|
11
11
|
import expo.modules.core.utilities.ifNull
|
|
12
|
+
import expo.modules.imagepicker.ImagePickerConstants.TAG
|
|
12
13
|
import java.io.File
|
|
13
14
|
import java.io.IOException
|
|
14
15
|
|
|
@@ -80,7 +81,11 @@ class ExifDataHandler(private val uri: Uri) {
|
|
|
80
81
|
newExif.setAttribute(exifTag, value)
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
+
try {
|
|
85
|
+
newExif.saveAttributes()
|
|
86
|
+
} catch (e: IOException) {
|
|
87
|
+
Log.w(TAG, "Couldn't save Exif data: ${e.message}", e)
|
|
88
|
+
}
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExponentImagePicker.d.ts","sourceRoot":"","sources":["../src/ExponentImagePicker.ts"],"names":[],"mappings":";AACA,wBAAsD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExponentImagePicker.web.d.ts","sourceRoot":"","sources":["../src/ExponentImagePicker.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA8B,MAAM,mBAAmB,CAAC;AAGnF,OAAO,EAGL,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;;;;;;;QAiBvB,QAAQ,iBAAiB,GAAG,yBAAyB,CAAC;;;;;QAgBtD,QAAQ,iBAAiB,GAAG,yBAAyB,CAAC;;;gDA2BR,OAAO;oDAGH,OAAO,GAAG,QAAQ,kBAAkB,CAAC;;AAvD7F,wBA0DE"}
|
package/build/ImagePicker.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PermissionStatus, PermissionExpiration, PermissionHookOptions } from 'expo-modules-core';
|
|
1
|
+
import { PermissionStatus, PermissionExpiration, PermissionHookOptions, PermissionResponse } from 'expo-modules-core';
|
|
2
2
|
import { CameraPermissionResponse, CameraRollPermissionResponse, MediaLibraryPermissionResponse, ImagePickerResult, ImagePickerErrorResult, MediaTypeOptions, ImagePickerOptions, VideoExportPreset, ExpandImagePickerResult, ImageInfo, ImagePickerMultipleResult, ImagePickerCancelledResult, OpenFileBrowserOptions, UIImagePickerControllerQualityType, UIImagePickerPresentationStyle } from './ImagePicker.types';
|
|
3
3
|
/**
|
|
4
4
|
* Checks user's permissions for accessing camera.
|
|
5
|
-
* @return A promise that fulfills with an object of type [CameraPermissionResponse](#
|
|
5
|
+
* @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerarollpermissionresponse).
|
|
6
6
|
*/
|
|
7
7
|
export declare function getCameraPermissionsAsync(): Promise<CameraPermissionResponse>;
|
|
8
8
|
/**
|
|
@@ -12,13 +12,13 @@ export declare function getCameraRollPermissionsAsync(): Promise<MediaLibraryPer
|
|
|
12
12
|
/**
|
|
13
13
|
* Checks user's permissions for accessing photos.
|
|
14
14
|
* @param writeOnly Whether to request write or read and write permissions. Defaults to `false`
|
|
15
|
-
* @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#
|
|
15
|
+
* @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).
|
|
16
16
|
*/
|
|
17
17
|
export declare function getMediaLibraryPermissionsAsync(writeOnly?: boolean): Promise<MediaLibraryPermissionResponse>;
|
|
18
18
|
/**
|
|
19
19
|
* Asks the user to grant permissions for accessing camera. This does nothing on web because the
|
|
20
20
|
* browser camera is not used.
|
|
21
|
-
* @return A promise that fulfills with an object of type [CameraPermissionResponse](#
|
|
21
|
+
* @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerarollpermissionresponse).
|
|
22
22
|
*/
|
|
23
23
|
export declare function requestCameraPermissionsAsync(): Promise<CameraPermissionResponse>;
|
|
24
24
|
/**
|
|
@@ -28,7 +28,7 @@ export declare function requestCameraRollPermissionsAsync(): Promise<MediaLibrar
|
|
|
28
28
|
/**
|
|
29
29
|
* Asks the user to grant permissions for accessing user's photo. This method does nothing on web.
|
|
30
30
|
* @param writeOnly Whether to request write or read and write permissions. Defaults to `false`
|
|
31
|
-
* @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#
|
|
31
|
+
* @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).
|
|
32
32
|
*/
|
|
33
33
|
export declare function requestMediaLibraryPermissionsAsync(writeOnly?: boolean): Promise<MediaLibraryPermissionResponse>;
|
|
34
34
|
/**
|
|
@@ -52,7 +52,7 @@ export declare const useMediaLibraryPermissions: (options?: PermissionHookOption
|
|
|
52
52
|
* const [status, requestPermission] = ImagePicker.useCameraPermissions();
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export declare const useCameraPermissions: (options?: PermissionHookOptions<object> | undefined) => [
|
|
55
|
+
export declare const useCameraPermissions: (options?: PermissionHookOptions<object> | undefined) => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>];
|
|
56
56
|
/**
|
|
57
57
|
* Android system sometimes kills the `MainActivity` after the `ImagePicker` finishes. When this
|
|
58
58
|
* happens, we lost the data selected from the `ImagePicker`. However, you can retrieve the lost
|
|
@@ -102,4 +102,5 @@ export declare function launchCameraAsync(options?: ImagePickerOptions): Promise
|
|
|
102
102
|
* when the item is a video, this method returns `{ cancelled: false, type: 'video', uri, width, height, duration }`.
|
|
103
103
|
*/
|
|
104
104
|
export declare function launchImageLibraryAsync<T extends ImagePickerOptions>(options?: T): Promise<ExpandImagePickerResult<T>>;
|
|
105
|
-
export { MediaTypeOptions, ImagePickerOptions, ImagePickerResult, ImagePickerErrorResult, VideoExportPreset, CameraPermissionResponse, CameraRollPermissionResponse, MediaLibraryPermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions, ImageInfo, ImagePickerMultipleResult, ImagePickerCancelledResult, OpenFileBrowserOptions, ExpandImagePickerResult, UIImagePickerControllerQualityType, UIImagePickerPresentationStyle, };
|
|
105
|
+
export { MediaTypeOptions, ImagePickerOptions, ImagePickerResult, ImagePickerErrorResult, VideoExportPreset, CameraPermissionResponse, CameraRollPermissionResponse, MediaLibraryPermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions, PermissionResponse, ImageInfo, ImagePickerMultipleResult, ImagePickerCancelledResult, OpenFileBrowserOptions, ExpandImagePickerResult, UIImagePickerControllerQualityType, UIImagePickerPresentationStyle, };
|
|
106
|
+
//# sourceMappingURL=ImagePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImagePicker.d.ts","sourceRoot":"","sources":["../src/ImagePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAInB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,8BAA8B,EAC9B,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,SAAS,EACT,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,kCAAkC,EAClC,8BAA8B,EAC/B,MAAM,qBAAqB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,EACT,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,kCAAkC,EAClC,8BAA8B,GAC/B,CAAC"}
|
package/build/ImagePicker.js
CHANGED
|
@@ -20,7 +20,7 @@ function validateOptions(options) {
|
|
|
20
20
|
// @needsAudit
|
|
21
21
|
/**
|
|
22
22
|
* Checks user's permissions for accessing camera.
|
|
23
|
-
* @return A promise that fulfills with an object of type [CameraPermissionResponse](#
|
|
23
|
+
* @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerarollpermissionresponse).
|
|
24
24
|
*/
|
|
25
25
|
export async function getCameraPermissionsAsync() {
|
|
26
26
|
return ExponentImagePicker.getCameraPermissionsAsync();
|
|
@@ -36,17 +36,16 @@ export async function getCameraRollPermissionsAsync() {
|
|
|
36
36
|
/**
|
|
37
37
|
* Checks user's permissions for accessing photos.
|
|
38
38
|
* @param writeOnly Whether to request write or read and write permissions. Defaults to `false`
|
|
39
|
-
* @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#
|
|
39
|
+
* @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).
|
|
40
40
|
*/
|
|
41
41
|
export async function getMediaLibraryPermissionsAsync(writeOnly = false) {
|
|
42
|
-
|
|
43
|
-
return imagePickerMethod(writeOnly);
|
|
42
|
+
return ExponentImagePicker.getMediaLibraryPermissionsAsync(writeOnly);
|
|
44
43
|
}
|
|
45
44
|
// @needsAudit
|
|
46
45
|
/**
|
|
47
46
|
* Asks the user to grant permissions for accessing camera. This does nothing on web because the
|
|
48
47
|
* browser camera is not used.
|
|
49
|
-
* @return A promise that fulfills with an object of type [CameraPermissionResponse](#
|
|
48
|
+
* @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerarollpermissionresponse).
|
|
50
49
|
*/
|
|
51
50
|
export async function requestCameraPermissionsAsync() {
|
|
52
51
|
return ExponentImagePicker.requestCameraPermissionsAsync();
|
|
@@ -62,7 +61,7 @@ export async function requestCameraRollPermissionsAsync() {
|
|
|
62
61
|
/**
|
|
63
62
|
* Asks the user to grant permissions for accessing user's photo. This method does nothing on web.
|
|
64
63
|
* @param writeOnly Whether to request write or read and write permissions. Defaults to `false`
|
|
65
|
-
* @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#
|
|
64
|
+
* @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).
|
|
66
65
|
*/
|
|
67
66
|
export async function requestMediaLibraryPermissionsAsync(writeOnly = false) {
|
|
68
67
|
const imagePickerMethod = ExponentImagePicker.requestMediaLibraryPermissionsAsync;
|
package/build/ImagePicker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePicker.js","sourceRoot":"","sources":["../src/ImagePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAML,gBAAgB,EAEhB,iBAAiB,EAMjB,kCAAkC,EAClC,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAE7B,SAAS,eAAe,CAAC,OAA2B;IAClD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAEtD,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC;QAEtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACpB,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,+BAA+B,CAAC,IAAI,CAAC,6BAA6B,CACnE,CAAC;SACH;KACF;IAED,IAAI,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,EAAE;QAC3C,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB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kC,EAClC,8BAA8B,GAC/B,CAAC","sourcesContent":["import {\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n createPermissionHook,\n UnavailabilityError,\n CodedError,\n} from 'expo-modules-core';\n\nimport ExponentImagePicker from './ExponentImagePicker';\nimport {\n CameraPermissionResponse,\n CameraRollPermissionResponse,\n MediaLibraryPermissionResponse,\n ImagePickerResult,\n ImagePickerErrorResult,\n MediaTypeOptions,\n ImagePickerOptions,\n VideoExportPreset,\n ExpandImagePickerResult,\n ImageInfo,\n ImagePickerMultipleResult,\n ImagePickerCancelledResult,\n OpenFileBrowserOptions,\n UIImagePickerControllerQualityType,\n UIImagePickerPresentationStyle,\n} from './ImagePicker.types';\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](#imagepickercamerapermissionresponse).\n */\nexport async function getCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.getCameraPermissionsAsync();\n}\n\n/**\n * @deprecated Use `getMediaLibraryPermissionsAsync()` instead.\n */\nexport async function getCameraRollPermissionsAsync(): Promise<MediaLibraryPermissionResponse> {\n console.warn(\n 'ImagePicker.getCameraRollPermissionsAsync() is deprecated in favour of ImagePicker.getMediaLibraryPermissionsAsync()'\n );\n return getMediaLibraryPermissionsAsync();\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](#imagepickercamerarollpermissionresponse).\n */\nexport async function getMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n const imagePickerMethod = ExponentImagePicker.getMediaLibraryPermissionsAsync;\n return imagePickerMethod(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](#imagepickercamerapermissionresponse).\n */\nexport async function requestCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.requestCameraPermissionsAsync();\n}\n\n/**\n * @deprecated Use `requestMediaLibraryPermissionsAsync()` instead.\n */\nexport async function requestCameraRollPermissionsAsync(): Promise<MediaLibraryPermissionResponse> {\n console.warn(\n 'ImagePicker.requestCameraRollPermissionsAsync() is deprecated in favour of ImagePicker.requestMediaLibraryPermissionsAsync()'\n );\n return requestMediaLibraryPermissionsAsync();\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](#imagepickercamerarollpermissionresponse).\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 lost the data selected from 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 array of objects of exactly same type as in\n * `ImagePicker.launchImageLibraryAsync` or `ImagePicker.launchCameraAsync` if the `ImagePicker`\n * finished successfully. Otherwise, to the array of [`ImagePickerErrorResult`](#imagepickerimagepickererrorresult).\n * - **On other platforms:** an empty array.\n */\nexport async function getPendingResultAsync(): Promise<\n (ImagePickerResult | ImagePickerErrorResult)[]\n> {\n if (ExponentImagePicker.getPendingResultAsync) {\n return ExponentImagePicker.getPendingResultAsync();\n }\n return [];\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 bloc\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 If the user cancelled the action, the method returns `{ cancelled: true }`. Otherwise,\n * this method returns information about the selected media item. When the chosen item is an image,\n * this method returns `{ cancelled: false, type: 'image', uri, width, height, exif, base64 }`;\n * when the item is a video, this method returns `{ cancelled: false, type: 'video', uri, width, height, duration }`.\n */\nexport async function launchCameraAsync(\n options: ImagePickerOptions = {}\n): Promise<ImagePickerResult> {\n if (!ExponentImagePicker.launchCameraAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchCameraAsync');\n }\n return await ExponentImagePicker.launchCameraAsync(validateOptions(options));\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 * **Animated GIFs support** If the selected image is an animated GIF, the result image will be an\n * animated GIF too if and only if `quality` is set to `undefined` 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 — GIF).\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 If the user cancelled the action, the method returns `{ cancelled: true }`. Otherwise,\n * this method returns information about the selected media item. When the chosen item is an image,\n * this method returns `{ cancelled: false, type: 'image', uri, width, height, exif, base64 }`;\n * when the item is a video, this method returns `{ cancelled: false, type: 'video', uri, width, height, duration }`.\n */\nexport async function launchImageLibraryAsync<T extends ImagePickerOptions>(\n options?: T\n): Promise<ExpandImagePickerResult<T>> {\n if (!ExponentImagePicker.launchImageLibraryAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchImageLibraryAsync');\n }\n return await ExponentImagePicker.launchImageLibraryAsync(options ?? {});\n}\n\nexport {\n MediaTypeOptions,\n ImagePickerOptions,\n ImagePickerResult,\n ImagePickerErrorResult,\n VideoExportPreset,\n CameraPermissionResponse,\n CameraRollPermissionResponse,\n MediaLibraryPermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n ImageInfo,\n ImagePickerMultipleResult,\n ImagePickerCancelledResult,\n OpenFileBrowserOptions,\n ExpandImagePickerResult,\n UIImagePickerControllerQualityType,\n UIImagePickerPresentationStyle,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ImagePicker.js","sourceRoot":"","sources":["../src/ImagePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAIhB,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAML,gBAAgB,EAEhB,iBAAiB,EAMjB,kCAAkC,EAClC,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAE7B,SAAS,eAAe,CAAC,OAA2B;IAClD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAEtD,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC;QAEtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACpB,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,+BAA+B,CAAC,IAAI,CAAC,6BAA6B,CACnE,CAAC;SACH;KACF;IAED,IAAI,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,EAAE;QAC3C,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,2BAA2B,OAAO,oCAAoC,C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\n PermissionHookOptions,\n PermissionResponse,\n createPermissionHook,\n UnavailabilityError,\n CodedError,\n} from 'expo-modules-core';\n\nimport ExponentImagePicker from './ExponentImagePicker';\nimport {\n CameraPermissionResponse,\n CameraRollPermissionResponse,\n MediaLibraryPermissionResponse,\n ImagePickerResult,\n ImagePickerErrorResult,\n MediaTypeOptions,\n ImagePickerOptions,\n VideoExportPreset,\n ExpandImagePickerResult,\n ImageInfo,\n ImagePickerMultipleResult,\n ImagePickerCancelledResult,\n OpenFileBrowserOptions,\n UIImagePickerControllerQualityType,\n UIImagePickerPresentationStyle,\n} from './ImagePicker.types';\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](#camerarollpermissionresponse).\n */\nexport async function getCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.getCameraPermissionsAsync();\n}\n\n/**\n * @deprecated Use `getMediaLibraryPermissionsAsync()` instead.\n */\nexport async function getCameraRollPermissionsAsync(): Promise<MediaLibraryPermissionResponse> {\n console.warn(\n 'ImagePicker.getCameraRollPermissionsAsync() is deprecated in favour of ImagePicker.getMediaLibraryPermissionsAsync()'\n );\n return getMediaLibraryPermissionsAsync();\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/**\n * @deprecated Use `requestMediaLibraryPermissionsAsync()` instead.\n */\nexport async function requestCameraRollPermissionsAsync(): Promise<MediaLibraryPermissionResponse> {\n console.warn(\n 'ImagePicker.requestCameraRollPermissionsAsync() is deprecated in favour of ImagePicker.requestMediaLibraryPermissionsAsync()'\n );\n return requestMediaLibraryPermissionsAsync();\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 lost the data selected from 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 array of objects of exactly same type as in\n * `ImagePicker.launchImageLibraryAsync` or `ImagePicker.launchCameraAsync` if the `ImagePicker`\n * finished successfully. Otherwise, to the array of [`ImagePickerErrorResult`](#imagepickerimagepickererrorresult).\n * - **On other platforms:** an empty array.\n */\nexport async function getPendingResultAsync(): Promise<\n (ImagePickerResult | ImagePickerErrorResult)[]\n> {\n if (ExponentImagePicker.getPendingResultAsync) {\n return ExponentImagePicker.getPendingResultAsync();\n }\n return [];\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 bloc\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 If the user cancelled the action, the method returns `{ cancelled: true }`. Otherwise,\n * this method returns information about the selected media item. When the chosen item is an image,\n * this method returns `{ cancelled: false, type: 'image', uri, width, height, exif, base64 }`;\n * when the item is a video, this method returns `{ cancelled: false, type: 'video', uri, width, height, duration }`.\n */\nexport async function launchCameraAsync(\n options: ImagePickerOptions = {}\n): Promise<ImagePickerResult> {\n if (!ExponentImagePicker.launchCameraAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchCameraAsync');\n }\n return await ExponentImagePicker.launchCameraAsync(validateOptions(options));\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 * **Animated GIFs support** If the selected image is an animated GIF, the result image will be an\n * animated GIF too if and only if `quality` is set to `undefined` 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 — GIF).\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 If the user cancelled the action, the method returns `{ cancelled: true }`. Otherwise,\n * this method returns information about the selected media item. When the chosen item is an image,\n * this method returns `{ cancelled: false, type: 'image', uri, width, height, exif, base64 }`;\n * when the item is a video, this method returns `{ cancelled: false, type: 'video', uri, width, height, duration }`.\n */\nexport async function launchImageLibraryAsync<T extends ImagePickerOptions>(\n options?: T\n): Promise<ExpandImagePickerResult<T>> {\n if (!ExponentImagePicker.launchImageLibraryAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchImageLibraryAsync');\n }\n return await ExponentImagePicker.launchImageLibraryAsync(options ?? {});\n}\n\nexport {\n MediaTypeOptions,\n ImagePickerOptions,\n ImagePickerResult,\n ImagePickerErrorResult,\n VideoExportPreset,\n CameraPermissionResponse,\n CameraRollPermissionResponse,\n MediaLibraryPermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n PermissionResponse,\n ImageInfo,\n ImagePickerMultipleResult,\n ImagePickerCancelledResult,\n OpenFileBrowserOptions,\n ExpandImagePickerResult,\n UIImagePickerControllerQualityType,\n UIImagePickerPresentationStyle,\n};\n"]}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { PermissionResponse } from 'expo-modules-core';
|
|
2
2
|
/**
|
|
3
|
-
* Alias for `PermissionResponse` type exported by `
|
|
3
|
+
* Alias for `PermissionResponse` type exported by `expo-modules-core`.
|
|
4
4
|
*/
|
|
5
5
|
export declare type CameraPermissionResponse = PermissionResponse;
|
|
6
6
|
/**
|
|
7
|
-
* Extends
|
|
8
|
-
* `unimodules-permission-interface` and contains additional iOS-specific field.
|
|
7
|
+
* Extends `PermissionResponse` type exported by `expo-modules-core` and contains additional iOS-specific field.
|
|
9
8
|
*/
|
|
10
|
-
export declare type MediaLibraryPermissionResponse =
|
|
9
|
+
export declare type MediaLibraryPermissionResponse = PermissionResponse & {
|
|
11
10
|
/**
|
|
12
11
|
* @platform ios
|
|
13
12
|
*/
|
|
@@ -15,7 +14,7 @@ export declare type MediaLibraryPermissionResponse = CameraPermissionResponse &
|
|
|
15
14
|
};
|
|
16
15
|
/**
|
|
17
16
|
* An alias for the `MediaLibraryPermissionResponse` object.
|
|
18
|
-
* @deprecated Use `ImagePicker.MediaLibraryPermissionResponse`
|
|
17
|
+
* @deprecated Use `ImagePicker.MediaLibraryPermissionResponse` instead.
|
|
19
18
|
*/
|
|
20
19
|
export declare type CameraRollPermissionResponse = MediaLibraryPermissionResponse;
|
|
21
20
|
export declare enum MediaTypeOptions {
|
|
@@ -126,16 +125,79 @@ export declare enum UIImagePickerControllerQualityType {
|
|
|
126
125
|
*/
|
|
127
126
|
IFrame960x540 = 5
|
|
128
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Picker presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).
|
|
130
|
+
*
|
|
131
|
+
* @platform ios
|
|
132
|
+
*/
|
|
129
133
|
export declare enum UIImagePickerPresentationStyle {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
/**
|
|
135
|
+
* A presentation style in which the presented picker covers the screen.
|
|
136
|
+
*/
|
|
137
|
+
FULL_SCREEN = "fullScreen",
|
|
138
|
+
/**
|
|
139
|
+
* A presentation style that partially covers the underlying content.
|
|
140
|
+
*/
|
|
141
|
+
PAGE_SHEET = "pageSheet",
|
|
142
|
+
/**
|
|
143
|
+
* A presentation style that displays the picker centered in the screen.
|
|
144
|
+
*/
|
|
145
|
+
FORM_SHEET = "formSheet",
|
|
146
|
+
/**
|
|
147
|
+
* A presentation style where the picker is displayed over the app's content.
|
|
148
|
+
*/
|
|
149
|
+
CURRENT_CONTEXT = "currentContext",
|
|
150
|
+
/**
|
|
151
|
+
* A presentation style in which the picker view covers the screen.
|
|
152
|
+
*/
|
|
153
|
+
OVER_FULL_SCREEN = "overFullScreen",
|
|
154
|
+
/**
|
|
155
|
+
* A presentation style where the picker is displayed over the app's content.
|
|
156
|
+
*/
|
|
157
|
+
OVER_CURRENT_CONTEXT = "overCurrentContext",
|
|
158
|
+
/**
|
|
159
|
+
* A presentation style where the picker is displayed in a popover view.
|
|
160
|
+
*/
|
|
161
|
+
POPOVER = "popover",
|
|
162
|
+
/**
|
|
163
|
+
* The default presentation style chosen by the system.
|
|
164
|
+
* On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.
|
|
165
|
+
*
|
|
166
|
+
* @platform ios 13+
|
|
167
|
+
*/
|
|
168
|
+
AUTOMATIC = "automatic",
|
|
169
|
+
/**
|
|
170
|
+
* @deprecated Use `UIImagePickerPresentationStyle.FULL_SCREEN` instead.
|
|
171
|
+
*/
|
|
172
|
+
FullScreen = "fullScreen",
|
|
173
|
+
/**
|
|
174
|
+
* @deprecated Use `UIImagePickerPresentationStyle.PAGE_SHEET` instead.
|
|
175
|
+
*/
|
|
176
|
+
PageSheet = "pageSheet",
|
|
177
|
+
/**
|
|
178
|
+
* @deprecated Use `UIImagePickerPresentationStyle.FORM_SHEET` instead.
|
|
179
|
+
*/
|
|
180
|
+
FormSheet = "formSheet",
|
|
181
|
+
/**
|
|
182
|
+
* @deprecated Use `UIImagePickerPresentationStyle.CURRENT_CONTEXT` instead.
|
|
183
|
+
*/
|
|
184
|
+
CurrentContext = "currentContext",
|
|
185
|
+
/**
|
|
186
|
+
* @deprecated Use `UIImagePickerPresentationStyle.OVER_FULL_SCREEN` instead.
|
|
187
|
+
*/
|
|
188
|
+
OverFullScreen = "overFullScreen",
|
|
189
|
+
/**
|
|
190
|
+
* @deprecated Use `UIImagePickerPresentationStyle.OVER_CURRENT_CONTEXT` instead.
|
|
191
|
+
*/
|
|
192
|
+
OverCurrentContext = "overCurrentContext",
|
|
193
|
+
/**
|
|
194
|
+
* @deprecated Use `UIImagePickerPresentationStyle.POPOVER` instead.
|
|
195
|
+
*/
|
|
196
|
+
Popover = "popover",
|
|
197
|
+
/**
|
|
198
|
+
* @deprecated Use `UIImagePickerPresentationStyle.AUTOMATIC` instead.
|
|
199
|
+
*/
|
|
200
|
+
Automatic = "automatic"
|
|
139
201
|
}
|
|
140
202
|
export declare type ImageInfo = {
|
|
141
203
|
/**
|
|
@@ -246,12 +308,13 @@ export declare type ImagePickerOptions = {
|
|
|
246
308
|
* Specify preset which will be used to compress selected video.
|
|
247
309
|
* @default ImagePicker.VideoExportPreset.Passthrough
|
|
248
310
|
* @platform ios 11+
|
|
249
|
-
* @deprecated
|
|
311
|
+
* @deprecated See [`videoExportPreset`](https://developer.apple.com/documentation/uikit/uiimagepickercontroller/2890964-videoexportpreset?language=objc)
|
|
312
|
+
* in Apple documentation.
|
|
250
313
|
*/
|
|
251
314
|
videoExportPreset?: VideoExportPreset;
|
|
252
315
|
/**
|
|
253
|
-
* Specify the quality of recorded videos. Defaults to
|
|
254
|
-
*
|
|
316
|
+
* Specify the quality of recorded videos. Defaults to the highest quality available for the device.
|
|
317
|
+
* @default ImagePicker.UIImagePickerControllerQualityType.High
|
|
255
318
|
* @platform ios
|
|
256
319
|
*/
|
|
257
320
|
videoQuality?: UIImagePickerControllerQualityType;
|
|
@@ -297,3 +360,4 @@ export declare type OpenFileBrowserOptions = {
|
|
|
297
360
|
export declare type ExpandImagePickerResult<T extends ImagePickerOptions | OpenFileBrowserOptions> = T extends {
|
|
298
361
|
allowsMultipleSelection: true;
|
|
299
362
|
} ? ImagePickerMultipleResult : ImagePickerResult;
|
|
363
|
+
//# sourceMappingURL=ImagePicker.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImagePicker.types.d.ts","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;GAEG;AACH,oBAAY,wBAAwB,GAAG,kBAAkB,CAAC;AAG1D;;GAEG;AACH,oBAAY,8BAA8B,GAAG,kBAAkB,GAAG;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;CAC/C,CAAC;AAGF;;;GAGG;AACH,oBAAY,4BAA4B,GAAG,8BAA8B,CAAC;AAG1E,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,MAAM,WAAW;CAClB;AAGD,oBAAY,iBAAiB;IAC3B;;;;OAIG;IACH,WAAW,IAAI;IACf;;;;OAIG;IACH,UAAU,IAAI;IACd;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