@hortemo/expo-photos 8.0.0 → 10.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.
- package/README.md +26 -11
- package/build/ExpoPhotos.types.d.ts +39 -24
- package/build/ExpoPhotos.types.d.ts.map +1 -1
- package/build/ExpoPhotos.types.js +40 -24
- package/build/ExpoPhotos.types.js.map +1 -1
- package/build/PHImage.d.ts +9 -7
- package/build/PHImage.d.ts.map +1 -1
- package/build/PHImage.js +2 -2
- package/build/PHImage.js.map +1 -1
- package/build/PHVideo.d.ts +5 -2
- package/build/PHVideo.d.ts.map +1 -1
- package/build/PHVideo.js +2 -2
- package/build/PHVideo.js.map +1 -1
- package/build/index.d.ts +4 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/ios/ExpoPhotosModule.swift +36 -32
- package/ios/PHImageView.swift +22 -7
- package/package.json +1 -1
- package/src/ExpoPhotos.types.ts +41 -28
- package/src/PHImage.tsx +27 -9
- package/src/PHVideo.tsx +12 -3
- package/src/index.ts +4 -4
package/README.md
CHANGED
|
@@ -22,33 +22,48 @@ npm install @hortemo/expo-photos
|
|
|
22
22
|
|
|
23
23
|
### Components
|
|
24
24
|
|
|
25
|
-
####
|
|
25
|
+
#### PHImageView
|
|
26
26
|
|
|
27
27
|
A native image component that displays photos from the Photos library using `PHImageManager`.
|
|
28
28
|
|
|
29
29
|
```tsx
|
|
30
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
PHImageView,
|
|
32
|
+
PHImageContentMode,
|
|
33
|
+
PHImageRequestOptionsResizeMode,
|
|
34
|
+
PHImageRequestOptionsDeliveryMode,
|
|
35
|
+
UIViewContentMode,
|
|
36
|
+
} from "@hortemo/expo-photos";
|
|
31
37
|
|
|
32
|
-
<
|
|
38
|
+
<PHImageView
|
|
33
39
|
localIdentifier={asset.localIdentifier}
|
|
34
|
-
contentMode={
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
contentMode={UIViewContentMode.scaleAspectFill}
|
|
41
|
+
requestOptions={{
|
|
42
|
+
contentMode: PHImageContentMode.aspectFit,
|
|
43
|
+
resizeMode: PHImageRequestOptionsResizeMode.fast,
|
|
44
|
+
deliveryMode: PHImageRequestOptionsDeliveryMode.highQualityFormat,
|
|
45
|
+
targetSize: { width: 300, height: 300 },
|
|
46
|
+
isNetworkAccessAllowed: true,
|
|
47
|
+
}}
|
|
48
|
+
onLoad={(event) => console.log(event.nativeEvent)}
|
|
49
|
+
onError={(event) => console.log(event.nativeEvent.message)}
|
|
37
50
|
style={{ width: 300, height: 300 }}
|
|
38
51
|
/>
|
|
39
52
|
```
|
|
40
53
|
|
|
41
|
-
####
|
|
54
|
+
#### PHVideoView
|
|
42
55
|
|
|
43
56
|
A video player component that streams videos from the library.
|
|
44
57
|
|
|
45
58
|
```tsx
|
|
46
|
-
import {
|
|
59
|
+
import { PHVideoView, PHVideoRequestOptionsDeliveryMode } from "@hortemo/expo-photos";
|
|
47
60
|
|
|
48
|
-
<
|
|
61
|
+
<PHVideoView
|
|
49
62
|
localIdentifier={asset.localIdentifier}
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
requestOptions={{
|
|
64
|
+
isNetworkAccessAllowed: true,
|
|
65
|
+
deliveryMode: PHVideoRequestOptionsDeliveryMode.automatic,
|
|
66
|
+
}}
|
|
52
67
|
onLoad={(event) => console.log(event.nativeEvent)}
|
|
53
68
|
onError={(event) => console.log(event.nativeEvent.message)}
|
|
54
69
|
style={{ width: 300, height: 200 }}
|
|
@@ -19,22 +19,22 @@ export declare enum PHAccessLevel {
|
|
|
19
19
|
readWrite = 2
|
|
20
20
|
}
|
|
21
21
|
export declare enum PHAssetMediaType {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
unknown = 0,
|
|
23
|
+
image = 1,
|
|
24
|
+
video = 2,
|
|
25
|
+
audio = 3
|
|
26
26
|
}
|
|
27
27
|
export declare enum PHAssetMediaSubtype {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
none = 0,
|
|
29
|
+
photoPanorama = 1,
|
|
30
|
+
photoHDR = 2,
|
|
31
|
+
photoScreenshot = 4,
|
|
32
|
+
photoLive = 8,
|
|
33
|
+
photoDepthEffect = 16,
|
|
34
|
+
videoStreamed = 65536,
|
|
35
|
+
videoHighFrameRate = 131072,
|
|
36
|
+
videoTimelapse = 262144,
|
|
37
|
+
videoCinematic = 524288
|
|
38
38
|
}
|
|
39
39
|
export interface NSSortDescriptor {
|
|
40
40
|
key: string;
|
|
@@ -53,19 +53,34 @@ export interface CGSize {
|
|
|
53
53
|
export type PHImageManagerMaximumSize = "PHImageManagerMaximumSize";
|
|
54
54
|
export type RequestImageTargetSize = CGSize | PHImageManagerMaximumSize;
|
|
55
55
|
export declare enum PHImageRequestOptionsResizeMode {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
none = 0,
|
|
57
|
+
fast = 1,
|
|
58
|
+
exact = 2
|
|
59
59
|
}
|
|
60
60
|
export declare enum PHImageRequestOptionsDeliveryMode {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
opportunistic = 0,
|
|
62
|
+
highQualityFormat = 1,
|
|
63
|
+
fastFormat = 2
|
|
64
64
|
}
|
|
65
65
|
export declare enum PHImageContentMode {
|
|
66
66
|
aspectFit = 0,
|
|
67
67
|
aspectFill = 1
|
|
68
68
|
}
|
|
69
|
+
export declare enum UIViewContentMode {
|
|
70
|
+
scaleToFill = 0,
|
|
71
|
+
scaleAspectFit = 1,
|
|
72
|
+
scaleAspectFill = 2,
|
|
73
|
+
redraw = 3,
|
|
74
|
+
center = 4,
|
|
75
|
+
top = 5,
|
|
76
|
+
bottom = 6,
|
|
77
|
+
left = 7,
|
|
78
|
+
right = 8,
|
|
79
|
+
topLeft = 9,
|
|
80
|
+
topRight = 10,
|
|
81
|
+
bottomLeft = 11,
|
|
82
|
+
bottomRight = 12
|
|
83
|
+
}
|
|
69
84
|
export interface PHImageRequestOptions {
|
|
70
85
|
isNetworkAccessAllowed?: boolean;
|
|
71
86
|
resizeMode?: PHImageRequestOptionsResizeMode;
|
|
@@ -76,10 +91,10 @@ export interface SDImageCoderOptions {
|
|
|
76
91
|
encodeMaxFileSize?: number;
|
|
77
92
|
}
|
|
78
93
|
export declare enum PHVideoRequestOptionsDeliveryMode {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
automatic = 0,
|
|
95
|
+
highQualityFormat = 1,
|
|
96
|
+
mediumQualityFormat = 2,
|
|
97
|
+
fastFormat = 3
|
|
83
98
|
}
|
|
84
99
|
export interface PHVideoRequestOptions {
|
|
85
100
|
isNetworkAccessAllowed?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoPhotos.types.d.ts","sourceRoot":"","sources":["../src/ExpoPhotos.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,aAAa,EAAE,mBAAmB,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,oBAAY,qBAAqB;IAC/B,aAAa,IAAI;IACjB,UAAU,IAAI;IACd,MAAM,IAAI;IACV,UAAU,IAAI;IACd,OAAO,IAAI;CACZ;AAED,oBAAY,aAAa;IACvB,OAAO,IAAI;IACX,SAAS,IAAI;CACd;AAED,oBAAY,gBAAgB;IAC1B,OAAO,IAAI;IACX,KAAK,IAAI;IACT,KAAK,IAAI;IACT,KAAK,IAAI;CACV;AAED,oBAAY,mBAAmB;IAC7B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-13,47 +13,63 @@ export var PHAccessLevel;
|
|
|
13
13
|
})(PHAccessLevel || (PHAccessLevel = {}));
|
|
14
14
|
export var PHAssetMediaType;
|
|
15
15
|
(function (PHAssetMediaType) {
|
|
16
|
-
PHAssetMediaType[PHAssetMediaType["
|
|
17
|
-
PHAssetMediaType[PHAssetMediaType["
|
|
18
|
-
PHAssetMediaType[PHAssetMediaType["
|
|
19
|
-
PHAssetMediaType[PHAssetMediaType["
|
|
16
|
+
PHAssetMediaType[PHAssetMediaType["unknown"] = 0] = "unknown";
|
|
17
|
+
PHAssetMediaType[PHAssetMediaType["image"] = 1] = "image";
|
|
18
|
+
PHAssetMediaType[PHAssetMediaType["video"] = 2] = "video";
|
|
19
|
+
PHAssetMediaType[PHAssetMediaType["audio"] = 3] = "audio";
|
|
20
20
|
})(PHAssetMediaType || (PHAssetMediaType = {}));
|
|
21
21
|
export var PHAssetMediaSubtype;
|
|
22
22
|
(function (PHAssetMediaSubtype) {
|
|
23
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
24
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
25
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
26
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
27
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
28
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
29
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
30
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
31
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
32
|
-
PHAssetMediaSubtype[PHAssetMediaSubtype["
|
|
23
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["none"] = 0] = "none";
|
|
24
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["photoPanorama"] = 1] = "photoPanorama";
|
|
25
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["photoHDR"] = 2] = "photoHDR";
|
|
26
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["photoScreenshot"] = 4] = "photoScreenshot";
|
|
27
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["photoLive"] = 8] = "photoLive";
|
|
28
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["photoDepthEffect"] = 16] = "photoDepthEffect";
|
|
29
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["videoStreamed"] = 65536] = "videoStreamed";
|
|
30
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["videoHighFrameRate"] = 131072] = "videoHighFrameRate";
|
|
31
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["videoTimelapse"] = 262144] = "videoTimelapse";
|
|
32
|
+
PHAssetMediaSubtype[PHAssetMediaSubtype["videoCinematic"] = 524288] = "videoCinematic";
|
|
33
33
|
})(PHAssetMediaSubtype || (PHAssetMediaSubtype = {}));
|
|
34
34
|
export var PHImageRequestOptionsResizeMode;
|
|
35
35
|
(function (PHImageRequestOptionsResizeMode) {
|
|
36
|
-
PHImageRequestOptionsResizeMode[PHImageRequestOptionsResizeMode["
|
|
37
|
-
PHImageRequestOptionsResizeMode[PHImageRequestOptionsResizeMode["
|
|
38
|
-
PHImageRequestOptionsResizeMode[PHImageRequestOptionsResizeMode["
|
|
36
|
+
PHImageRequestOptionsResizeMode[PHImageRequestOptionsResizeMode["none"] = 0] = "none";
|
|
37
|
+
PHImageRequestOptionsResizeMode[PHImageRequestOptionsResizeMode["fast"] = 1] = "fast";
|
|
38
|
+
PHImageRequestOptionsResizeMode[PHImageRequestOptionsResizeMode["exact"] = 2] = "exact";
|
|
39
39
|
})(PHImageRequestOptionsResizeMode || (PHImageRequestOptionsResizeMode = {}));
|
|
40
40
|
export var PHImageRequestOptionsDeliveryMode;
|
|
41
41
|
(function (PHImageRequestOptionsDeliveryMode) {
|
|
42
|
-
PHImageRequestOptionsDeliveryMode[PHImageRequestOptionsDeliveryMode["
|
|
43
|
-
PHImageRequestOptionsDeliveryMode[PHImageRequestOptionsDeliveryMode["
|
|
44
|
-
PHImageRequestOptionsDeliveryMode[PHImageRequestOptionsDeliveryMode["
|
|
42
|
+
PHImageRequestOptionsDeliveryMode[PHImageRequestOptionsDeliveryMode["opportunistic"] = 0] = "opportunistic";
|
|
43
|
+
PHImageRequestOptionsDeliveryMode[PHImageRequestOptionsDeliveryMode["highQualityFormat"] = 1] = "highQualityFormat";
|
|
44
|
+
PHImageRequestOptionsDeliveryMode[PHImageRequestOptionsDeliveryMode["fastFormat"] = 2] = "fastFormat";
|
|
45
45
|
})(PHImageRequestOptionsDeliveryMode || (PHImageRequestOptionsDeliveryMode = {}));
|
|
46
46
|
export var PHImageContentMode;
|
|
47
47
|
(function (PHImageContentMode) {
|
|
48
48
|
PHImageContentMode[PHImageContentMode["aspectFit"] = 0] = "aspectFit";
|
|
49
49
|
PHImageContentMode[PHImageContentMode["aspectFill"] = 1] = "aspectFill";
|
|
50
50
|
})(PHImageContentMode || (PHImageContentMode = {}));
|
|
51
|
+
export var UIViewContentMode;
|
|
52
|
+
(function (UIViewContentMode) {
|
|
53
|
+
UIViewContentMode[UIViewContentMode["scaleToFill"] = 0] = "scaleToFill";
|
|
54
|
+
UIViewContentMode[UIViewContentMode["scaleAspectFit"] = 1] = "scaleAspectFit";
|
|
55
|
+
UIViewContentMode[UIViewContentMode["scaleAspectFill"] = 2] = "scaleAspectFill";
|
|
56
|
+
UIViewContentMode[UIViewContentMode["redraw"] = 3] = "redraw";
|
|
57
|
+
UIViewContentMode[UIViewContentMode["center"] = 4] = "center";
|
|
58
|
+
UIViewContentMode[UIViewContentMode["top"] = 5] = "top";
|
|
59
|
+
UIViewContentMode[UIViewContentMode["bottom"] = 6] = "bottom";
|
|
60
|
+
UIViewContentMode[UIViewContentMode["left"] = 7] = "left";
|
|
61
|
+
UIViewContentMode[UIViewContentMode["right"] = 8] = "right";
|
|
62
|
+
UIViewContentMode[UIViewContentMode["topLeft"] = 9] = "topLeft";
|
|
63
|
+
UIViewContentMode[UIViewContentMode["topRight"] = 10] = "topRight";
|
|
64
|
+
UIViewContentMode[UIViewContentMode["bottomLeft"] = 11] = "bottomLeft";
|
|
65
|
+
UIViewContentMode[UIViewContentMode["bottomRight"] = 12] = "bottomRight";
|
|
66
|
+
})(UIViewContentMode || (UIViewContentMode = {}));
|
|
51
67
|
export var PHVideoRequestOptionsDeliveryMode;
|
|
52
68
|
(function (PHVideoRequestOptionsDeliveryMode) {
|
|
53
|
-
PHVideoRequestOptionsDeliveryMode[PHVideoRequestOptionsDeliveryMode["
|
|
54
|
-
PHVideoRequestOptionsDeliveryMode[PHVideoRequestOptionsDeliveryMode["
|
|
55
|
-
PHVideoRequestOptionsDeliveryMode[PHVideoRequestOptionsDeliveryMode["
|
|
56
|
-
PHVideoRequestOptionsDeliveryMode[PHVideoRequestOptionsDeliveryMode["
|
|
69
|
+
PHVideoRequestOptionsDeliveryMode[PHVideoRequestOptionsDeliveryMode["automatic"] = 0] = "automatic";
|
|
70
|
+
PHVideoRequestOptionsDeliveryMode[PHVideoRequestOptionsDeliveryMode["highQualityFormat"] = 1] = "highQualityFormat";
|
|
71
|
+
PHVideoRequestOptionsDeliveryMode[PHVideoRequestOptionsDeliveryMode["mediumQualityFormat"] = 2] = "mediumQualityFormat";
|
|
72
|
+
PHVideoRequestOptionsDeliveryMode[PHVideoRequestOptionsDeliveryMode["fastFormat"] = 3] = "fastFormat";
|
|
57
73
|
})(PHVideoRequestOptionsDeliveryMode || (PHVideoRequestOptionsDeliveryMode = {}));
|
|
58
74
|
export var AVFileType;
|
|
59
75
|
(function (AVFileType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoPhotos.types.js","sourceRoot":"","sources":["../src/ExpoPhotos.types.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC/B,mFAAiB,CAAA;IACjB,6EAAc,CAAA;IACd,qEAAU,CAAA;IACV,6EAAc,CAA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,2EAAoD,CAAA;IACpD,mFAA4D,CAAA;IAC5D,qGAA8E,CAAA;IAC9E,gEAAyC,CAAA;IACzC,gEAAyC,CAAA;IACzC,kEAA2C,CAAA;IAC3C,oEAA6C,CAAA;IAC7C,oEAA6C,CAAA;IAC7C,yEAAkD,CAAA;IAClD,yEAAkD,CAAA;IAClD,2FAAoE,CAAA;IACpE,2FAAoE,CAAA;IACpE,yEAAkD,CAAA;IAClD,yEAAkD,CAAA;IAClD,6EAAsD,CAAA;IACtD,2EAAoD,CAAA;IACpD,2EAAoD,CAAA;IACpD,6EAAsD,CAAA;IACtD,uEAAgD,CAAA;IAChD,6EAAsD,CAAA;IACtD,+EAAwD,CAAA;IACxD,uEAAgD,CAAA;IAChD,mFAA4D,CAAA;IAC5D,qFAA8D,CAAA;IAC9D,qEAA8C,CAAA;IAC9C,+DAAwC,CAAA;AAC1C,CAAC,EA7BW,mBAAmB,KAAnB,mBAAmB,QA6B9B;AA+BD,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;IACjB,6BAAW,CAAA;AACb,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB","sourcesContent":["export interface PHAsset {\n localIdentifier: string;\n creationDate: number;\n mediaType: PHAssetMediaType;\n mediaSubtypes: PHAssetMediaSubtype;\n duration: number;\n pixelWidth: number;\n pixelHeight: number;\n}\n\nexport enum PHAuthorizationStatus {\n notDetermined = 0,\n restricted = 1,\n denied = 2,\n authorized = 3,\n limited = 4,\n}\n\nexport enum PHAccessLevel {\n addOnly = 1,\n readWrite = 2,\n}\n\nexport enum PHAssetMediaType {\n unknown = 0,\n image = 1,\n video = 2,\n audio = 3,\n}\n\nexport enum PHAssetMediaSubtype {\n none = 0,\n photoPanorama = 1 << 0,\n photoHDR = 1 << 1,\n photoScreenshot = 1 << 2,\n photoLive = 1 << 3,\n photoDepthEffect = 1 << 4,\n videoStreamed = 1 << 16,\n videoHighFrameRate = 1 << 17,\n videoTimelapse = 1 << 18,\n videoCinematic = 1 << 19,\n}\n\nexport interface NSSortDescriptor {\n key: string;\n ascending: boolean;\n}\n\nexport interface PHFetchOptions {\n predicate?: string;\n fetchLimit?: number;\n sortDescriptors?: NSSortDescriptor[];\n}\n\nexport type FetchAssetsOptions = PHFetchOptions;\n\nexport interface CGSize {\n width: number;\n height: number;\n}\n\nexport type PHImageManagerMaximumSize = \"PHImageManagerMaximumSize\";\n\nexport type RequestImageTargetSize = CGSize | PHImageManagerMaximumSize;\n\nexport enum PHImageRequestOptionsResizeMode {\n none = 0,\n fast = 1,\n exact = 2,\n}\n\nexport enum PHImageRequestOptionsDeliveryMode {\n opportunistic = 0,\n highQualityFormat = 1,\n fastFormat = 2,\n}\n\nexport enum PHImageContentMode {\n aspectFit = 0,\n aspectFill = 1,\n}\n\nexport enum UIViewContentMode {\n scaleToFill = 0,\n scaleAspectFit = 1,\n scaleAspectFill = 2,\n redraw = 3,\n center = 4,\n top = 5,\n bottom = 6,\n left = 7,\n right = 8,\n topLeft = 9,\n topRight = 10,\n bottomLeft = 11,\n bottomRight = 12,\n}\nexport interface PHImageRequestOptions {\n isNetworkAccessAllowed?: boolean;\n resizeMode?: PHImageRequestOptionsResizeMode;\n deliveryMode?: PHImageRequestOptionsDeliveryMode;\n}\n\nexport interface SDImageCoderOptions {\n encodeCompressionQuality?: number;\n encodeMaxFileSize?: number;\n}\n\nexport enum PHVideoRequestOptionsDeliveryMode {\n automatic = 0,\n highQualityFormat = 1,\n mediumQualityFormat = 2,\n fastFormat = 3,\n}\n\nexport interface PHVideoRequestOptions {\n isNetworkAccessAllowed?: boolean;\n deliveryMode?: PHVideoRequestOptionsDeliveryMode;\n}\n\nexport interface CMTimeRange {\n start: number;\n duration: number;\n}\n\nexport enum AVFileType {\n ac3 = \"public.ac3-audio\",\n aifc = \"public.aifc-audio\",\n aiff = \"public.aiff-audio\",\n AHAP = \"com.apple.itt\",\n amr = \"org.3gpp.adaptive-multi-rate-audio\",\n appleiTT = \"com.apple.itt\",\n au = \"public.au-audio\",\n avci = \"public.avci\",\n caf = \"com.apple.coreaudio-format\",\n dng = \"com.adobe.raw-image\",\n eac3 = \"public.eac3-audio\",\n heic = \"public.heic\",\n heif = \"public.heif\",\n jpg = \"public.jpeg\",\n m4a = \"com.apple.m4a-audio\",\n m4v = \"com.apple.m4v-video\",\n mobile3GPP = \"public.3gpp\",\n mobile3GPP2 = \"public.3gpp2\",\n mov = \"com.apple.quicktime-movie\",\n mp3 = \"public.mp3\",\n mp4 = \"public.mpeg-4\",\n SCC = \"com.scenarist.cc\",\n tif = \"public.tiff\",\n wav = \"com.microsoft.waveform-audio\",\n}\n\nexport enum AVAssetExportPreset {\n LowQuality = \"AVAssetExportPresetLowQuality\",\n MediumQuality = \"AVAssetExportPresetMediumQuality\",\n HighestQuality = \"AVAssetExportPresetHighestQuality\",\n HEVCHighestQuality = \"AVAssetExportPresetHEVCHighestQuality\",\n HEVCHighestQualityWithAlpha = \"AVAssetExportPresetHEVCHighestQualityWithAlpha\",\n AVC640x480 = \"AVAssetExportPreset640x480\",\n AVC960x540 = \"AVAssetExportPreset960x540\",\n AVC1280x720 = \"AVAssetExportPreset1280x720\",\n AVC1920x1080 = \"AVAssetExportPreset1920x1080\",\n AVC3840x2160 = \"AVAssetExportPreset3840x2160\",\n HEVC1920x1080 = \"AVAssetExportPresetHEVC1920x1080\",\n HEVC3840x2160 = \"AVAssetExportPresetHEVC3840x2160\",\n HEVC1920x1080WithAlpha = \"AVAssetExportPresetHEVC1920x1080WithAlpha\",\n HEVC3840x2160WithAlpha = \"AVAssetExportPresetHEVC3840x2160WithAlpha\",\n HEVC7680x4320 = \"AVAssetExportPresetHEVC7680x4320\",\n MVHEVC960x960 = \"AVAssetExportPresetMVHEVC960x960\",\n MVHEVC1440x1440 = \"AVAssetExportPresetMVHEVC1440x1440\",\n AppleM4V480pSD = \"AVAssetExportPresetAppleM4V480pSD\",\n AppleM4V720pHD = \"AVAssetExportPresetAppleM4V720pHD\",\n AppleM4V1080pHD = \"AVAssetExportPresetAppleM4V1080pHD\",\n AppleM4ViPod = \"AVAssetExportPresetAppleM4ViPod\",\n AppleM4VAppleTV = \"AVAssetExportPresetAppleM4VAppleTV\",\n AppleM4VCellular = \"AVAssetExportPresetAppleM4VCellular\",\n AppleM4VWiFi = \"AVAssetExportPresetAppleM4VWiFi\",\n AppleProRes422LPCM = \"AVAssetExportPresetAppleProRes422LPCM\",\n AppleProRes4444LPCM = \"AVAssetExportPresetAppleProRes4444LPCM\",\n Passthrough = \"AVAssetExportPresetPassthrough\",\n AppleM4A = \"AVAssetExportPresetAppleM4A\",\n}\n\nexport interface AVAssetExportSessionOptions {\n outputURL: string;\n outputFileType?: AVFileType;\n fileLengthLimit?: number;\n timeRange?: CMTimeRange;\n}\n\nexport interface RequestImageOptions\n extends PHImageRequestOptions, SDImageCoderOptions {\n localIdentifier: string;\n targetSize: RequestImageTargetSize;\n contentMode: PHImageContentMode;\n outputURL?: string;\n timeout?: number;\n}\n\nexport interface RequestImageResult {\n size: CGSize;\n scale: number;\n imageOrientation: number;\n}\n\nexport interface RequestVideoOptions\n extends PHVideoRequestOptions, AVAssetExportSessionOptions {\n localIdentifier: string;\n exportPreset: AVAssetExportPreset;\n timeout?: number;\n}\n\nexport enum PHPickerFilter {\n images = \"images\",\n videos = \"videos\",\n any = \"any\",\n}\n\nexport interface PickAssetsOptions {\n filter?: PHPickerFilter;\n selectionLimit?: number;\n}\n\nexport interface PHVideoLoadEvent {\n duration: number;\n naturalSize: { width: number; height: number };\n}\n\nexport interface PHVideoErrorEvent {\n message: string;\n}\n"]}
|
package/build/PHImage.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ViewProps } from "react-native";
|
|
2
|
-
import { PHImageContentMode,
|
|
2
|
+
import { PHImageContentMode, PHImageRequestOptions, RequestImageTargetSize, UIViewContentMode } from "./ExpoPhotos.types";
|
|
3
3
|
export interface PHImageLoadEvent {
|
|
4
4
|
size: {
|
|
5
5
|
width: number;
|
|
@@ -10,12 +10,14 @@ export interface PHImageLoadEvent {
|
|
|
10
10
|
export interface PHImageErrorEvent {
|
|
11
11
|
message: string;
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
14
|
-
localIdentifier: string;
|
|
15
|
-
isNetworkAccessAllowed?: boolean;
|
|
16
|
-
deliveryMode?: PHImageRequestOptionsDeliveryMode;
|
|
17
|
-
resizeMode?: PHImageRequestOptionsResizeMode;
|
|
13
|
+
export interface PHImageViewRequestOptions extends PHImageRequestOptions {
|
|
18
14
|
contentMode?: PHImageContentMode;
|
|
15
|
+
targetSize?: RequestImageTargetSize;
|
|
16
|
+
}
|
|
17
|
+
export interface PHImageViewProps extends ViewProps {
|
|
18
|
+
localIdentifier: string;
|
|
19
|
+
contentMode?: UIViewContentMode;
|
|
20
|
+
requestOptions?: PHImageViewRequestOptions;
|
|
19
21
|
onLoad?: (event: {
|
|
20
22
|
nativeEvent: PHImageLoadEvent;
|
|
21
23
|
}) => void;
|
|
@@ -23,5 +25,5 @@ export interface PHImageProps extends ViewProps {
|
|
|
23
25
|
nativeEvent: PHImageErrorEvent;
|
|
24
26
|
}) => void;
|
|
25
27
|
}
|
|
26
|
-
export declare function
|
|
28
|
+
export declare function PHImageView({ requestOptions, contentMode, ...rest }: PHImageViewProps): import("react").JSX.Element;
|
|
27
29
|
//# sourceMappingURL=PHImage.d.ts.map
|
package/build/PHImage.d.ts.map
CHANGED
|
@@ -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,
|
|
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,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,EAC1B,cAAc,EACd,WAAW,EACX,GAAG,IAAI,EACR,EAAE,gBAAgB,+BAYlB"}
|
package/build/PHImage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { requireNativeViewManager } from "expo-modules-core";
|
|
2
2
|
const NativePHImageView = requireNativeViewManager("ExpoPhotos", "PHImageView");
|
|
3
|
-
export function
|
|
4
|
-
return <NativePHImageView {...
|
|
3
|
+
export function PHImageView({ requestOptions, contentMode, ...rest }) {
|
|
4
|
+
return (<NativePHImageView viewContentMode={contentMode} requestContentMode={requestOptions?.contentMode} isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed} deliveryMode={requestOptions?.deliveryMode} resizeMode={requestOptions?.resizeMode} targetSize={requestOptions?.targetSize} {...rest}/>);
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=PHImage.js.map
|
package/build/PHImage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PHImage.js","sourceRoot":"","sources":["../src/PHImage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;
|
|
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"]}
|
package/build/PHVideo.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ViewProps } from "react-native";
|
|
2
2
|
import { PHVideoLoadEvent, PHVideoErrorEvent, PHVideoRequestOptions } from "./ExpoPhotos.types";
|
|
3
|
-
export interface
|
|
3
|
+
export interface PHVideoViewRequestOptions extends PHVideoRequestOptions {
|
|
4
|
+
}
|
|
5
|
+
export interface PHVideoViewProps extends ViewProps {
|
|
4
6
|
localIdentifier: string;
|
|
7
|
+
requestOptions?: PHVideoViewRequestOptions;
|
|
5
8
|
onLoad?: (event: {
|
|
6
9
|
nativeEvent: PHVideoLoadEvent;
|
|
7
10
|
}) => void;
|
|
@@ -9,5 +12,5 @@ export interface PHVideoProps extends ViewProps, PHVideoRequestOptions {
|
|
|
9
12
|
nativeEvent: PHVideoErrorEvent;
|
|
10
13
|
}) => void;
|
|
11
14
|
}
|
|
12
|
-
export declare function
|
|
15
|
+
export declare function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps): import("react").JSX.Element;
|
|
13
16
|
//# sourceMappingURL=PHVideo.d.ts.map
|
package/build/PHVideo.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/build/PHVideo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { requireNativeViewManager } from "expo-modules-core";
|
|
2
2
|
const NativePHVideoView = requireNativeViewManager("ExpoPhotos", "PHVideoView");
|
|
3
|
-
export function
|
|
4
|
-
return <NativePHVideoView {...
|
|
3
|
+
export function PHVideoView({ requestOptions, ...rest }) {
|
|
4
|
+
return (<NativePHVideoView isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed} deliveryMode={requestOptions?.deliveryMode} {...rest}/>);
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=PHVideo.js.map
|
package/build/PHVideo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PHVideo.js","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;
|
|
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"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default } from "./ExpoPhotosModule";
|
|
2
2
|
export * from "./ExpoPhotos.types";
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
3
|
+
export { PHImageView } from "./PHImage";
|
|
4
|
+
export type { PHImageViewProps, PHImageViewRequestOptions, PHImageLoadEvent, PHImageErrorEvent } from "./PHImage";
|
|
5
|
+
export { PHVideoView } from "./PHVideo";
|
|
6
|
+
export type { PHVideoViewProps, PHVideoViewRequestOptions } from "./PHVideo";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default } from "./ExpoPhotosModule";
|
|
2
2
|
export * from "./ExpoPhotos.types";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { PHImageView } from "./PHImage";
|
|
4
|
+
export { PHVideoView } from "./PHVideo";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default } from \"./ExpoPhotosModule\";\nexport * from \"./ExpoPhotos.types\";\nexport { PHImageView } from \"./PHImage\";\nexport type { PHImageViewProps, PHImageViewRequestOptions, PHImageLoadEvent, PHImageErrorEvent } from \"./PHImage\";\nexport { PHVideoView } from \"./PHVideo\";\nexport type { PHVideoViewProps, PHVideoViewRequestOptions } from \"./PHVideo\";\n"]}
|
|
@@ -264,43 +264,37 @@ public final class ExpoPhotos: Module {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
AsyncFunction("presentLimitedLibraryPicker") { () async throws -> Void in
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
|
292
|
-
|
|
293
|
-
return picker
|
|
294
|
-
}
|
|
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
|
+
}
|
|
295
282
|
|
|
296
|
-
|
|
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
|
+
}
|
|
297
292
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
self.pickAssetsContinuations[pickerId] = continuation
|
|
293
|
+
let picker = PHPickerViewController(configuration: config)
|
|
294
|
+
picker.delegate = self
|
|
301
295
|
|
|
302
|
-
|
|
303
|
-
|
|
296
|
+
self.pickAssetsContinuations[picker.id] = continuation
|
|
297
|
+
viewController.present(picker, animated: true)
|
|
304
298
|
}
|
|
305
299
|
}
|
|
306
300
|
}
|
|
@@ -322,8 +316,16 @@ public final class ExpoPhotos: Module {
|
|
|
322
316
|
view.resizeMode = resizeMode ?? .none
|
|
323
317
|
}
|
|
324
318
|
|
|
325
|
-
Prop("
|
|
326
|
-
view.
|
|
319
|
+
Prop("requestContentMode") { (view: PHImageView, contentMode: PHImageContentMode?) in
|
|
320
|
+
view.requestContentMode = contentMode ?? .aspectFill
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
Prop("viewContentMode") { (view: PHImageView, contentMode: UIView.ContentMode?) in
|
|
324
|
+
view.viewContentMode = contentMode ?? .scaleAspectFill
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
Prop("targetSize") { (view: PHImageView, targetSize: TargetSize?) in
|
|
328
|
+
view.targetSize = targetSize?.value
|
|
327
329
|
}
|
|
328
330
|
|
|
329
331
|
Events("onLoad", "onError")
|
|
@@ -496,6 +498,8 @@ extension PHVideoRequestOptionsDeliveryMode: @retroactive Convertible {}
|
|
|
496
498
|
extension AVFileType: @retroactive Convertible {}
|
|
497
499
|
extension PHAccessLevel: @retroactive Convertible {}
|
|
498
500
|
|
|
501
|
+
extension UIView.ContentMode: @retroactive Convertible {}
|
|
502
|
+
|
|
499
503
|
extension PHPickerFilter: @retroactive Convertible {
|
|
500
504
|
public static func convert(from value: Any?, appContext: AppContext) throws -> Self {
|
|
501
505
|
guard let rawValue = value as? String else {
|
package/ios/PHImageView.swift
CHANGED
|
@@ -41,20 +41,35 @@ public final class PHImageView: ExpoView {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var targetSize: CGSize? {
|
|
45
45
|
didSet {
|
|
46
|
-
if
|
|
47
|
-
imageView.contentMode = imageContentMode == .aspectFit ? .scaleAspectFit : .scaleAspectFill
|
|
46
|
+
if targetSize != oldValue {
|
|
48
47
|
loadImage()
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
|
|
52
|
+
var requestContentMode: PHImageContentMode = .aspectFill {
|
|
53
|
+
didSet {
|
|
54
|
+
if requestContentMode != oldValue {
|
|
55
|
+
loadImage()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var viewContentMode: UIView.ContentMode = .scaleAspectFill {
|
|
61
|
+
didSet {
|
|
62
|
+
if viewContentMode != oldValue {
|
|
63
|
+
imageView.contentMode = viewContentMode
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
public required init(appContext: AppContext? = nil) {
|
|
54
69
|
imageView = UIImageView()
|
|
55
70
|
super.init(appContext: appContext)
|
|
56
71
|
imageView.clipsToBounds = true
|
|
57
|
-
imageView.contentMode =
|
|
72
|
+
imageView.contentMode = viewContentMode
|
|
58
73
|
addSubview(imageView)
|
|
59
74
|
}
|
|
60
75
|
|
|
@@ -88,12 +103,12 @@ public final class PHImageView: ExpoView {
|
|
|
88
103
|
options.resizeMode = resizeMode
|
|
89
104
|
|
|
90
105
|
let scale = window?.screen.scale ?? UIScreen.main.scale
|
|
91
|
-
let
|
|
106
|
+
let boundsSize = CGSize(width: bounds.width * scale, height: bounds.height * scale)
|
|
92
107
|
|
|
93
108
|
currentRequestId = PHImageManager.default().requestImage(
|
|
94
109
|
for: asset,
|
|
95
|
-
targetSize: targetSize,
|
|
96
|
-
contentMode:
|
|
110
|
+
targetSize: targetSize ?? boundsSize,
|
|
111
|
+
contentMode: requestContentMode,
|
|
97
112
|
options: options
|
|
98
113
|
) { [weak self] image, info in
|
|
99
114
|
guard let self = self else { return }
|
package/package.json
CHANGED
package/src/ExpoPhotos.types.ts
CHANGED
|
@@ -22,23 +22,23 @@ export enum PHAccessLevel {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export enum PHAssetMediaType {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
unknown = 0,
|
|
26
|
+
image = 1,
|
|
27
|
+
video = 2,
|
|
28
|
+
audio = 3,
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export enum PHAssetMediaSubtype {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
none = 0,
|
|
33
|
+
photoPanorama = 1 << 0,
|
|
34
|
+
photoHDR = 1 << 1,
|
|
35
|
+
photoScreenshot = 1 << 2,
|
|
36
|
+
photoLive = 1 << 3,
|
|
37
|
+
photoDepthEffect = 1 << 4,
|
|
38
|
+
videoStreamed = 1 << 16,
|
|
39
|
+
videoHighFrameRate = 1 << 17,
|
|
40
|
+
videoTimelapse = 1 << 18,
|
|
41
|
+
videoCinematic = 1 << 19,
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export interface NSSortDescriptor {
|
|
@@ -64,15 +64,15 @@ export type PHImageManagerMaximumSize = "PHImageManagerMaximumSize";
|
|
|
64
64
|
export type RequestImageTargetSize = CGSize | PHImageManagerMaximumSize;
|
|
65
65
|
|
|
66
66
|
export enum PHImageRequestOptionsResizeMode {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
none = 0,
|
|
68
|
+
fast = 1,
|
|
69
|
+
exact = 2,
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export enum PHImageRequestOptionsDeliveryMode {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
opportunistic = 0,
|
|
74
|
+
highQualityFormat = 1,
|
|
75
|
+
fastFormat = 2,
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export enum PHImageContentMode {
|
|
@@ -80,6 +80,21 @@ export enum PHImageContentMode {
|
|
|
80
80
|
aspectFill = 1,
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
export enum UIViewContentMode {
|
|
84
|
+
scaleToFill = 0,
|
|
85
|
+
scaleAspectFit = 1,
|
|
86
|
+
scaleAspectFill = 2,
|
|
87
|
+
redraw = 3,
|
|
88
|
+
center = 4,
|
|
89
|
+
top = 5,
|
|
90
|
+
bottom = 6,
|
|
91
|
+
left = 7,
|
|
92
|
+
right = 8,
|
|
93
|
+
topLeft = 9,
|
|
94
|
+
topRight = 10,
|
|
95
|
+
bottomLeft = 11,
|
|
96
|
+
bottomRight = 12,
|
|
97
|
+
}
|
|
83
98
|
export interface PHImageRequestOptions {
|
|
84
99
|
isNetworkAccessAllowed?: boolean;
|
|
85
100
|
resizeMode?: PHImageRequestOptionsResizeMode;
|
|
@@ -92,10 +107,10 @@ export interface SDImageCoderOptions {
|
|
|
92
107
|
}
|
|
93
108
|
|
|
94
109
|
export enum PHVideoRequestOptionsDeliveryMode {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
110
|
+
automatic = 0,
|
|
111
|
+
highQualityFormat = 1,
|
|
112
|
+
mediumQualityFormat = 2,
|
|
113
|
+
fastFormat = 3,
|
|
99
114
|
}
|
|
100
115
|
|
|
101
116
|
export interface PHVideoRequestOptions {
|
|
@@ -174,8 +189,7 @@ export interface AVAssetExportSessionOptions {
|
|
|
174
189
|
}
|
|
175
190
|
|
|
176
191
|
export interface RequestImageOptions
|
|
177
|
-
extends PHImageRequestOptions,
|
|
178
|
-
SDImageCoderOptions {
|
|
192
|
+
extends PHImageRequestOptions, SDImageCoderOptions {
|
|
179
193
|
localIdentifier: string;
|
|
180
194
|
targetSize: RequestImageTargetSize;
|
|
181
195
|
contentMode: PHImageContentMode;
|
|
@@ -190,8 +204,7 @@ export interface RequestImageResult {
|
|
|
190
204
|
}
|
|
191
205
|
|
|
192
206
|
export interface RequestVideoOptions
|
|
193
|
-
extends PHVideoRequestOptions,
|
|
194
|
-
AVAssetExportSessionOptions {
|
|
207
|
+
extends PHVideoRequestOptions, AVAssetExportSessionOptions {
|
|
195
208
|
localIdentifier: string;
|
|
196
209
|
exportPreset: AVAssetExportPreset;
|
|
197
210
|
timeout?: number;
|
package/src/PHImage.tsx
CHANGED
|
@@ -2,8 +2,9 @@ import { requireNativeViewManager } from "expo-modules-core";
|
|
|
2
2
|
import { ViewProps } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
PHImageContentMode,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
PHImageRequestOptions,
|
|
6
|
+
RequestImageTargetSize,
|
|
7
|
+
UIViewContentMode,
|
|
7
8
|
} from "./ExpoPhotos.types";
|
|
8
9
|
|
|
9
10
|
export interface PHImageLoadEvent {
|
|
@@ -15,18 +16,35 @@ export interface PHImageErrorEvent {
|
|
|
15
16
|
message: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export interface
|
|
19
|
-
localIdentifier: string;
|
|
20
|
-
isNetworkAccessAllowed?: boolean;
|
|
21
|
-
deliveryMode?: PHImageRequestOptionsDeliveryMode;
|
|
22
|
-
resizeMode?: PHImageRequestOptionsResizeMode;
|
|
19
|
+
export interface PHImageViewRequestOptions extends PHImageRequestOptions {
|
|
23
20
|
contentMode?: PHImageContentMode;
|
|
21
|
+
targetSize?: RequestImageTargetSize;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface PHImageViewProps extends ViewProps {
|
|
25
|
+
localIdentifier: string;
|
|
26
|
+
contentMode?: UIViewContentMode;
|
|
27
|
+
requestOptions?: PHImageViewRequestOptions;
|
|
24
28
|
onLoad?: (event: { nativeEvent: PHImageLoadEvent }) => void;
|
|
25
29
|
onError?: (event: { nativeEvent: PHImageErrorEvent }) => void;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
const NativePHImageView = requireNativeViewManager("ExpoPhotos", "PHImageView");
|
|
29
33
|
|
|
30
|
-
export function
|
|
31
|
-
|
|
34
|
+
export function PHImageView({
|
|
35
|
+
requestOptions,
|
|
36
|
+
contentMode,
|
|
37
|
+
...rest
|
|
38
|
+
}: PHImageViewProps) {
|
|
39
|
+
return (
|
|
40
|
+
<NativePHImageView
|
|
41
|
+
viewContentMode={contentMode}
|
|
42
|
+
requestContentMode={requestOptions?.contentMode}
|
|
43
|
+
isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}
|
|
44
|
+
deliveryMode={requestOptions?.deliveryMode}
|
|
45
|
+
resizeMode={requestOptions?.resizeMode}
|
|
46
|
+
targetSize={requestOptions?.targetSize}
|
|
47
|
+
{...rest}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
32
50
|
}
|
package/src/PHVideo.tsx
CHANGED
|
@@ -6,14 +6,23 @@ import {
|
|
|
6
6
|
PHVideoRequestOptions,
|
|
7
7
|
} from "./ExpoPhotos.types";
|
|
8
8
|
|
|
9
|
-
export interface
|
|
9
|
+
export interface PHVideoViewRequestOptions extends PHVideoRequestOptions {}
|
|
10
|
+
|
|
11
|
+
export interface PHVideoViewProps extends ViewProps {
|
|
10
12
|
localIdentifier: string;
|
|
13
|
+
requestOptions?: PHVideoViewRequestOptions;
|
|
11
14
|
onLoad?: (event: { nativeEvent: PHVideoLoadEvent }) => void;
|
|
12
15
|
onError?: (event: { nativeEvent: PHVideoErrorEvent }) => void;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
const NativePHVideoView = requireNativeViewManager("ExpoPhotos", "PHVideoView");
|
|
16
19
|
|
|
17
|
-
export function
|
|
18
|
-
return
|
|
20
|
+
export function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps) {
|
|
21
|
+
return (
|
|
22
|
+
<NativePHVideoView
|
|
23
|
+
isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}
|
|
24
|
+
deliveryMode={requestOptions?.deliveryMode}
|
|
25
|
+
{...rest}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
19
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default } from "./ExpoPhotosModule";
|
|
2
2
|
export * from "./ExpoPhotos.types";
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
3
|
+
export { PHImageView } from "./PHImage";
|
|
4
|
+
export type { PHImageViewProps, PHImageViewRequestOptions, PHImageLoadEvent, PHImageErrorEvent } from "./PHImage";
|
|
5
|
+
export { PHVideoView } from "./PHVideo";
|
|
6
|
+
export type { PHVideoViewProps, PHVideoViewRequestOptions } from "./PHVideo";
|