2015-03-23 13:28:42 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-02-19 20:10:52 -08:00
|
|
|
|
|
|
|
#import "RCTStaticImageManager.h"
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
|
|
|
#import "RCTConvert.h"
|
2015-03-05 16:36:41 -08:00
|
|
|
#import "RCTStaticImage.h"
|
2015-02-19 20:10:52 -08:00
|
|
|
|
|
|
|
@implementation RCTStaticImageManager
|
|
|
|
|
2015-04-08 05:42:43 -07:00
|
|
|
RCT_EXPORT_MODULE()
|
|
|
|
|
2015-02-19 20:10:52 -08:00
|
|
|
- (UIView *)view
|
|
|
|
{
|
|
|
|
return [[RCTStaticImage alloc] init];
|
|
|
|
}
|
|
|
|
|
2015-03-25 21:29:28 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(capInsets, UIEdgeInsets)
|
2015-07-14 04:06:17 -07:00
|
|
|
RCT_REMAP_VIEW_PROPERTY(imageTag, src, NSString)
|
2015-06-05 08:46:17 -07:00
|
|
|
RCT_REMAP_VIEW_PROPERTY(resizeMode, contentMode, UIViewContentMode)
|
2015-07-14 04:06:17 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(src, NSString)
|
2015-03-25 21:29:28 -07:00
|
|
|
RCT_CUSTOM_VIEW_PROPERTY(tintColor, UIColor, RCTStaticImage)
|
2015-02-19 20:10:52 -08:00
|
|
|
{
|
|
|
|
if (json) {
|
|
|
|
view.renderingMode = UIImageRenderingModeAlwaysTemplate;
|
|
|
|
view.tintColor = [RCTConvert UIColor:json];
|
|
|
|
} else {
|
|
|
|
view.renderingMode = defaultView.renderingMode;
|
|
|
|
view.tintColor = defaultView.tintColor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|