@hortemo/expo-photos 9.0.0 → 11.0.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.
@@ -1,4 +1,4 @@
1
- import { ViewProps } from "react-native";
1
+ import type { ViewProps } from "react-native";
2
2
  import { PHImageContentMode, PHImageRequestOptions, RequestImageTargetSize, UIViewContentMode } from "./ExpoPhotos.types";
3
3
  export interface PHImageLoadEvent {
4
4
  size: {
@@ -25,5 +25,5 @@ export interface PHImageViewProps extends ViewProps {
25
25
  nativeEvent: PHImageErrorEvent;
26
26
  }) => void;
27
27
  }
28
- export declare function PHImageView({ requestOptions, contentMode, ...rest }: PHImageViewProps): import("react").JSX.Element;
28
+ export declare function PHImageView({ requestOptions, contentMode, ...rest }: PHImageViewProps): any;
29
29
  //# sourceMappingURL=PHImage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PHImage.d.ts","sourceRoot":"","sources":["../src/PHImage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,UAAU,CAAC,EAAE,sBAAsB,CAAC;CACrC;AAED,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,cAAc,CAAC,EAAE,y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AID,wBAAgB,WAAW,CAAC,EAC1B,cAAc,EACd,WAAW,EACX,GAAG,IAAI,EACR,EAAE,gBAAgB,OAYlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"PHImage.js","sourceRoot":"","sources":["../src/PHImage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AA+B7D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,UAAU,WAAW,CAAC,EAC1B,cAAc,EACd,WAAW,EACX,GAAG,IAAI,EACU;IACjB,OAAO,CACL,CAAC,iBAAiB,CAChB,eAAe,CAAC,CAAC,WAAW,CAAC,CAC7B,kBAAkB,CAAC,CAAC,cAAc,EAAE,WAAW,CAAC,CAChD,sBAAsB,CAAC,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAC/D,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,UAAU,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CACvC,UAAU,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CACvC,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport { ViewProps } from \"react-native\";\nimport {\n PHImageContentMode,\n PHImageRequestOptions,\n RequestImageTargetSize,\n UIViewContentMode,\n} from \"./ExpoPhotos.types\";\n\nexport interface PHImageLoadEvent {\n size: { width: number; height: number };\n scale: number;\n}\n\nexport interface PHImageErrorEvent {\n message: string;\n}\n\nexport interface PHImageViewRequestOptions extends PHImageRequestOptions {\n contentMode?: PHImageContentMode;\n targetSize?: RequestImageTargetSize;\n}\n\nexport interface PHImageViewProps extends ViewProps {\n localIdentifier: string;\n contentMode?: UIViewContentMode;\n requestOptions?: PHImageViewRequestOptions;\n onLoad?: (event: { nativeEvent: PHImageLoadEvent }) => void;\n onError?: (event: { nativeEvent: PHImageErrorEvent }) => void;\n}\n\nconst NativePHImageView = requireNativeViewManager(\"ExpoPhotos\", \"PHImageView\");\n\nexport function PHImageView({\n requestOptions,\n contentMode,\n ...rest\n}: PHImageViewProps) {\n return (\n <NativePHImageView\n viewContentMode={contentMode}\n requestContentMode={requestOptions?.contentMode}\n isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}\n deliveryMode={requestOptions?.deliveryMode}\n resizeMode={requestOptions?.resizeMode}\n targetSize={requestOptions?.targetSize}\n {...rest}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"PHImage.js","sourceRoot":"","sources":["../src/PHImage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AA+B7D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,UAAU,WAAW,CAAC,EAC1B,cAAc,EACd,WAAW,EACX,GAAG,IAAI,EACU;IACjB,OAAO,CACL,CAAC,iBAAiB,CAChB,eAAe,CAAC,CAAC,WAAW,CAAC,CAC7B,kBAAkB,CAAC,CAAC,cAAc,EAAE,WAAW,CAAC,CAChD,sBAAsB,CAAC,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAC/D,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,UAAU,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CACvC,UAAU,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CACvC,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport type { ViewProps } from \"react-native\";\nimport {\n PHImageContentMode,\n PHImageRequestOptions,\n RequestImageTargetSize,\n UIViewContentMode,\n} from \"./ExpoPhotos.types\";\n\nexport interface PHImageLoadEvent {\n size: { width: number; height: number };\n scale: number;\n}\n\nexport interface PHImageErrorEvent {\n message: string;\n}\n\nexport interface PHImageViewRequestOptions extends PHImageRequestOptions {\n contentMode?: PHImageContentMode;\n targetSize?: RequestImageTargetSize;\n}\n\nexport interface PHImageViewProps extends ViewProps {\n localIdentifier: string;\n contentMode?: UIViewContentMode;\n requestOptions?: PHImageViewRequestOptions;\n onLoad?: (event: { nativeEvent: PHImageLoadEvent }) => void;\n onError?: (event: { nativeEvent: PHImageErrorEvent }) => void;\n}\n\nconst NativePHImageView = requireNativeViewManager(\"ExpoPhotos\", \"PHImageView\");\n\nexport function PHImageView({\n requestOptions,\n contentMode,\n ...rest\n}: PHImageViewProps) {\n return (\n <NativePHImageView\n viewContentMode={contentMode}\n requestContentMode={requestOptions?.contentMode}\n isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}\n deliveryMode={requestOptions?.deliveryMode}\n resizeMode={requestOptions?.resizeMode}\n targetSize={requestOptions?.targetSize}\n {...rest}\n />\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { ViewProps } from "react-native";
