expo-image-picker 14.2.0 → 14.3.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 CHANGED
@@ -10,6 +10,18 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 14.3.0 — 2023-06-13
14
+
15
+ ### 🎉 New features
16
+
17
+ - Added ability to choose the preferred asset representation mode on iOS 14+. ([#22456](https://github.com/expo/expo/pull/22456) by [@thespacemanatee](https://github.com/thespacemanatee))
18
+ - Updated the Android image picker to use a [more streamlined and modern interface](https://developer.android.com/training/data-storage/shared/photopicker), closely resembling the one on iOS. [#22658](https://github.com/expo/expo/pull/22658) by [@fobos531](https://github.com/fobos531)
19
+
20
+ ### 🐛 Bug fixes
21
+
22
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
23
+ - Fixed an issue that allowed picking non-image/video files when passing `MediaTypeOptions.All` ([#22606](https://github.com/expo/expo/pull/22606) by [@fobos531](https://github.com/fobos531))
24
+
13
25
  ## 14.2.0 — 2023-05-08
14
26
 
15
27
  ### 🎉 New features
@@ -22,6 +34,7 @@
22
34
  - Fix issue where the array of permissions could end up empty causing an exception. ([#21589](https://github.com/expo/expo/pull/21589) by [@alanhughes](https://github.com/alanjhughes))
23
35
  - Fix rotated videos returning incorrect width/height. [#12573](https://github.com/expo/expo/issues/12573) ([#21758](https://github.com/expo/expo/pull/21758) by [@mmmulani](https://github.com/mmmulani))
24
36
  - Fix NullPointerException for launchCameraAsync on Android 13. ([#22123](https://github.com/expo/expo/pull/22123) by [@witheroux](https://github.com/witheroux))
37
+ - [Android] Fix image picker returning inverted dimensions when selecting vertical images without editing. ([#22383](https://github.com/expo/expo/pull/22383) by [@behenate](https://github.com/behenate))
25
38
 
26
39
  ## 14.1.1 — 2023-02-09
27
40
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '14.2.0'
6
+ version = '14.3.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -35,19 +35,11 @@ buildscript {
35
35
  }
36
36
  }
37
37
 
38
- // Creating sources with comments
39
- task androidSourcesJar(type: Jar) {
40
- classifier = 'sources'
41
- from android.sourceSets.main.java.srcDirs
42
- }
43
-
44
38
  afterEvaluate {
45
39
  publishing {
46
40
  publications {
47
41
  release(MavenPublication) {
48
42
  from components.release
49
- // Add additional sourcesJar to artifacts
50
- artifact(androidSourcesJar)
51
43
  }
52
44
  }
53
45
  repositories {
@@ -70,21 +62,27 @@ android {
70
62
  jvmTarget = JavaVersion.VERSION_11.majorVersion
71
63
  }
72
64
 
65
+ namespace "expo.modules.imagepicker"
73
66
  defaultConfig {
74
67
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
69
  versionCode 22
77
- versionName "14.2.0"
70
+ versionName "14.3.0"
78
71
  }
79
72
  lintOptions {
80
73
  abortOnError false
81
74
  }
75
+ publishing {
76
+ singleVariant("release") {
77
+ withSourcesJar()
78
+ }
79
+ }
82
80
  }
83
81
 
84
82
  dependencies {
85
83
  implementation project(':expo-modules-core')
86
84
 
87
- implementation "androidx.activity:activity-ktx:1.4.0"
85
+ implementation "androidx.activity:activity-ktx:1.7.1"
88
86
  implementation "androidx.appcompat:appcompat:1.4.2"
89
87
  implementation "androidx.exifinterface:exifinterface:1.3.3"
90
88
  implementation "com.github.CanHub:Android-Image-Cropper:4.3.0"
@@ -1,6 +1,5 @@
1
- <manifest package="expo.modules.imagepicker"
2
- xmlns:android="http://schemas.android.com/apk/res/android"
3
- >
1
+ <manifest xmlns:tools="http://schemas.android.com/tools"
2
+ xmlns:android="http://schemas.android.com/apk/res/android">
4
3
  <!-- Required for picking images from camera directly -->
5
4
  <uses-permission android:name="android.permission.CAMERA"/>
6
5
 
@@ -11,6 +10,18 @@
11
10
  <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
12
11
 
13
12
  <application>
13
+ <!-- Trigger Google Play services to install the backported photo picker module. -->
14
+ <service android:name="com.google.android.gms.metadata.ModuleDependencies"
15
+ android:enabled="false"
16
+ android:exported="false"
17
+ tools:ignore="MissingClass">
18
+ <intent-filter>
19
+ <action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
20
+ </intent-filter>
21
+ <meta-data android:name="photopicker_activity:0:required" android:value="" />
22
+ </service>
23
+
24
+
14
25
  <activity
15
26
  android:name="com.canhub.cropper.CropImageActivity"
16
27
  android:theme="@style/Base.Theme.AppCompat"/>
@@ -11,6 +11,8 @@ import expo.modules.kotlin.records.Field
11
11
  import expo.modules.kotlin.records.Record
12
12
  import expo.modules.kotlin.types.Enumerable
13
13
 
14
+ internal const val UNLIMITED_SELECTION: Int = 0
15
+
14
16
  internal class ImagePickerOptions : Record, Serializable {
15
17
  @Field
16
18
  var allowsEditing: Boolean = false
@@ -22,6 +24,10 @@ internal class ImagePickerOptions : Record, Serializable {
22
24
  @FloatRange(from = 0.0, to = 1.0)
23
25
  var quality: Double = 0.2
24
26
 
27
+ @Field
28
+ @IntRange(from = 0)
29
+ var selectionLimit: Int = UNLIMITED_SELECTION
30
+
25
31
  @Field
26
32
  var base64: Boolean = false
27
33
 
@@ -5,7 +5,12 @@ import android.content.ContentResolver
5
5
  import android.content.Context
6
6
  import android.content.Intent
7
7
  import android.net.Uri
8
+ import androidx.activity.result.PickVisualMediaRequest
9
+ import androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia
10
+ import androidx.activity.result.contract.ActivityResultContracts.PickMultipleVisualMedia
8
11
  import expo.modules.imagepicker.ImagePickerOptions
12
+ import expo.modules.imagepicker.MediaTypes
13
+ import expo.modules.imagepicker.UNLIMITED_SELECTION
9
14
  import expo.modules.imagepicker.getAllDataUris
10
15
  import expo.modules.imagepicker.toMediaType
11
16
  import expo.modules.kotlin.activityresult.AppContextActivityResultContract
@@ -27,16 +32,44 @@ internal class ImageLibraryContract(
27
32
  "React Application Context is null"
28
33
  }.contentResolver
29
34
 
30
- override fun createIntent(context: Context, input: ImageLibraryContractOptions) =
31
- Intent(Intent.ACTION_GET_CONTENT)
32
- .addCategory(Intent.CATEGORY_OPENABLE)
33
- .setType(input.options.mediaTypes.toMimeType())
34
- .apply {
35
- if (input.options.allowsMultipleSelection) {
36
- putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
35
+ override fun createIntent(context: Context, input: ImageLibraryContractOptions): Intent {
36
+ val request = PickVisualMediaRequest.Builder()
37
+ .setMediaType(
38
+ when (input.options.mediaTypes) {
39
+ MediaTypes.VIDEOS -> {
40
+ PickVisualMedia.VideoOnly
41
+ }
42
+ MediaTypes.IMAGES -> {
43
+ PickVisualMedia.ImageOnly
44
+ }
45
+ else -> {
46
+ PickVisualMedia.ImageAndVideo
47
+ }
37
48
  }
49
+ ).build()
50
+
51
+ if (input.options.allowsMultipleSelection) {
52
+ val selectionLimit = input.options.selectionLimit
53
+
54
+ if (selectionLimit == 1) {
55
+ // If multiple selection is allowed but the limit is 1, we should ignore
56
+ // the multiple selection flag and just treat it as a single selection.
57
+ return PickVisualMedia().createIntent(context, request)
58
+ }
59
+
60
+ if (selectionLimit > 1) {
61
+ return PickMultipleVisualMedia(selectionLimit).createIntent(context, request)
38
62
  }
39
63
 
64
+ // If the selection limit is 0, it is the same as unlimited selection.
65
+ if (selectionLimit == UNLIMITED_SELECTION) {
66
+ return PickMultipleVisualMedia().createIntent(context, request)
67
+ }
68
+ }
69
+
70
+ return PickVisualMedia().createIntent(context, request)
71
+ }
72
+
40
73
  override fun parseResult(input: ImageLibraryContractOptions, resultCode: Int, intent: Intent?) =
41
74
  if (resultCode == Activity.RESULT_CANCELED) {
42
75
  ImagePickerContractResult.Cancelled()
@@ -2,6 +2,7 @@ package expo.modules.imagepicker.exporters
2
2
 
3
3
  import android.content.ContentResolver
4
4
  import android.graphics.BitmapFactory
5
+ import android.media.ExifInterface
5
6
  import android.net.Uri
6
7
  import expo.modules.imagepicker.copyFile
7
8
  import java.io.File
@@ -13,13 +14,21 @@ class RawImageExporter : ImageExporter {
13
14
  contentResolver: ContentResolver,
14
15
  ): ImageExportResult {
15
16
  copyFile(source, output, contentResolver)
16
-
17
+ val exifInterface = ExifInterface(output.absolutePath)
18
+ val imageRotation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0)
19
+ val isRotatedLandscape = (imageRotation == ExifInterface.ORIENTATION_ROTATE_90 || imageRotation == ExifInterface.ORIENTATION_ROTATE_270)
17
20
  val options = BitmapFactory.Options().apply { inJustDecodeBounds = true }
21
+
18
22
  BitmapFactory.decodeFile(output.absolutePath, options)
19
23
 
24
+ // Image will be rotated to orientation suggested by the exif data, because of that the width and height
25
+ // returned by the picker should be switched if the image is rotated 90 or 270 degrees.
26
+ val width: Int = if (isRotatedLandscape) options.outHeight else options.outWidth
27
+ val height: Int = if (isRotatedLandscape) options.outWidth else options.outHeight
28
+
20
29
  return ImageExportResult(
21
- options.outWidth,
22
- options.outHeight,
30
+ width,
31
+ height,
23
32
  output,
24
33
  )
25
34
  }
@@ -162,6 +162,25 @@ export declare enum UIImagePickerPresentationStyle {
162
162
  */
163
163
  AUTOMATIC = "automatic"
164
164
  }
165
+ /**
166
+ * Picker preferred asset representation mode. Its values are directly mapped to the [`PHPickerConfigurationAssetRepresentationMode`](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode).
167
+ *
168
+ * @platform ios
169
+ */
170
+ export declare enum UIImagePickerPreferredAssetRepresentationMode {
171
+ /**
172
+ * A mode that indicates that the system chooses the appropriate asset representation.
173
+ */
174
+ Automatic = "automatic",
175
+ /**
176
+ * A mode that uses the most compatible asset representation.
177
+ */
178
+ Compatible = "compatible",
179
+ /**
180
+ * A mode that uses the current representation to avoid transcoding, if possible.
181
+ */
182
+ Current = "current"
183
+ }
165
184
  export declare enum CameraType {
166
185
  /**
167
186
  * Back/rear camera.
@@ -377,6 +396,7 @@ export type ImagePickerOptions = {
377
396
  * Setting the value to `0` sets the selection limit to the maximum that the system supports.
378
397
  *
379
398
  * @platform ios 14+
399
+ * @platform android
380
400
  * @default 0
381
401
  */
382
402
  selectionLimit?: number;
@@ -416,6 +436,13 @@ export type ImagePickerOptions = {
416
436
  * @platform android
417
437
  */
418
438
  cameraType?: CameraType;
439
+ /**
440
+ * Choose [preferred asset representation mode](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode)
441
+ * to use when loading assets.
442
+ * @default ImagePicker.UIImagePickerPreferredAssetRepresentationMode.Automatic
443
+ * @platform ios 14+
444
+ */
445
+ preferredAssetRepresentationMode?: UIImagePickerPreferredAssetRepresentationMode;
419
446
  };
420
447
  export type OpenFileBrowserOptions = {
421
448
  /**
@@ -1 +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,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAG1D;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,kBAAkB,GAAG;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;CAC/C,CAAC;AAGF,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;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,YA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C;IACjC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,kBAAkB,GAAG,sBAAsB,IACvF,CAAC,SAAS;IACR,uBAAuB,EAAE,IAAI,CAAC;CAC/B,GACG,iBAAiB,GACjB,iBAAiB,CAAC"}
@@ -155,6 +155,26 @@ export var UIImagePickerPresentationStyle;
155
155
  */
156
156
  UIImagePickerPresentationStyle["AUTOMATIC"] = "automatic";
157
157
  })(UIImagePickerPresentationStyle || (UIImagePickerPresentationStyle = {}));
158
+ /**
159
+ * Picker preferred asset representation mode. Its values are directly mapped to the [`PHPickerConfigurationAssetRepresentationMode`](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode).
160
+ *
161
+ * @platform ios
162
+ */
163
+ export var UIImagePickerPreferredAssetRepresentationMode;
164
+ (function (UIImagePickerPreferredAssetRepresentationMode) {
165
+ /**
166
+ * A mode that indicates that the system chooses the appropriate asset representation.
167
+ */
168
+ UIImagePickerPreferredAssetRepresentationMode["Automatic"] = "automatic";
169
+ /**
170
+ * A mode that uses the most compatible asset representation.
171
+ */
172
+ UIImagePickerPreferredAssetRepresentationMode["Compatible"] = "compatible";
173
+ /**
174
+ * A mode that uses the current representation to avoid transcoding, if possible.
175
+ */
176
+ UIImagePickerPreferredAssetRepresentationMode["Current"] = "current";
177
+ })(UIImagePickerPreferredAssetRepresentationMode || (UIImagePickerPreferredAssetRepresentationMode = {}));
158
178
  export var CameraType;
159
179
  (function (CameraType) {
160
180
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ImagePicker.types.js","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAmBA,cAAc;AACd,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,+BAAW,CAAA;IACX;;OAEG;IACH,qCAAiB,CAAA;IACjB;;OAEG;IACH,qCAAiB,CAAA;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ED,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 { 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 * @platform ios\n */\n accessPrivileges?: 'all' | 'limited' | 'none';\n};\n\n// @needsAudit\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// @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 13+\n */\n AUTOMATIC = 'automatic',\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 ios\n * @platform android\n */\n assetId?: string | null;\n /**\n * Width of the image or video.\n */\n width: number;\n /**\n * Height of the image or video.\n */\n height: number;\n /**\n * The type of the asset.\n */\n type?: 'image' | 'video';\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 * @platform ios\n */\n fileName?: string | null;\n /**\n * File size of the picked image or video, in bytes.\n *\n * @platform ios\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 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\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// @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 ios\n * @platform android\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 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 0.2\n * @platform ios\n * @platform android\n */\n quality?: number;\n /**\n * Choose what type of media to pick.\n * @default ImagePicker.MediaTypeOptions.Images\n */\n mediaTypes?: 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 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 ios 14+\n * @platform android\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 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 * 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 * @default CameraType.back\n * @platform ios\n * @platform android\n */\n cameraType?: CameraType;\n};\n\n// @needsAudit\nexport type OpenFileBrowserOptions = {\n /**\n * Choose what type of media to pick.\n * @default ImagePicker.MediaTypeOptions.Images\n */\n mediaTypes: MediaTypeOptions;\n // @docsMissing\n capture?: boolean;\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 {\n allowsMultipleSelection: true;\n }\n ? ImagePickerResult\n : ImagePickerResult;\n"]}
1
+ {"version":3,"file":"ImagePicker.types.js","sourceRoot":"","sources":["../src/ImagePicker.types.ts"],"names":[],"mappings":"AAmBA,cAAc;AACd,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;AAED,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,CAA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QASrB","sourcesContent":["import { 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 * @platform ios\n */\n accessPrivileges?: 'all' | 'limited' | 'none';\n};\n\n// @needsAudit\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// @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 13+\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 ios\n * @platform android\n */\n assetId?: string | null;\n /**\n * Width of the image or video.\n */\n width: number;\n /**\n * Height of the image or video.\n */\n height: number;\n /**\n * The type of the asset.\n */\n type?: 'image' | 'video';\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 * @platform ios\n */\n fileName?: string | null;\n /**\n * File size of the picked image or video, in bytes.\n *\n * @platform ios\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 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\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// @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 ios\n * @platform android\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 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 0.2\n * @platform ios\n * @platform android\n */\n quality?: number;\n /**\n * Choose what type of media to pick.\n * @default ImagePicker.MediaTypeOptions.Images\n */\n mediaTypes?: 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 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 ios 14+\n * @platform android\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 ios 14+\n * @platform android\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 * 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 * @default CameraType.back\n * @platform ios\n * @platform android\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\n// @needsAudit\nexport type OpenFileBrowserOptions = {\n /**\n * Choose what type of media to pick.\n * @default ImagePicker.MediaTypeOptions.Images\n */\n mediaTypes: MediaTypeOptions;\n // @docsMissing\n capture?: boolean;\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 {\n allowsMultipleSelection: true;\n }\n ? ImagePickerResult\n : ImagePickerResult;\n"]}
@@ -142,6 +142,9 @@ public class ImagePickerModule: Module, OnMediaPickingResultHandler {
142
142
  // selection limit = 1 --> single selection, reflects the old picker behavior
143
143
  configuration.selectionLimit = options.allowsMultipleSelection ? options.selectionLimit : SINGLE_SELECTION
144
144
  configuration.filter = options.mediaTypes.toPickerFilter()
145
+ if #available(iOS 14, *) {
146
+ configuration.preferredAssetRepresentationMode = options.preferredAssetRepresentationMode.toAssetRepresentationMode()
147
+ }
145
148
  if #available(iOS 15, *) {
146
149
  configuration.selection = options.orderedSelection ? .ordered : .default
147
150
  }
@@ -41,6 +41,9 @@ internal struct ImagePickerOptions: Record {
41
41
  @Field
42
42
  var presentationStyle: PresentationStyle = .automatic
43
43
 
44
+ @Field
45
+ var preferredAssetRepresentationMode: PreferredAssetRepresentationMode = .automatic
46
+
44
47
  @Field
45
48
  var cameraType: CameraType = .back
46
49
 
@@ -93,6 +96,24 @@ internal enum PresentationStyle: String, EnumArgument {
93
96
  }
94
97
  }
95
98
 
99
+ internal enum PreferredAssetRepresentationMode: String, EnumArgument {
100
+ case automatic
101
+ case compatible
102
+ case current
103
+
104
+ @available(iOS 14.0, *)
105
+ func toAssetRepresentationMode() -> PHPickerConfiguration.AssetRepresentationMode {
106
+ switch self {
107
+ case .automatic:
108
+ return .automatic
109
+ case .compatible:
110
+ return .compatible
111
+ case .current:
112
+ return .current
113
+ }
114
+ }
115
+ }
116
+
96
117
  internal enum VideoQuality: Int, EnumArgument {
97
118
  case typeHigh = 0
98
119
  case typeMedium = 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-image-picker",
3
- "version": "14.2.0",
3
+ "version": "14.3.0",
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",
@@ -36,7 +36,7 @@
36
36
  "preset": "expo-module-scripts"
37
37
  },
38
38
  "dependencies": {
39
- "expo-image-loader": "~4.2.0"
39
+ "expo-image-loader": "~4.3.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "expo-module-scripts": "^3.0.0"
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "expo": "*"
46
46
  },
47
- "gitHead": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
47
+ "gitHead": "3ccd2edee9cbfed217557675cb50f0ba5e55a9e4"
48
48
  }
@@ -174,6 +174,26 @@ export enum UIImagePickerPresentationStyle {
174
174
  AUTOMATIC = 'automatic',
175
175
  }
176
176
 
177
+ /**
178
+ * Picker preferred asset representation mode. Its values are directly mapped to the [`PHPickerConfigurationAssetRepresentationMode`](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode).
179
+ *
180
+ * @platform ios
181
+ */
182
+ export enum UIImagePickerPreferredAssetRepresentationMode {
183
+ /**
184
+ * A mode that indicates that the system chooses the appropriate asset representation.
185
+ */
186
+ Automatic = 'automatic',
187
+ /**
188
+ * A mode that uses the most compatible asset representation.
189
+ */
190
+ Compatible = 'compatible',
191
+ /**
192
+ * A mode that uses the current representation to avoid transcoding, if possible.
193
+ */
194
+ Current = 'current',
195
+ }
196
+
177
197
  export enum CameraType {
178
198
  /**
179
199
  * Back/rear camera.
@@ -401,6 +421,7 @@ export type ImagePickerOptions = {
401
421
  * Setting the value to `0` sets the selection limit to the maximum that the system supports.
402
422
  *
403
423
  * @platform ios 14+
424
+ * @platform android
404
425
  * @default 0
405
426
  */
406
427
  selectionLimit?: number;
@@ -440,6 +461,13 @@ export type ImagePickerOptions = {
440
461
  * @platform android
441
462
  */
442
463
  cameraType?: CameraType;
464
+ /**
465
+ * Choose [preferred asset representation mode](https://developer.apple.com/documentation/photokit/phpickerconfigurationassetrepresentationmode)
466
+ * to use when loading assets.
467
+ * @default ImagePicker.UIImagePickerPreferredAssetRepresentationMode.Automatic
468
+ * @platform ios 14+
469
+ */
470
+ preferredAssetRepresentationMode?: UIImagePickerPreferredAssetRepresentationMode;
443
471
  };
444
472
 
445
473
  // @needsAudit