mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
bf78d7969a
Summary: This diff moves RCTImageLoader, RCTImageEditingManager, and RCTImageStoreManager to CoreModules. This is necessary for us to convert all these NativeModules to TurboModules. **Note:** As a part of this diff, I had to break apart `RCTImageLoader.h`. All the protocols that were in `RCTImageLoader` are now in their own headers. Furthermore, `RCTImageLoader`'s methods are defined in `RCTImageLoaderProtocol`, so that we can call them from classes like `RCTImageViewManager` in `RCTImage`. Reviewed By: PeteTheHeat Differential Revision: D16805827 fbshipit-source-id: 89f6728b0766c30b74e25f7af1be8e6b8a7e6397
54 lines
1.9 KiB
Objective-C
54 lines
1.9 KiB
Objective-C
/**
|
|
* 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.
|
|
*/
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import <React/RCTBridge.h>
|
|
#import <React/RCTResizeMode.h>
|
|
#import <React/RCTURLRequestHandler.h>
|
|
#import <React/RCTImageURLLoader.h>
|
|
|
|
/**
|
|
* Provides the interface needed to register an image decoder. Image decoders
|
|
* are also bridge modules, so should be registered using RCT_EXPORT_MODULE().
|
|
*/
|
|
@protocol RCTImageDataDecoder <RCTBridgeModule>
|
|
|
|
/**
|
|
* Indicates whether this handler is capable of decoding the specified data.
|
|
* Typically the handler would examine some sort of header data to determine
|
|
* this.
|
|
*/
|
|
- (BOOL)canDecodeImageData:(NSData *)imageData;
|
|
|
|
/**
|
|
* Decode an image from the data object. The method should call the
|
|
* completionHandler when the decoding operation has finished. The method
|
|
* should also return a cancellation block, if applicable.
|
|
*
|
|
* If you provide a custom image decoder, you most implement scheduling yourself,
|
|
* to avoid decoding large amounts of images at the same time.
|
|
*/
|
|
- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData
|
|
size:(CGSize)size
|
|
scale:(CGFloat)scale
|
|
resizeMode:(RCTResizeMode)resizeMode
|
|
completionHandler:(RCTImageLoaderCompletionBlock)completionHandler;
|
|
|
|
@optional
|
|
|
|
/**
|
|
* If more than one RCTImageDataDecoder responds YES to `-canDecodeImageData:`
|
|
* then `decoderPriority` is used to determine which one to use. The decoder
|
|
* with the highest priority will be selected. Default priority is zero.
|
|
* If two or more valid decoders have the same priority, the selection order is
|
|
* undefined.
|
|
*/
|
|
- (float)decoderPriority;
|
|
|
|
@end
|