Skip to content

Commit d2ef114

Browse files
yjosefacebook-github-bot
authored andcommitted
Add Spec for ImageEditor (facebook#24921)
Summary: This PR solves part of this issue: facebook#24875 ## Changelog [General] [Added] - TM Spec for ImageEditor Pull Request resolved: facebook#24921 Reviewed By: rickhanlonii Differential Revision: D15471058 Pulled By: fkgozali fbshipit-source-id: f01539fc8acea95fca27ce7bb4b4169ffe138d93
1 parent 122cc8b commit d2ef114

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

Libraries/Image/ImageEditor.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
* @format
99
*/
1010
'use strict';
11-
12-
const RCTImageEditingManager = require('../BatchedBridge/NativeModules')
13-
.ImageEditingManager;
11+
import NativeImageEditor from './NativeImageEditor';
1412

1513
type ImageCropData = {
1614
/**
@@ -66,7 +64,7 @@ class ImageEditor {
6664
success: (uri: string) => void,
6765
failure: (error: Object) => void,
6866
) {
69-
RCTImageEditingManager.cropImage(uri, cropData, success, failure);
67+
NativeImageEditor.cropImage(uri, cropData, success, failure);
7068
}
7169
}
7270

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
* @format
9+
*/
10+
11+
'use strict';
12+
13+
import type {TurboModule} from 'RCTExport';
14+
import * as TurboModuleRegistry from 'TurboModuleRegistry';
15+
16+
export interface Spec extends TurboModule {
17+
+cropImage: (
18+
uri: string,
19+
options: Object, // TODO: type this better
20+
success: (uri: string) => void,
21+
error: (error: string) => void,
22+
) => void;
23+
}
24+
25+
export default TurboModuleRegistry.getEnforcing<Spec>('ImageEditingManager');

0 commit comments

Comments
 (0)