1
+ import type { ViewProps } from "react-native";
2
2
  import { PHVideoLoadEvent, PHVideoErrorEvent, PHVideoRequestOptions } from "./ExpoPhotos.types";
3
3
  export interface PHVideoViewRequestOptions extends PHVideoRequestOptions {
4
4
  }
@@ -12,5 +12,5 @@ export interface PHVideoViewProps extends ViewProps {
12
12
  nativeEvent: PHVideoErrorEvent;
13
13
  }) => void;
14
14
  }
15
- export declare function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps): import("react").JSX.Element;
15
+ export declare function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps): any;
16
16
  //# sourceMappingURL=PHVideo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PHVideo.d.ts","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;CAAG;AAE3E,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,gBAAgB,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/D;AAID,wBAAgB,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,+BAQxE"}
1
+ {"version":3,"file":"PHVideo.d.ts","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;CAAG;AAE3E,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,gBAAgB,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/D;AAID,wBAAgB,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,OAQxE"}
@@ -1 +1 @@
1
- {"version":3,"file":"PHVideo.js","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAiB7D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,UAAU,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAoB;IACvE,OAAO,CACL,CAAC,iBAAiB,CAChB,sBAAsB,CAAC,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAC/D,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport { ViewProps } from \"react-native\";\nimport {\n PHVideoLoadEvent,\n PHVideoErrorEvent,\n PHVideoRequestOptions,\n} from \"./ExpoPhotos.types\";\n\nexport interface PHVideoViewRequestOptions extends PHVideoRequestOptions {}\n\nexport interface PHVideoViewProps extends ViewProps {\n localIdentifier: string;\n requestOptions?: PHVideoViewRequestOptions;\n onLoad?: (event: { nativeEvent: PHVideoLoadEvent }) => void;\n onError?: (event: { nativeEvent: PHVideoErrorEvent }) => void;\n}\n\nconst NativePHVideoView = requireNativeViewManager(\"ExpoPhotos\", \"PHVideoView\");\n\nexport function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps) {\n return (\n <NativePHVideoView\n isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}\n deliveryMode={requestOptions?.deliveryMode}\n {...rest}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"PHVideo.js","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAiB7D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,UAAU,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAoB;IACvE,OAAO,CACL,CAAC,iBAAiB,CAChB,sBAAsB,CAAC,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAC/D,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport type { ViewProps } from \"react-native\";\nimport {\n PHVideoLoadEvent,\n PHVideoErrorEvent,\n PHVideoRequestOptions,\n} from \"./ExpoPhotos.types\";\n\nexport interface PHVideoViewRequestOptions extends PHVideoRequestOptions {}\n\nexport interface PHVideoViewProps extends ViewProps {\n localIdentifier: string;\n requestOptions?: PHVideoViewRequestOptions;\n onLoad?: (event: { nativeEvent: PHVideoLoadEvent }) => void;\n onError?: (event: { nativeEvent: PHVideoErrorEvent }) => void;\n}\n\nconst NativePHVideoView = requireNativeViewManager(\"ExpoPhotos\", \"PHVideoView\");\n\nexport function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps) {\n return (\n <NativePHVideoView\n isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}\n deliveryMode={requestOptions?.deliveryMode}\n {...rest}\n />\n );\n}\n"]}
@@ -264,43 +264,40 @@ public final class ExpoPhotos: Module {
264
264
  }
265
265
 
