Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions packages/react-native/Libraries/Image/RCTImageEditingManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,22 @@ @implementation RCTImageEditingManager
* be scaled down to `displaySize` rather than `size`.
* All units are in px (not points).
*/
RCT_EXPORT_METHOD(
cropImage : (NSURLRequest *)imageRequest cropData : (JS::NativeImageEditor::Options &)cropData successCallback : (
RCTResponseSenderBlock)successCallback errorCallback : (RCTResponseSenderBlock)errorCallback)
- (void)cropImage:(NSString *)imageRequestString
cropData:(JS::NativeImageEditor::Options &)cropData
successCallback:(RCTResponseSenderBlock)successCallback
errorCallback:(RCTResponseSenderBlock)errorCallback
{
NSURLRequest *imageRequest = [RCTConvert NSURLRequest:imageRequestString];

CGRect rect = {
[RCTConvert CGPoint:@{
@"x" : @(cropData.offset().x()),
@"y" : @(cropData.offset().y()),
}],
[RCTConvert CGSize:@{
@"width" : @(cropData.size().width()),
@"height" : @(cropData.size().height()),
}]
};
[RCTConvert CGPoint:@{
@"x" : @(cropData.offset().x()),
@"y" : @(cropData.offset().y()),
}],
[RCTConvert CGSize:@{
@"width" : @(cropData.size().width()),
@"height" : @(cropData.size().height()),
}]};

// We must keep a copy of cropData so that we can access data from it at a later time
JS::NativeImageEditor::Options cropDataCopy = cropData;
Expand Down
Loading