expo-image-manipulator 13.0.2 → 13.0.3
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 +6 -0
- package/android/build.gradle +2 -2
- package/build/ImageManipulator.d.ts +2 -1
- package/build/ImageManipulator.d.ts.map +1 -1
- package/build/ImageManipulator.types.d.ts +2 -1
- package/build/ImageManipulator.types.d.ts.map +1 -1
- package/ios/ImageManipulatorModule.swift +8 -2
- package/package.json +2 -2
- package/src/ImageManipulator.ts +3 -2
- package/src/ImageManipulator.types.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 13.0.3 — 2024-10-25
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- [iOS] Added support for image refs in `ImageManipulator.manipulate` and `useImageManipulator`. ([#32346](https://github.com/expo/expo/pull/32346) by [@tsapeta](https://github.com/tsapeta))
|
|
18
|
+
|
|
13
19
|
## 13.0.2 — 2024-10-24
|
|
14
20
|
|
|
15
21
|
### 💡 Others
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '13.0.
|
|
4
|
+
version = '13.0.3'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,7 +14,7 @@ android {
|
|
|
14
14
|
namespace "expo.modules.imagemanipulator"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 23
|
|
17
|
-
versionName "13.0.
|
|
17
|
+
versionName "13.0.3"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SharedRef } from 'expo-modules-core/types';
|
|
1
2
|
import { Action, ImageResult, SaveOptions } from './ImageManipulator.types';
|
|
2
3
|
import { ImageManipulatorContext } from './ImageManipulatorContext';
|
|
3
4
|
import ExpoImageManipulator from './NativeImageManipulatorModule';
|
|
@@ -15,6 +16,6 @@ import ExpoImageManipulator from './NativeImageManipulatorModule';
|
|
|
15
16
|
* Use [`ImageManipulator.manipulate`](#manipulateuri) or [`useImageManipulator`](#useimagemanipulatoruri) instead.
|
|
16
17
|
*/
|
|
17
18
|
export declare function manipulateAsync(uri: string, actions?: Action[], saveOptions?: SaveOptions): Promise<ImageResult>;
|
|
18
|
-
export declare function useImageManipulator(
|
|
19
|
+
export declare function useImageManipulator(source: string | SharedRef<'image'>): ImageManipulatorContext;
|
|
19
20
|
export { ExpoImageManipulator as ImageManipulator };
|
|
20
21
|
//# sourceMappingURL=ImageManipulator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageManipulator.d.ts","sourceRoot":"","sources":["../src/ImageManipulator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImageManipulator.d.ts","sourceRoot":"","sources":["../src/ImageManipulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAc,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,oBAAoB,MAAM,gCAAgC,CAAC;AAIlE;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,EAAO,EACtB,WAAW,GAAE,WAAgB,GAC5B,OAAO,CAAC,WAAW,CAAC,CA2BtB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,uBAAuB,CAEhG;AAED,OAAO,EAAE,oBAAoB,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NativeModule } from 'expo';
|
|
2
|
+
import { SharedRef } from 'expo-modules-core/types';
|
|
2
3
|
import type { ImageManipulatorContext } from './ImageManipulatorContext';
|
|
3
4
|
import ImageRef from './ImageRef';
|
|
4
5
|
export type ImageResult = {
|
|
@@ -114,6 +115,6 @@ export declare class ImageManipulator extends NativeModule {
|
|
|
114
115
|
/**
|
|
115
116
|
* Loads an image from the given URI and creates a new image manipulation context.
|
|
116
117
|
*/
|
|
117
|
-
manipulate(
|
|
118
|
+
manipulate(source: string | SharedRef<'image'>): ImageManipulatorContext;
|
|
118
119
|
}
|
|
119
120
|
//# sourceMappingURL=ImageManipulator.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageManipulator.types.d.ts","sourceRoot":"","sources":["../src/ImageManipulator.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ImageManipulator.types.d.ts","sourceRoot":"","sources":["../src/ImageManipulator.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF,MAAM,MAAM,Y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O,OAAO,gBAAiB,SAAQ,YAAY;IACxD;;OAEG;IACH,OAAO,EAAE,OAAO,uBAAuB,CAAC;IAExC;;OAEG;IACH,KAAK,EAAE,OAAO,QAAQ,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,uBAAuB;CACzE"}
|
|
@@ -10,12 +10,18 @@ public class ImageManipulatorModule: Module {
|
|
|
10
10
|
public func definition() -> ModuleDefinition {
|
|
11
11
|
Name("ExpoImageManipulator")
|
|
12
12
|
|
|
13
|
-
Function("manipulate") { (
|
|
13
|
+
Function("manipulate") { (source: Either<URL, SharedRef<UIImage>>) -> ImageManipulatorContext in
|
|
14
14
|
let context = ImageManipulatorContext { [weak appContext] in
|
|
15
15
|
guard let appContext else {
|
|
16
16
|
throw Exceptions.AppContextLost()
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
if let url: URL = source.get() {
|
|
19
|
+
return try await loadImage(atUrl: url, appContext: appContext)
|
|
20
|
+
}
|
|
21
|
+
if let image: SharedRef<UIImage> = source.get() {
|
|
22
|
+
return image.ref
|
|
23
|
+
}
|
|
24
|
+
throw Exceptions.RuntimeLost()
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
// Immediately try to fix the orientation once the image is loaded
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-image-manipulator",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.3",
|
|
4
4
|
"description": "Provides functions that let you manipulation images on the local file system, eg: resize, crop.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"expo": "*"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "5ad642a63afa9190ceb4e57dd52c8bdf71d93dd8"
|
|
43
43
|
}
|
package/src/ImageManipulator.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useReleasingSharedObject } from 'expo-modules-core';
|
|
2
|
+
import { SharedRef } from 'expo-modules-core/types';
|
|
2
3
|
|
|
3
4
|
import { Action, ImageResult, SaveFormat, SaveOptions } from './ImageManipulator.types';
|
|
4
5
|
import { ImageManipulatorContext } from './ImageManipulatorContext';
|
|
@@ -52,8 +53,8 @@ export async function manipulateAsync(
|
|
|
52
53
|
return result;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
export function useImageManipulator(
|
|
56
|
-
return useReleasingSharedObject(() => ExpoImageManipulator.manipulate(
|
|
56
|
+
export function useImageManipulator(source: string | SharedRef<'image'>): ImageManipulatorContext {
|
|
57
|
+
return useReleasingSharedObject(() => ExpoImageManipulator.manipulate(source), [source]);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export { ExpoImageManipulator as ImageManipulator };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NativeModule } from 'expo';
|
|
2
|
+
import { SharedRef } from 'expo-modules-core/types';
|
|
2
3
|
|
|
3
4
|
import type { ImageManipulatorContext } from './ImageManipulatorContext';
|
|
4
5
|
import ImageRef from './ImageRef';
|
|
@@ -138,5 +139,5 @@ export declare class ImageManipulator extends NativeModule {
|
|
|
138
139
|
/**
|
|
139
140
|
* Loads an image from the given URI and creates a new image manipulation context.
|
|
140
141
|
*/
|
|
141
|
-
manipulate(
|
|
142
|
+
manipulate(source: string | SharedRef<'image'>): ImageManipulatorContext;
|
|
142
143
|
}
|