Skip to content

Commit

Permalink
Add Spec for ImageEditor (facebook#24921)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yjose authored and M-i-k-e-l committed Mar 10, 2020
1 parent 1001fb1 commit ae150b8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Libraries/Image/ImageEditor.js
Expand Up @@ -8,9 +8,7 @@
* @format
*/
'use strict';

const RCTImageEditingManager = require('../BatchedBridge/NativeModules')
.ImageEditingManager;
import NativeImageEditor from './NativeImageEditor';

type ImageCropData = {
/**
Expand Down Expand Up @@ -66,7 +64,7 @@ class ImageEditor {
success: (uri: string) => void,
failure: (error: Object) => void,
) {
RCTImageEditingManager.cropImage(uri, cropData, success, failure);
NativeImageEditor.cropImage(uri, cropData, success, failure);
}
}

Expand Down
25 changes: 25 additions & 0 deletions Libraries/Image/NativeImageEditor.js
@@ -0,0 +1,25 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

'use strict';

import type {TurboModule} from 'RCTExport';
import * as TurboModuleRegistry from 'TurboModuleRegistry';

export interface Spec extends TurboModule {
+cropImage: (
uri: string,
options: Object, // TODO: type this better
success: (uri: string) => void,
error: (error: string) => void,
) => void;
}

export default TurboModuleRegistry.getEnforcing<Spec>('ImageEditingManager');

0 comments on commit ae150b8

Please sign in to comment.