expo-image-picker 14.1.0 → 14.2.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,25 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 14.2.0 — 2023-05-08
14
+
15
+ ### 🎉 New features
16
+
17
+ - Added ability to choose the camera-facing type. ([#22143](https://github.com/expo/expo/pull/22143) by [@YoussefHenna](https://github.com/YoussefHenna))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fix images unexpectedly being converted to `.png` when opening `.bmp` files and selecting any quality in `ImagePickerOptions`. ([#21361](https://github.com/expo/expo/pull/21361) by [@behenate](https://github.com/behenate))
22
+ - 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
+ - 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
+ - Fix NullPointerException for launchCameraAsync on Android 13. ([#22123](https://github.com/expo/expo/pull/22123) by [@witheroux](https://github.com/witheroux))
25
+
26
+ ## 14.1.1 — 2023-02-09
27
+
28
+ ### ⚠️ Notices
29
+
30
+ - Removed deprecated fields from pick result type and deprecated `UIImagePickerPresentationStyle` enum values. ([#21078](https://github.com/expo/expo/pull/21078) by [@Simek](https://github.com/Simek))
31
+
13
32
  ## 14.1.0 — 2023-01-26
14
33
 
15
34
  ### 🎉 New features
package/README.md CHANGED
@@ -1,4 +1,11 @@
1
- # expo-image-picker
1
+ <p>
2
+ <a href="https://docs.expo.dev/versions/latest/sdk/imagepicker/">
3
+ <img
4
+ src="../../.github/resources/expo-image-picker.svg"
5
+ alt="expo-image-picker"
6
+ height="64" />
7
+ </a>
8
+ </p>
2
9
 
3
10
  Provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.
4
11
 
@@ -9,7 +16,7 @@ Provides access to the system's UI for selecting images and videos from the phon
9
16
 
10
17
  # Installation in managed Expo projects
11
18
 
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/).
19
+ For [managed](https://docs.expo.dev/archive/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
20
 
14
21
  # Installation in bare React Native projects
15
22
 
@@ -18,7 +25,7 @@ For bare React Native projects, you must ensure that you have [installed and con
18
25
  ### Add the package to your npm dependencies
19
26
 
20
27
  ```
21
- expo install expo-image-picker
28
+ npx expo install expo-image-picker
22
29
  ```
23
30
 
24
31
  ### Configure for iOS
@@ -55,7 +62,7 @@ This package automatically adds the `CAMERA`, `READ_EXTERNAL_STORAGE`, and `WRIT
55
62
 
56
63
  > This plugin is applied automatically in EAS Build, only add the config plugin if you want to pass in extra properties.
57
64
 
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`:
65
+ After installing this npm package, add the [config plugin](https://docs.expo.dev/home/config-plugins/introduction) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:
59
66
 
60
67
  ```json
61
68
  {
@@ -65,7 +72,7 @@ After installing this npm package, add the [config plugin](https://docs.expo.io/
65
72
  }
66
73
  ```
67
74
 
68
- Next, rebuild your app as described in the ["Adding custom native code"](https://docs.expo.io/workflow/customizing/) guide.
75
+ Next, rebuild your app as described in the ["Adding custom native code"](https://docs.expo.dev/workflow/customizing/) guide.
69
76
 
70
77
  ### API
71
78
 
@@ -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.1.0'
6
+ version = '14.2.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -22,7 +22,7 @@ buildscript {
22
22
  if (ext.has("kotlinVersion")) {
23
23
  ext.kotlinVersion()
24
24
  } else {
25
- ext.safeExtGet("kotlinVersion", "1.6.10")
25
+ ext.safeExtGet("kotlinVersion", "1.8.10")
26
26
  }
27
27
  }
28
28
 
@@ -74,7 +74,7 @@ android {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
75
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
76
  versionCode 22
77
- versionName "14.1.0"
77
+ versionName "14.2.0"
78
78
  }
79
79
  lintOptions {
80
80
  abortOnError false
@@ -176,8 +176,8 @@ class ImagePickerModule : Module() {
176
176
  private fun getMediaLibraryPermissions(writeOnly: Boolean): Array<String> =
177
177
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
178
178
  listOfNotNull(
179
- READ_MEDIA_IMAGES.takeIf { !writeOnly },
180
- READ_MEDIA_VIDEO.takeIf { !writeOnly }
179
+ READ_MEDIA_IMAGES,
180
+ READ_MEDIA_VIDEO
181
181
  ).toTypedArray()
182
182
  } else {
183
183
  listOfNotNull(
@@ -213,8 +213,10 @@ class ImagePickerModule : Module() {
213
213
  continuation.resumeWithException(UserRejectedPermissionsException())
214
214
  }
215
215
  },
216
- Manifest.permission.WRITE_EXTERNAL_STORAGE.takeIf { Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU },
217
- Manifest.permission.CAMERA
216
+ *listOfNotNull(
217
+ Manifest.permission.WRITE_EXTERNAL_STORAGE.takeIf { Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU },
218
+ Manifest.permission.CAMERA
219
+ ).toTypedArray()
218
220
  )
219
221
  }
220
222
 
@@ -37,6 +37,9 @@ internal class ImagePickerOptions : Record, Serializable {
37
37
  @Field
38
38
  var aspect: Pair<Int, Int>? = null
39
39
 
40
+ @Field
41
+ var cameraType: CameraType = CameraType.BACK
42
+
40
43
  fun toCameraContractOptions(uri: Uri) = CameraContractOptions(uri, this)
41
44
 
42
45
  fun toImageLibraryContractOptions() = ImageLibraryContractOptions(this)
@@ -78,3 +81,8 @@ internal enum class MediaTypes(val value: String) : Enumerable {
78
81
  const val AllMimeType = "*/*"
79
82
  }
80
83
  }
84
+
85
+ internal enum class CameraType(val value: String) : Enumerable {
86
+ BACK("back"),
87
+ FRONT("front"),
88
+ }
@@ -8,6 +8,7 @@ import android.net.Uri
8
8
  import android.provider.MediaStore
9
9
  import androidx.activity.result.contract.ActivityResultContract
10
10
  import expo.modules.imagepicker.ImagePickerOptions
11
+ import expo.modules.imagepicker.CameraType
11
12
  import expo.modules.imagepicker.toMediaType
12
13
  import expo.modules.kotlin.activityresult.AppContextActivityResultContract
13
14
  import expo.modules.kotlin.providers.AppContextProvider
@@ -34,6 +35,15 @@ internal class CameraContract(
34
35
  if (input.options.mediaTypes.toCameraIntentAction() == MediaStore.ACTION_VIDEO_CAPTURE) {
35
36
  putExtra(MediaStore.EXTRA_DURATION_LIMIT, input.options.videoMaxDuration)
36
37
  }
38
+ if (input.options.cameraType == CameraType.FRONT) {
39
+ putExtra("android.intent.extras.LENS_FACING_FRONT", 1)
40
+ putExtra("android.intent.extras.CAMERA_FACING", 1)
41
+ putExtra("android.intent.extra.USE_FRONT_CAMERA", true)
42
+ } else {
43
+ putExtra("android.intent.extras.LENS_FACING_BACK", 1)
44
+ putExtra("android.intent.extras.CAMERA_FACING", 0)
45
+ putExtra("android.intent.extra.USE_FRONT_CAMERA", false)
46
+ }
37
47
  }
38
48
 
39
49
  override fun parseResult(input: CameraContractOptions, resultCode: Int, intent: Intent?): ImagePickerContractResult =
@@ -1,5 +1,5 @@
1
1
  import { PermissionStatus, PermissionExpiration, PermissionHookOptions, PermissionResponse } from 'expo-modules-core';
2
- import { CameraPermissionResponse, MediaLibraryPermissionResponse, ImagePickerResult, ImagePickerAsset, ImagePickerErrorResult, MediaTypeOptions, ImagePickerOptions, VideoExportPreset, ExpandImagePickerResult, ImageInfo, ImagePickerMultipleResult, ImagePickerCancelledResult, OpenFileBrowserOptions, UIImagePickerControllerQualityType, UIImagePickerPresentationStyle } from './ImagePicker.types';
2
+ import { CameraPermissionResponse, MediaLibraryPermissionResponse, ImagePickerResult, ImagePickerErrorResult, ImagePickerOptions } from './ImagePicker.types';
3
3
  /**
4
4
  * Checks user's permissions for accessing camera.
5
5
  * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerapermissionresponse).
@@ -94,9 +94,6 @@ export declare function launchCameraAsync(options?: ImagePickerOptions): Promise
94
94
  * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).
95
95
  */
96
96
  export declare function launchImageLibraryAsync(options?: ImagePickerOptions): Promise<ImagePickerResult>;
97
- export { MediaTypeOptions, ImagePickerOptions, ImagePickerResult, ImagePickerErrorResult, ImagePickerAsset, VideoExportPreset, CameraPermissionResponse, MediaLibraryPermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions, PermissionResponse, ImageInfo, // deprecated
98
- ImagePickerMultipleResult, // deprecated
99
- ImagePickerCancelledResult, // deprecated
100
- OpenFileBrowserOptions, ExpandImagePickerResult, // deprecated
101
- UIImagePickerControllerQualityType, UIImagePickerPresentationStyle, };
97
+ export * from './ImagePicker.types';
98
+ export { PermissionStatus, PermissionExpiration, PermissionHookOptions, PermissionResponse };
102
99
  //# sourceMappingURL=ImagePicker.d.ts.map
@@ -1 +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,8BAA8B,EAC9B,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EACh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a5B;AAED,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { PermissionStatus, createPermissionHook, UnavailabilityError, CodedError, } from 'expo-modules-core';
2
2
  import ExponentImagePicker from './ExponentImagePicker';
3
- import { MediaTypeOptions, VideoExportPreset, UIImagePickerControllerQualityType, UIImagePickerPresentationStyle, } from './ImagePicker.types';
4
3
  function validateOptions(options) {
5
4
  const { aspect, quality, videoMaxDuration } = options;
6
5
  if (aspect != null) {
@@ -187,6 +186,6 @@ export async function launchImageLibraryAsync(options) {
187
186
  const result = await ExponentImagePicker.launchImageLibraryAsync(options ?? {});
188
187
  return mergeDeprecatedResult(result);
189
188
  }
190
- export { MediaTypeOptions, VideoExportPreset, PermissionStatus, // deprecated
191
- UIImagePickerControllerQualityType, UIImagePickerPresentationStyle, };
189
+ export * from './ImagePicker.types';
190
+ export { PermissionStatus };
192
191
  //# sourceMappingURL=ImagePicker.js.map
@@ -1 +1 @@
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,IAA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AAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAA8B,EAAE;IAEhC,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,EAAE;QAC1C,MAAM,IAAI,mBAAmB,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;KACnE;IACD,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,iBAAiB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IACrF,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAA4B;IAE5B,IAAI,CAAC,mBAAmB,CAAC,uBAAuB,EAAE;QAChD,MAAM,IAAI,mBAAmB,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC;KACzE;IACD,IAAI,OAAO,EAAE,aAAa,IAAI,OAAO,CAAC,uBAAuB,EAAE;QAC7D,OAAO,CAAC,IAAI,CACV,qHAAqH;YACnH,2FAA2F;YAC3F,sBAAsB,CACzB,CAAC;KACH;IACD,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,uBAAuB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAChF,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,OAAO,EACL,gBAAgB,EAKhB,iBAAiB,EAGjB,gBAAgB,EAQS,aAAa;AACtC,kCAAkC,EAClC,8BAA8B,GAC/B,CAAC","sourcesContent":["import {\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n PermissionResponse,\n createPermissionHook,\n UnavailabilityError,\n CodedError,\n} from 'expo-modules-core';\n\nimport ExponentImagePicker from './ExponentImagePicker';\nimport {\n CameraPermissionResponse,\n MediaLibraryPermissionResponse,\n ImagePickerResult,\n ImagePickerAsset,\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\nconst DEPRECATED_RESULT_KEYS = [\n 'uri',\n 'assetId',\n 'width',\n 'height',\n 'type',\n 'exif',\n 'base64',\n 'duration',\n 'fileName',\n 'fileSize',\n];\nfunction mergeDeprecatedResult(result: ImagePickerResult): ImagePickerResult {\n const firstAsset = result?.assets?.[0];\n const deprecatedResult = {\n ...result,\n get cancelled() {\n console.warn(\n 'Key \"cancelled\" in the image picker result is deprecated and will be removed in SDK 48, use \"canceled\" instead'\n );\n return this.canceled;\n },\n };\n for (const key of DEPRECATED_RESULT_KEYS) {\n Object.defineProperty(deprecatedResult, key, {\n get() {\n console.warn(\n `Key \"${key}\" in the image picker result is deprecated and will be removed in SDK 48, you can access selected assets through the \"assets\" array instead`\n );\n return firstAsset?.[key];\n },\n });\n }\n return deprecatedResult;\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing camera.\n * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerapermissionresponse).\n */\nexport async function getCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.getCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing photos.\n * @param writeOnly Whether to request write or read and write permissions. Defaults to `false`\n * @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).\n */\nexport async function getMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n return ExponentImagePicker.getMediaLibraryPermissionsAsync(writeOnly);\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing camera. This does nothing on web because the\n * browser camera is not used.\n * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerarollpermissionresponse).\n */\nexport async function requestCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.requestCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing user's photo. This method does nothing on web.\n * @param writeOnly Whether to request write or read and write permissions. Defaults to `false`\n * @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).\n */\nexport async function requestMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n const imagePickerMethod = ExponentImagePicker.requestMediaLibraryPermissionsAsync;\n return imagePickerMethod(writeOnly);\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the media library.\n * This uses both `requestMediaLibraryPermissionsAsync` and `getMediaLibraryPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = ImagePicker.useMediaLibraryPermissions();\n * ```\n */\nexport const useMediaLibraryPermissions = createPermissionHook<\n MediaLibraryPermissionResponse,\n { writeOnly?: boolean }\n>({\n // TODO(cedric): permission requesters should have an options param or a different requester\n getMethod: (options) => getMediaLibraryPermissionsAsync(options?.writeOnly),\n requestMethod: (options) => requestMediaLibraryPermissionsAsync(options?.writeOnly),\n});\n\n// @needsAudit\n/**\n * Check or request permissions to access the camera.\n * This uses both `requestCameraPermissionsAsync` and `getCameraPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = ImagePicker.useCameraPermissions();\n * ```\n */\nexport const useCameraPermissions = createPermissionHook({\n getMethod: getCameraPermissionsAsync,\n requestMethod: requestCameraPermissionsAsync,\n});\n\n// @needsAudit\n/**\n * Android system sometimes kills the `MainActivity` after the `ImagePicker` finishes. When this\n * happens, we 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 block\n * the request without a warning.\n * > **Note:** Make sure that you handle `MainActivity` destruction on **Android**. See [ImagePicker.getPendingResultAsync](#imagepickergetpendingresultasync).\n * > **Notes for Web:** The system UI can only be shown after user activation (e.g. a `Button` press).\n * Therefore, calling `launchCameraAsync` in `componentDidMount`, for example, will **not** work as\n * intended. The `cancelled` event will not be returned in the browser due to platform restrictions\n * and inconsistencies across browsers.\n * @param options An `ImagePickerOptions` object.\n * @return A promise that resolves to an object with `canceled` and `assets` fields.\n * When the user canceled the action the `assets` is always `null`, otherwise it's an array of\n * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).\n */\nexport async function launchCameraAsync(\n options: ImagePickerOptions = {}\n): Promise<ImagePickerResult> {\n if (!ExponentImagePicker.launchCameraAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchCameraAsync');\n }\n const result = await ExponentImagePicker.launchCameraAsync(validateOptions(options));\n return mergeDeprecatedResult(result);\n}\n\n// @needsAudit\n/**\n * Display the system UI for choosing an image or a video from the phone's library.\n * Requires `Permissions.MEDIA_LIBRARY` on iOS 10 only. On mobile web, this must be called\n * immediately in a user interaction like a button press, otherwise the browser will block the\n * request without a warning.\n *\n * **Animated GIFs support:** On Android, if the selected image is an animated GIF, the result image will be an\n * animated GIF too if and only if `quality` is explicitly set to `1.0` and `allowsEditing` is set to `false`.\n * Otherwise compression and/or cropper will pick the first frame of the GIF and return it as the\n * result (on Android the result will be a PNG). On iOS, both quality and cropping are supported.\n *\n * > **Notes for Web:** The system UI can only be shown after user activation (e.g. a `Button` press).\n * Therefore, calling `launchImageLibraryAsync` in `componentDidMount`, for example, will **not**\n * work as intended. The `cancelled` event will not be returned in the browser due to platform\n * restrictions and inconsistencies across browsers.\n * @param options An object extended by [`ImagePickerOptions`](#imagepickeroptions).\n * @return A promise that resolves to an object with `canceled` and `assets` fields.\n * When the user canceled the action the `assets` is always `null`, otherwise it's an array of\n * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).\n */\nexport async function launchImageLibraryAsync(\n options?: ImagePickerOptions\n): Promise<ImagePickerResult> {\n if (!ExponentImagePicker.launchImageLibraryAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchImageLibraryAsync');\n }\n if (options?.allowsEditing && options.allowsMultipleSelection) {\n console.warn(\n '[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.' +\n \"Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' \" +\n 'to fix this warning.'\n );\n }\n const result = await ExponentImagePicker.launchImageLibraryAsync(options ?? {});\n return mergeDeprecatedResult(result);\n}\n\nexport {\n MediaTypeOptions,\n ImagePickerOptions,\n ImagePickerResult,\n ImagePickerErrorResult,\n ImagePickerAsset,\n VideoExportPreset,\n CameraPermissionResponse,\n MediaLibraryPermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n PermissionResponse,\n ImageInfo, // deprecated\n ImagePickerMultipleResult, // deprecated\n ImagePickerCancelledResult, // deprecated\n OpenFileBrowserOptions,\n ExpandImagePickerResult, // deprecated\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;AASxD,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,CACvE,CAAC;KACH;IAED,IAAI,gBAAgB,IAAI,gBAAgB,GAAG,CAAC,EAAE;QAC5C,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,oCAAoC,gBAAgB,kCAAkC,CACvF,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,sBAAsB,GAAG;IAC7B,KAAK;IACL,SAAS;IACT,OAAO;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CAAC,CAAC;KACzE;IACD,IAAI,OAAO,EAAE,aAAa,IAAI,OAAO,CAAC,uBAAuB,EAAE;QAC7D,OAAO,CAAC,IAAI,CACV,qHAAqH;YACnH,2FAA2F;YAC3F,sBAAsB,CACzB,CAAC;KACH;IACD,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,uBAAuB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAChF,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAmE,CAAC","sourcesContent":["import {\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n PermissionResponse,\n createPermissionHook,\n UnavailabilityError,\n CodedError,\n} from 'expo-modules-core';\n\nimport ExponentImagePicker from './ExponentImagePicker';\nimport {\n CameraPermissionResponse,\n MediaLibraryPermissionResponse,\n ImagePickerResult,\n ImagePickerErrorResult,\n ImagePickerOptions,\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\nconst DEPRECATED_RESULT_KEYS = [\n 'uri',\n 'assetId',\n 'width',\n 'height',\n 'type',\n 'exif',\n 'base64',\n 'duration',\n 'fileName',\n 'fileSize',\n];\nfunction mergeDeprecatedResult(result: ImagePickerResult): ImagePickerResult {\n const firstAsset = result?.assets?.[0];\n const deprecatedResult = {\n ...result,\n get cancelled() {\n console.warn(\n 'Key \"cancelled\" in the image picker result is deprecated and will be removed in SDK 48, use \"canceled\" instead'\n );\n return this.canceled;\n },\n };\n for (const key of DEPRECATED_RESULT_KEYS) {\n Object.defineProperty(deprecatedResult, key, {\n get() {\n console.warn(\n `Key \"${key}\" in the image picker result is deprecated and will be removed in SDK 48, you can access selected assets through the \"assets\" array instead`\n );\n return firstAsset?.[key];\n },\n });\n }\n return deprecatedResult;\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing camera.\n * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerapermissionresponse).\n */\nexport async function getCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.getCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Checks user's permissions for accessing photos.\n * @param writeOnly Whether to request write or read and write permissions. Defaults to `false`\n * @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).\n */\nexport async function getMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n return ExponentImagePicker.getMediaLibraryPermissionsAsync(writeOnly);\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing camera. This does nothing on web because the\n * browser camera is not used.\n * @return A promise that fulfills with an object of type [CameraPermissionResponse](#camerarollpermissionresponse).\n */\nexport async function requestCameraPermissionsAsync(): Promise<CameraPermissionResponse> {\n return ExponentImagePicker.requestCameraPermissionsAsync();\n}\n\n// @needsAudit\n/**\n * Asks the user to grant permissions for accessing user's photo. This method does nothing on web.\n * @param writeOnly Whether to request write or read and write permissions. Defaults to `false`\n * @return A promise that fulfills with an object of type [MediaLibraryPermissionResponse](#medialibrarypermissionresponse).\n */\nexport async function requestMediaLibraryPermissionsAsync(\n writeOnly: boolean = false\n): Promise<MediaLibraryPermissionResponse> {\n const imagePickerMethod = ExponentImagePicker.requestMediaLibraryPermissionsAsync;\n return imagePickerMethod(writeOnly);\n}\n\n// @needsAudit\n/**\n * Check or request permissions to access the media library.\n * This uses both `requestMediaLibraryPermissionsAsync` and `getMediaLibraryPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = ImagePicker.useMediaLibraryPermissions();\n * ```\n */\nexport const useMediaLibraryPermissions = createPermissionHook<\n MediaLibraryPermissionResponse,\n { writeOnly?: boolean }\n>({\n // TODO(cedric): permission requesters should have an options param or a different requester\n getMethod: (options) => getMediaLibraryPermissionsAsync(options?.writeOnly),\n requestMethod: (options) => requestMediaLibraryPermissionsAsync(options?.writeOnly),\n});\n\n// @needsAudit\n/**\n * Check or request permissions to access the camera.\n * This uses both `requestCameraPermissionsAsync` and `getCameraPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = ImagePicker.useCameraPermissions();\n * ```\n */\nexport const useCameraPermissions = createPermissionHook({\n getMethod: getCameraPermissionsAsync,\n requestMethod: requestCameraPermissionsAsync,\n});\n\n// @needsAudit\n/**\n * Android system sometimes kills the `MainActivity` after the `ImagePicker` finishes. When this\n * happens, we 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 block\n * the request without a warning.\n * > **Note:** Make sure that you handle `MainActivity` destruction on **Android**. See [ImagePicker.getPendingResultAsync](#imagepickergetpendingresultasync).\n * > **Notes for Web:** The system UI can only be shown after user activation (e.g. a `Button` press).\n * Therefore, calling `launchCameraAsync` in `componentDidMount`, for example, will **not** work as\n * intended. The `cancelled` event will not be returned in the browser due to platform restrictions\n * and inconsistencies across browsers.\n * @param options An `ImagePickerOptions` object.\n * @return A promise that resolves to an object with `canceled` and `assets` fields.\n * When the user canceled the action the `assets` is always `null`, otherwise it's an array of\n * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).\n */\nexport async function launchCameraAsync(\n options: ImagePickerOptions = {}\n): Promise<ImagePickerResult> {\n if (!ExponentImagePicker.launchCameraAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchCameraAsync');\n }\n const result = await ExponentImagePicker.launchCameraAsync(validateOptions(options));\n return mergeDeprecatedResult(result);\n}\n\n// @needsAudit\n/**\n * Display the system UI for choosing an image or a video from the phone's library.\n * Requires `Permissions.MEDIA_LIBRARY` on iOS 10 only. On mobile web, this must be called\n * immediately in a user interaction like a button press, otherwise the browser will block the\n * request without a warning.\n *\n * **Animated GIFs support:** On Android, if the selected image is an animated GIF, the result image will be an\n * animated GIF too if and only if `quality` is explicitly set to `1.0` and `allowsEditing` is set to `false`.\n * Otherwise compression and/or cropper will pick the first frame of the GIF and return it as the\n * result (on Android the result will be a PNG). On iOS, both quality and cropping are supported.\n *\n * > **Notes for Web:** The system UI can only be shown after user activation (e.g. a `Button` press).\n * Therefore, calling `launchImageLibraryAsync` in `componentDidMount`, for example, will **not**\n * work as intended. The `cancelled` event will not be returned in the browser due to platform\n * restrictions and inconsistencies across browsers.\n * @param options An object extended by [`ImagePickerOptions`](#imagepickeroptions).\n * @return A promise that resolves to an object with `canceled` and `assets` fields.\n * When the user canceled the action the `assets` is always `null`, otherwise it's an array of\n * the selected media assets which have a form of [`ImagePickerAsset`](#imagepickerasset).\n */\nexport async function launchImageLibraryAsync(\n options?: ImagePickerOptions\n): Promise<ImagePickerResult> {\n if (!ExponentImagePicker.launchImageLibraryAsync) {\n throw new UnavailabilityError('ImagePicker', 'launchImageLibraryAsync');\n }\n if (options?.allowsEditing && options.allowsMultipleSelection) {\n console.warn(\n '[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.' +\n \"Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' \" +\n 'to fix this warning.'\n );\n }\n const result = await ExponentImagePicker.launchImageLibraryAsync(options ?? {});\n return mergeDeprecatedResult(result);\n}\n\nexport * from './ImagePicker.types';\n\nexport { PermissionStatus, PermissionExpiration, PermissionHookOptions, PermissionResponse };\n"]}
@@ -4,7 +4,7 @@ import { PermissionResponse } from 'expo-modules-core';
4
4
  */
5
5
  export type CameraPermissionResponse = PermissionResponse;
6
6
  /**
7
- * Extends `PermissionResponse` type exported by `expo-modules-core` and contains additional iOS-specific field.
7
+ * Extends `PermissionResponse` type exported by `expo-modules-core`, containing additional iOS-specific field.
8
8
  */
9
9
  export type MediaLibraryPermissionResponse = PermissionResponse & {
10
10
  /**
@@ -160,39 +160,17 @@ export declare enum UIImagePickerPresentationStyle {
160
160
  *
161
161
  * @platform ios 13+
162
162
  */
163
- AUTOMATIC = "automatic",
164
- /**
165
- * @deprecated Use `UIImagePickerPresentationStyle.FULL_SCREEN` instead.
166
- */
167
- FullScreen = "fullScreen",
168
- /**
169
- * @deprecated Use `UIImagePickerPresentationStyle.PAGE_SHEET` instead.
170
- */
171
- PageSheet = "pageSheet",
172
- /**
173
- * @deprecated Use `UIImagePickerPresentationStyle.FORM_SHEET` instead.
174
- */
175
- FormSheet = "formSheet",
176
- /**
177
- * @deprecated Use `UIImagePickerPresentationStyle.CURRENT_CONTEXT` instead.
178
- */
179
- CurrentContext = "currentContext",
180
- /**
181
- * @deprecated Use `UIImagePickerPresentationStyle.OVER_FULL_SCREEN` instead.
182
- */
183
- OverFullScreen = "overFullScreen",
184
- /**
185
- * @deprecated Use `UIImagePickerPresentationStyle.OVER_CURRENT_CONTEXT` instead.
186
- */
187
- OverCurrentContext = "overCurrentContext",
163
+ AUTOMATIC = "automatic"
164
+ }
165
+ export declare enum CameraType {
188
166
  /**
189
- * @deprecated Use `UIImagePickerPresentationStyle.POPOVER` instead.
167
+ * Back/rear camera.
190
168
  */
191
- Popover = "popover",
169
+ back = "back",
192
170
  /**
193
- * @deprecated Use `UIImagePickerPresentationStyle.AUTOMATIC` instead.
171
+ * Front camera
194
172
  */
195
- Automatic = "automatic"
173
+ front = "front"
196
174
  }
197
175
  /**
198
176
  * @hidden
@@ -281,77 +259,34 @@ export type ImagePickerErrorResult = {
281
259
  */
282
260
  exception?: string;
283
261
  };
284
- export type ImagePickerResult = {
285
- /**
286
- * An array of picked assets or `null` when the request was canceled.
287
- */
288
- assets: ImagePickerAsset[] | null;
289
- /**
290
- * Boolean flag which shows if request was canceled. If asset data have been returned this should
291
- * always be `false`.
292
- */
293
- canceled: boolean;
294
- /**
295
- * @deprecated Use `canceled` instead.
296
- */
297
- cancelled?: boolean;
298
- /**
299
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
300
- */
301
- selected?: ImagePickerAsset[];
302
- /**
303
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
304
- */
305
- uri?: string;
306
- /**
307
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
308
- */
309
- assetId?: string | null;
310
- /**
311
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
312
- */
313
- width?: number;
314
- /**
315
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
316
- */
317
- height?: number;
318
- /**
319
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
320
- */
321
- type?: 'image' | 'video';
322
- /**
323
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
324
- */
325
- fileName?: string | null;
326
- /**
327
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
328
- */
329
- fileSize?: number;
330
- /**
331
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
332
- */
333
- exif?: Record<string, any> | null;
334
- /**
335
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
336
- */
337
- base64?: string | null;
338
- /**
339
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
340
- */
341
- duration?: number | null;
342
- } & (ImagePickerSuccessResult | ImagePickerCanceledResult);
343
262
  /**
344
- * @hidden
263
+ * Type representing successful and canceled pick result.
264
+ */
265
+ export type ImagePickerResult = ImagePickerSuccessResult | ImagePickerCanceledResult;
266
+ /**
267
+ * Type representing successful pick result.
345
268
  */
346
269
  export type ImagePickerSuccessResult = {
270
+ /**
271
+ * Boolean flag set to `false` showing that the request was successful.
272
+ */
347
273
  canceled: false;
274
+ /**
275
+ * An array of picked assets.
276
+ */
348
277
  assets: ImagePickerAsset[];
349
278
  };
350
279
  /**
351
- * @hidden
280
+ * Type representing canceled pick result.
352
281
  */
353
282
  export type ImagePickerCanceledResult = {
283
+ /**
284
+ * Boolean flag set to `true` showing that the request was canceled.
285
+ */
354
286
  canceled: true;
287
+ /**
288
+ * `null` signifying that the request was canceled.
289
+ */
355
290
  assets: null;
356
291
  };
357
292
  /**
@@ -369,8 +304,9 @@ export type ImagePickerOptions = {
369
304
  * Whether to show a UI to edit the image after it is picked. On Android the user can crop and
370
305
  * rotate the image and on iOS simply crop it.
371
306
  *
372
- * > Cropping multiple images is not supported - this option is mutually exclusive with `allowsMultipleSelection`.
373
- * > On iOS, this option is ignored if `allowsMultipleSelection` is enabled.
307
+ * > - Cropping multiple images is not supported - this option is mutually exclusive with `allowsMultipleSelection`.
308
+ * > - On iOS, this option is ignored if `allowsMultipleSelection` is enabled.
309
+ * > - On iOS cropping a `.bmp` image will convert it to `.png`.
374
310
  *
375
311
  * @default false
376
312
  * @platform ios
@@ -471,6 +407,15 @@ export type ImagePickerOptions = {
471
407
  * @platform ios
472
408
  */
473
409
  presentationStyle?: UIImagePickerPresentationStyle;
410
+ /**
411
+ * Selects the camera-facing type. The `CameraType` enum provides two options:
412
+ * `front` for the front-facing camera and `back` for the back-facing camera.
413
+ * - **On Android**, the behavior of this option may vary based on the camera app installed on the device.
414
+ * @default CameraType.back
415
+ * @platform ios
416
+ * @platform android
417
+ */
418
+ cameraType?: CameraType;
474
419
  };
475
420
  export type OpenFileBrowserOptions = {
476
421
  /**
@@ -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,YAAY,IAAI;IAChB;;;;OAIG;IACH,YAAY,IAAI;IAChB;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,IAAI;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;IACH,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;CACpD,CAAC;AAGF,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAE7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,uBAAuB,EAAE,OAAO,CAAC;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"}
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,YAAY,IAAI;IAChB;;;;OAIG;IACH,YAAY,IAAI;IAChB;;;;OAIG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;;;OAIG;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;IACH,YAAY,CAAC,EAAE,kCAAkC,CAAC;IAClD;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;IACnD;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAE7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,uBAAuB,EAAE,OAAO,CAAC;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"}
@@ -154,37 +154,16 @@ export var UIImagePickerPresentationStyle;
154
154
  * @platform ios 13+
155
155
  */
156
156
  UIImagePickerPresentationStyle["AUTOMATIC"] = "automatic";
157
+ })(UIImagePickerPresentationStyle || (UIImagePickerPresentationStyle = {}));
158
+ export var CameraType;
159
+ (function (CameraType) {
157
160
  /**
158
- * @deprecated Use `UIImagePickerPresentationStyle.FULL_SCREEN` instead.
159
- */
160
- UIImagePickerPresentationStyle["FullScreen"] = "fullScreen";
161
- /**
162
- * @deprecated Use `UIImagePickerPresentationStyle.PAGE_SHEET` instead.
163
- */
164
- UIImagePickerPresentationStyle["PageSheet"] = "pageSheet";
165
- /**
166
- * @deprecated Use `UIImagePickerPresentationStyle.FORM_SHEET` instead.
167
- */
168
- UIImagePickerPresentationStyle["FormSheet"] = "formSheet";
169
- /**
170
- * @deprecated Use `UIImagePickerPresentationStyle.CURRENT_CONTEXT` instead.
171
- */
172
- UIImagePickerPresentationStyle["CurrentContext"] = "currentContext";
173
- /**
174
- * @deprecated Use `UIImagePickerPresentationStyle.OVER_FULL_SCREEN` instead.
175
- */
176
- UIImagePickerPresentationStyle["OverFullScreen"] = "overFullScreen";
177
- /**
178
- * @deprecated Use `UIImagePickerPresentationStyle.OVER_CURRENT_CONTEXT` instead.
179
- */
180
- UIImagePickerPresentationStyle["OverCurrentContext"] = "overCurrentContext";
181
- /**
182
- * @deprecated Use `UIImagePickerPresentationStyle.POPOVER` instead.
161
+ * Back/rear camera.
183
162
  */
184
- UIImagePickerPresentationStyle["Popover"] = "popover";
163
+ CameraType["back"] = "back";
185
164
  /**
186
- * @deprecated Use `UIImagePickerPresentationStyle.AUTOMATIC` instead.
165
+ * Front camera
187
166
  */
188
- UIImagePickerPresentationStyle["Automatic"] = "automatic";
189
- })(UIImagePickerPresentationStyle || (UIImagePickerPresentationStyle = {}));
167
+ CameraType["front"] = "front";
168
+ })(CameraType || (CameraType = {}));
190
169
  //# sourceMappingURL=ImagePicker.types.js.map
@@ -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;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;IACj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,EApEW,8BAA8B,KAA9B,8BAA8B,QAoEzC","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` and contains 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 * @deprecated Use `UIImagePickerPresentationStyle.FULL_SCREEN` instead.\n */\n FullScreen = 'fullScreen',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.PAGE_SHEET` instead.\n */\n PageSheet = 'pageSheet',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.FORM_SHEET` instead.\n */\n FormSheet = 'formSheet',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.CURRENT_CONTEXT` instead.\n */\n CurrentContext = 'currentContext',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.OVER_FULL_SCREEN` instead.\n */\n OverFullScreen = 'overFullScreen',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.OVER_CURRENT_CONTEXT` instead.\n */\n OverCurrentContext = 'overCurrentContext',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.POPOVER` instead.\n */\n Popover = 'popover',\n /**\n * @deprecated Use `UIImagePickerPresentationStyle.AUTOMATIC` instead.\n */\n Automatic = 'automatic',\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\nexport type ImagePickerResult = {\n /**\n * An array of picked assets or `null` when the request was canceled.\n */\n assets: ImagePickerAsset[] | null;\n /**\n * Boolean flag which shows if request was canceled. If asset data have been returned this should\n * always be `false`.\n */\n canceled: boolean;\n /**\n * @deprecated Use `canceled` instead.\n */\n cancelled?: boolean;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n selected?: ImagePickerAsset[];\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n uri?: string;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n assetId?: string | null;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n width?: number;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n height?: number;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n type?: 'image' | 'video';\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n fileName?: string | null;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n fileSize?: number;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n exif?: Record<string, any> | null;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n base64?: string | null;\n /**\n * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.\n */\n duration?: number | null;\n} & (ImagePickerSuccessResult | ImagePickerCanceledResult);\n\n/**\n * @hidden\n */\nexport type ImagePickerSuccessResult = {\n canceled: false;\n assets: ImagePickerAsset[];\n};\n\n/**\n * @hidden\n */\nexport type ImagePickerCanceledResult = {\n canceled: true;\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 *\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\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,CAAA;IACjB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,6EAAkB,CAAA;IAClB;;;;OAIG;IACH,8EAAmB,CAAA;AACrB,CAAC,EAnEW,iBAAiB,KAAjB,iBAAiB,QAmE5B;AAED,cAAc;AACd,MAAM,CAAN,IAAY,kCAyBX;AAzBD,WAAY,kCAAkC;IAC5C;;OAEG;IACH,2FAAQ,CAAA;IACR;;OAEG;IACH,+FAAU,CAAA;IACV;;OAEG;IACH,yFAAO,CAAA;IACP;;OAEG;IACH,uGAAc,CAAA;IACd;;OAEG;IACH,+GAAkB,CAAA;IAClB;;OAEG;IACH,6GAAiB,CAAA;AACnB,CAAC,EAzBW,kCAAkC,KAAlC,kCAAkC,QAyB7C;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAoCX;AApCD,WAAY,8BAA8B;IACxC;;OAEG;IACH,4DAA0B,CAAA;IAC1B;;OAEG;IACH,0DAAwB,CAAA;IACxB;;OAEG;IACH,0DAAwB,CAAA;IACxB;;OAEG;IACH,oEAAkC,CAAA;IAClC;;OAEG;IACH,qEAAmC,CAAA;IACnC;;OAEG;IACH,6EAA2C,CAAA;IAC3C;;OAEG;IACH,qDAAmB,CAAA;IACnB;;;;;OAKG;IACH,yDAAuB,CAAA;AACzB,CAAC,EApCW,8BAA8B,KAA9B,8BAA8B,QAoCzC;AAED,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"]}
@@ -41,7 +41,6 @@ internal struct ImagePickerOptions: Record {
41
41
  @Field
42
42
  var presentationStyle: PresentationStyle = .automatic
43
43
 
44
- // TODO: (bbarthec): undocumented
45
44
  @Field
46
45
  var cameraType: CameraType = .back
47
46
 
@@ -85,7 +85,11 @@ internal struct MediaHandler {
85
85
  // as calling this already requires media library permission, we can access it here
86
86
  // if user gave limited permissions, in the worst case this will be null
87
87
  let asset = mediaInfo[.phAsset] as? PHAsset
88
- let fileName = asset?.value(forKey: "filename") as? String
88
+ var fileName = asset?.value(forKey: "filename") as? String
89
+ // Extension will change to png when editing BMP files, reflect that change in fileName
90
+ if let unwrappedName = fileName {
91
+ fileName = replaceFileExtension(fileName: unwrappedName, targetExtension: fileExtension.lowercased())
92
+ }
89
93
  let fileSize = getFileSize(from: targetUrl)
90
94
 
91
95
  let base64 = try ImageUtils.optionallyReadBase64From(imageData: imageData,
@@ -251,6 +255,22 @@ internal struct MediaHandler {
251
255
 
252
256
  // MARK: - utils
253
257
 
258
+ private func replaceFileExtension(fileName: String, targetExtension: String) -> String {
259
+ if !fileName.lowercased().hasSuffix(targetExtension.lowercased()) {
260
+ return deleteFileExtension(fileName: fileName) + targetExtension
261
+ }
262
+ return fileName
263
+ }
264
+
265
+ private func deleteFileExtension(fileName: String) -> String {
266
+ var components = fileName.components(separatedBy: ".")
267
+ guard components.count > 1 else {
268
+ return fileName
269
+ }
270
+ components.removeLast()
271
+ return components.joined(separator: ".")
272
+ }
273
+
254
274
  private func generateUrl(withFileExtension: String) throws -> URL {
255
275
  guard let fileSystem = self.fileSystem else {
256
276
  throw FileSystemModuleNotFoundException()
@@ -338,7 +358,7 @@ private struct ImageUtils {
338
358
  return (data, ".png")
339
359
 
340
360
  case .some(let s) where s.contains("ext=BMP"):
341
- if options.allowsEditing || options.quality != nil {
361
+ if options.allowsEditing {
342
362
  // switch to png if editing
343
363
  let data = image.pngData()
344
364
  return (data, ".png")
@@ -375,6 +395,13 @@ private struct ImageUtils {
375
395
  let preferredFormat = itemProvider.registeredTypeIdentifiers.first
376
396
 
377
397
  switch preferredFormat {
398
+ case UTType.bmp.identifier:
399
+ if options.allowsEditing {
400
+ // switch to png if editing
401
+ let data = image.pngData()
402
+ return (data, ".png")
403
+ }
404
+ return (rawData, ".bmp")
378
405
  case UTType.png.identifier:
379
406
  let data = image.pngData()
380
407
  return (data, ".png")
@@ -589,8 +616,12 @@ private struct VideoUtils {
589
616
 
590
617
  static func readSizeFrom(url: URL) -> CGSize? {
591
618
  let asset = AVURLAsset(url: url)
592
- let size: CGSize? = asset.tracks(withMediaType: .video).first?.naturalSize
593
- return size
619
+ guard let assetTrack = asset.tracks(withMediaType: .video).first else {
620
+ return nil
621
+ }
622
+ // The video could be rotated and the resulting transform can result in a negative width/height.
623
+ let size = assetTrack.naturalSize.applying(assetTrack.preferredTransform)
624
+ return CGSize(width: abs(size.width), height: abs(size.height))
594
625
  }
595
626
 
596
627
  static func readVideoUrlFrom(mediaInfo: MediaInfo) -> URL? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-image-picker",
3
- "version": "14.1.0",
3
+ "version": "14.2.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.0.0"
39
+ "expo-image-loader": "~4.2.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": "4fd9d5705d4e8bcab1d13c5be4a006a72d142953"
47
+ "gitHead": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
48
48
  }
@@ -13,18 +13,8 @@ import {
13
13
  CameraPermissionResponse,
14
14
  MediaLibraryPermissionResponse,
15
15
  ImagePickerResult,
16
- ImagePickerAsset,
17
16
  ImagePickerErrorResult,
18
- MediaTypeOptions,
19
17
  ImagePickerOptions,
20
- VideoExportPreset,
21
- ExpandImagePickerResult,
22
- ImageInfo,
23
- ImagePickerMultipleResult,
24
- ImagePickerCancelledResult,
25
- OpenFileBrowserOptions,
26
- UIImagePickerControllerQualityType,
27
- UIImagePickerPresentationStyle,
28
18
  } from './ImagePicker.types';
29
19
 
30
20
  function validateOptions(options: ImagePickerOptions) {
@@ -257,24 +247,6 @@ export async function launchImageLibraryAsync(
257
247
  return mergeDeprecatedResult(result);
258
248
  }
259
249
 
260
- export {
261
- MediaTypeOptions,
262
- ImagePickerOptions,
263
- ImagePickerResult,
264
- ImagePickerErrorResult,
265
- ImagePickerAsset,
266
- VideoExportPreset,
267
- CameraPermissionResponse,
268
- MediaLibraryPermissionResponse,
269
- PermissionStatus,
270
- PermissionExpiration,
271
- PermissionHookOptions,
272
- PermissionResponse,
273
- ImageInfo, // deprecated
274
- ImagePickerMultipleResult, // deprecated
275
- ImagePickerCancelledResult, // deprecated
276
- OpenFileBrowserOptions,
277
- ExpandImagePickerResult, // deprecated
278
- UIImagePickerControllerQualityType,
279
- UIImagePickerPresentationStyle,
280
- };
250
+ export * from './ImagePicker.types';
251
+
252
+ export { PermissionStatus, PermissionExpiration, PermissionHookOptions, PermissionResponse };
@@ -8,7 +8,7 @@ export type CameraPermissionResponse = PermissionResponse;
8
8
 
9
9
  // @needsAudit
10
10
  /**
11
- * Extends `PermissionResponse` type exported by `expo-modules-core` and contains additional iOS-specific field.
11
+ * Extends `PermissionResponse` type exported by `expo-modules-core`, containing additional iOS-specific field.
12
12
  */
13
13
  export type MediaLibraryPermissionResponse = PermissionResponse & {
14
14
  /**
@@ -172,38 +172,17 @@ export enum UIImagePickerPresentationStyle {
172
172
  * @platform ios 13+
173
173
  */
174
174
  AUTOMATIC = 'automatic',
175
+ }
176
+
177
+ export enum CameraType {
175
178
  /**
176
- * @deprecated Use `UIImagePickerPresentationStyle.FULL_SCREEN` instead.
177
- */
178
- FullScreen = 'fullScreen',
179
- /**
180
- * @deprecated Use `UIImagePickerPresentationStyle.PAGE_SHEET` instead.
181
- */
182
- PageSheet = 'pageSheet',
183
- /**
184
- * @deprecated Use `UIImagePickerPresentationStyle.FORM_SHEET` instead.
185
- */
186
- FormSheet = 'formSheet',
187
- /**
188
- * @deprecated Use `UIImagePickerPresentationStyle.CURRENT_CONTEXT` instead.
189
- */
190
- CurrentContext = 'currentContext',
191
- /**
192
- * @deprecated Use `UIImagePickerPresentationStyle.OVER_FULL_SCREEN` instead.
193
- */
194
- OverFullScreen = 'overFullScreen',
195
- /**
196
- * @deprecated Use `UIImagePickerPresentationStyle.OVER_CURRENT_CONTEXT` instead.
197
- */
198
- OverCurrentContext = 'overCurrentContext',
199
- /**
200
- * @deprecated Use `UIImagePickerPresentationStyle.POPOVER` instead.
179
+ * Back/rear camera.
201
180
  */
202
- Popover = 'popover',
181
+ back = 'back',
203
182
  /**
204
- * @deprecated Use `UIImagePickerPresentationStyle.AUTOMATIC` instead.
183
+ * Front camera
205
184
  */
206
- Automatic = 'automatic',
185
+ front = 'front',
207
186
  }
208
187
 
209
188
  /**
@@ -298,79 +277,36 @@ export type ImagePickerErrorResult = {
298
277
  };
299
278
 
300
279
  // @needsAudit
301
- export type ImagePickerResult = {
302
- /**
303
- * An array of picked assets or `null` when the request was canceled.
304
- */
305
- assets: ImagePickerAsset[] | null;
306
- /**
307
- * Boolean flag which shows if request was canceled. If asset data have been returned this should
308
- * always be `false`.
309
- */
310
- canceled: boolean;
311
- /**
312
- * @deprecated Use `canceled` instead.
313
- */
314
- cancelled?: boolean;
315
- /**
316
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
317
- */
318
- selected?: ImagePickerAsset[];
319
- /**
320
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
321
- */
322
- uri?: string;
323
- /**
324
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
325
- */
326
- assetId?: string | null;
327
- /**
328
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
329
- */
330
- width?: number;
331
- /**
332
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
333
- */
334
- height?: number;
335
- /**
336
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
337
- */
338
- type?: 'image' | 'video';
339
- /**
340
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
341
- */
342
- fileName?: string | null;
343
- /**
344
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
345
- */
346
- fileSize?: number;
347
- /**
348
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
349
- */
350
- exif?: Record<string, any> | null;
351
- /**
352
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
353
- */
354
- base64?: string | null;
355
- /**
356
- * @deprecated This field is deprecated and will be removed in SDK 48, you can access selected assets through the `assets` array instead.
357
- */
358
- duration?: number | null;
359
- } & (ImagePickerSuccessResult | ImagePickerCanceledResult);
280
+ /**
281
+ * Type representing successful and canceled pick result.
282
+ */
283
+ export type ImagePickerResult = ImagePickerSuccessResult | ImagePickerCanceledResult;
360
284
 
361
285
  /**
362
- * @hidden
286
+ * Type representing successful pick result.
363
287
  */
364
288
  export type ImagePickerSuccessResult = {
289
+ /**
290
+ * Boolean flag set to `false` showing that the request was successful.
291
+ */
365
292
  canceled: false;
293
+ /**
294
+ * An array of picked assets.
295
+ */
366
296
  assets: ImagePickerAsset[];
367
297
  };
368
298
 
369
299
  /**
370
- * @hidden
300
+ * Type representing canceled pick result.
371
301
  */
372
302
  export type ImagePickerCanceledResult = {
303
+ /**
304
+ * Boolean flag set to `true` showing that the request was canceled.
305
+ */
373
306
  canceled: true;
307
+ /**
308
+ * `null` signifying that the request was canceled.
309
+ */
374
310
  assets: null;
375
311
  };
376
312
 
@@ -392,8 +328,9 @@ export type ImagePickerOptions = {
392
328
  * Whether to show a UI to edit the image after it is picked. On Android the user can crop and
393
329
  * rotate the image and on iOS simply crop it.
394
330
  *
395
- * > Cropping multiple images is not supported - this option is mutually exclusive with `allowsMultipleSelection`.
396
- * > On iOS, this option is ignored if `allowsMultipleSelection` is enabled.
331
+ * > - Cropping multiple images is not supported - this option is mutually exclusive with `allowsMultipleSelection`.
332
+ * > - On iOS, this option is ignored if `allowsMultipleSelection` is enabled.
333
+ * > - On iOS cropping a `.bmp` image will convert it to `.png`.
397
334
  *
398
335
  * @default false
399
336
  * @platform ios
@@ -494,6 +431,15 @@ export type ImagePickerOptions = {
494
431
  * @platform ios
495
432
  */
496
433
  presentationStyle?: UIImagePickerPresentationStyle;
434
+ /**
435
+ * Selects the camera-facing type. The `CameraType` enum provides two options:
436
+ * `front` for the front-facing camera and `back` for the back-facing camera.
437
+ * - **On Android**, the behavior of this option may vary based on the camera app installed on the device.
438
+ * @default CameraType.back
439
+ * @platform ios
440
+ * @platform android
441
+ */
442
+ cameraType?: CameraType;
497
443
  };
498
444
 
499
445
  // @needsAudit