RCTImageCache.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #import <UIKit/UIKit.h>
  8. #import <Foundation/Foundation.h>
  9. #import <React/RCTResizeMode.h>
  10. @interface UIImage (React)
  11. /**
  12. * Memory bytes of the image with the default calculation of static image or GIF. Custom calculations of decoded bytes can be assigned manually.
  13. */
  14. @property (nonatomic, assign) NSInteger reactDecodedImageBytes;
  15. @end
  16. /**
  17. * Provides an interface to use for providing a image caching strategy.
  18. */
  19. @protocol RCTImageCache <NSObject>
  20. - (UIImage *)imageForUrl:(NSString *)url
  21. size:(CGSize)size
  22. scale:(CGFloat)scale
  23. resizeMode:(RCTResizeMode)resizeMode;
  24. - (void)addImageToCache:(UIImage *)image
  25. URL:(NSString *)url
  26. size:(CGSize)size
  27. scale:(CGFloat)scale
  28. resizeMode:(RCTResizeMode)resizeMode
  29. response:(NSURLResponse *)response;
  30. @end
  31. @interface RCTImageCache : NSObject <RCTImageCache>
  32. @end