266
266
  AsyncFunction("presentLimitedLibraryPicker") { () async throws -> Void in
267
- guard let viewController = self.appContext?.utilities?.currentViewController() else {
268
- throw ExpoPhotosError.noViewController
267
+ try await MainActor.run {
268
+ guard let viewController = self.appContext?.utilities?.currentViewController() else {
269
+ throw ExpoPhotosError.noViewController
270
+ }
271
+ PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: viewController)
269
272
  }
270
-
271
- await PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: viewController)
272
273
  }
273
274
 
274
275
  AsyncFunction("pickAssets") { (options: PickAssetsOptions) async throws -> [[String: Any]] in
275
- guard let viewController = self.appContext?.utilities?.currentViewController() else {
276
- throw ExpoPhotosError.noViewController
277
- }
278
-
279
- let picker: PHPickerViewController = await MainActor.run {
280
- var config = PHPickerConfiguration(photoLibrary: .shared())
281
-
282
- if let selectionLimit = options.selectionLimit {
283
- config.selectionLimit = selectionLimit
284
- }
285
-
286
- if let filter = options.filter {
287
- config.filter = filter
288
- }
289
-
290
- let picker = PHPickerViewController(configuration: config)
291
- picker.delegate = self
276
+ return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<[[String: Any]], Error>) in
277
+ Task { @MainActor in
278
+ guard let viewController = self.appContext?.utilities?.currentViewController() else {
279
+ continuation.resume(throwing: ExpoPhotosError.noViewController)
280
+ return
281
+ }
292
282
 
293
- return picker
294
- }
283
+ var config = PHPickerConfiguration(photoLibrary: .shared())
284
+
285
+ if let selectionLimit = options.selectionLimit {
286
+ config.selectionLimit = selectionLimit
287
+ }
288
+
289
+ if let filter = options.filter {
290
+ config.filter = filter
291
+ }
295
292
 
296
- let pickerId = await MainActor.run { picker.id }
293
+ let picker = PHPickerViewController(configuration: config)
294
+ picker.delegate = self
297
295
 
298
- return try await withCheckedThrowingContinuation {
299
- (continuation: CheckedContinuation<[[String: Any]], Error>) in
300
- self.pickAssetsContinuations[pickerId] = continuation
296
+ // Disable swipe to dismiss, which does not trigger delegate
297
+ picker.isModalInPresentation = true
301
298
 
302
- Task {
303
- await viewController.present(picker, animated: true, completion: nil)
299
+ self.pickAssetsContinuations[picker.id] = continuation
300
+ viewController.present(picker, animated: true)
304
301
  }
305
302
  }
306
303
  }
@@ -359,12 +356,10 @@ extension ExpoPhotos: PHPickerViewControllerDelegate {
359
356
  public func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
360
357
  picker.dismiss(animated: true, completion: nil)
361
358
 
362
- guard let continuation = self.pickAssetsContinuations[picker.id] else {
359
+ guard let continuation = self.pickAssetsContinuations.removeValue(forKey: picker.id) else {
363
360
  return
364
361
  }
365
362
 
366
- self.pickAssetsContinuations.removeValue(forKey: picker.id)
367
-
368
363
  let assetIdentifiers = results.compactMap { $0.assetIdentifier }
369
364
  var assets: [[String: Any]] = []
370
365
  PHAsset.fetchAssets(withLocalIdentifiers: assetIdentifiers, options: nil).enumerateObjects {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortemo/expo-photos",
3
- "version": "9.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "Expo module exposing advanced iOS Photos APIs.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -29,11 +29,8 @@
29
29
  "homepage": "https://github.com/hortemo/expo-photos#readme",
30
30
  "dependencies": {},
31
31
  "devDependencies": {
32
- "@types/react": "~19.1.0",
33
32
  "eslint": "^9.24.0",
34
- "expo": "^54.0.12",
35
- "expo-module-scripts": "^5.0.7",
36
- "react-native": "0.81.4"
33
+ "expo-module-scripts": "^5.0.7"
37
34
  },
38
35
  "peerDependencies": {
39
36
  "expo": "*",
package/src/PHImage.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { requireNativeViewManager } from "expo-modules-core";
2
- import { ViewProps } from "react-native";
2
+ import type { ViewProps } from "react-native";
3
3
  import {
4
4
  PHImageContentMode,
5
5
  PHImageRequestOptions,
package/src/PHVideo.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { requireNativeViewManager } from "expo-modules-core";
2
- import { ViewProps } from "react-native";
2
+ import type { ViewProps } from "react-native";
3
3
  import {
4
4
  PHVideoLoadEvent,
5
5
  PHVideoErrorEvent,