mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add Spec for ImageEditor (#24921)
Summary: This PR solves part of this issue: #24875 ## Changelog [General] [Added] - TM Spec for ImageEditor Pull Request resolved: https://github.com/facebook/react-native/pull/24921 Reviewed By: rickhanlonii Differential Revision: D15471058 Pulled By: fkgozali fbshipit-source-id: f01539fc8acea95fca27ce7bb4b4169ffe138d93
This commit is contained in:
committed by
Facebook Github Bot
parent
122cc8ba8a
commit
d2ef114538
@@ -8,9 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const RCTImageEditingManager = require('../BatchedBridge/NativeModules')
|
||||
.ImageEditingManager;
|
||||
import NativeImageEditor from './NativeImageEditor';
|
||||
|
||||
type ImageCropData = {
|
||||
/**
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
Reference in New Issue
Block a user