mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-09 04:08:11 +08:00
- Add back providesModule transform to JSAppServer | Joseph Savona - [ReactKit] fix open source performance issue | John Harper - [ReactKit] improve ReactIOSEventEmitter logics | Andrew Rasmussen - [reactkit] fix web view JS executor and bind it to Command-d | John Harper - Removed hardcoded RCTModuleIDs | Nick Lockwood - [ReactKit] Animated GIF support | Alex Akers - [ReactKit] Update RCTBridge to support non-`id` argument types | Alex Akers - [reactkit] fix typo in RCTCopyProperty() change | John Harper - [reactkit] fix shadow view crash on missing properties | John Harper - [reactkit] fix transform keypath | John Harper
50 lines
1.3 KiB
Objective-C
50 lines
1.3 KiB
Objective-C
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#import "RCTStaticImageManager.h"
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import "RCTStaticImage.h"
|
|
#import "RCTConvert.h"
|
|
|
|
@implementation RCTStaticImageManager
|
|
|
|
- (UIView *)view
|
|
{
|
|
return [[RCTStaticImage alloc] init];
|
|
}
|
|
|
|
RCT_REMAP_VIEW_PROPERTY(resizeMode, contentMode)
|
|
|
|
- (void)set_src:(id)json forView:(RCTStaticImage *)view withDefaultView:(RCTStaticImage *)defaultView
|
|
{
|
|
if (json) {
|
|
if ([json isKindOfClass:[NSString class]] && [[json pathExtension] caseInsensitiveCompare:@"gif"] == NSOrderedSame) {
|
|
[view.layer addAnimation:[RCTConvert GIF:json] forKey:@"contents"];
|
|
} else {
|
|
view.image = [RCTConvert UIImage:json];
|
|
}
|
|
} else {
|
|
view.image = defaultView.image;
|
|
}
|
|
}
|
|
|
|
- (void)set_capInsets:(id)json forView:(RCTStaticImage *)view withDefaultView:(RCTStaticImage *)defaultView
|
|
{
|
|
view.capInsets = json ? [RCTConvert UIEdgeInsets:json] : defaultView.capInsets;
|
|
}
|
|
|
|
- (void)set_tintColor:(id)json forView:(RCTStaticImage *)view withDefaultView:(RCTStaticImage *)defaultView
|
|
{
|
|
if (json) {
|
|
view.renderingMode = UIImageRenderingModeAlwaysTemplate;
|
|
view.tintColor = [RCTConvert UIColor:json];
|
|
} else {
|
|
view.renderingMode = defaultView.renderingMode;
|
|
view.tintColor = defaultView.tintColor;
|
|
}
|
|
}
|
|
|
|
@end
|
|
|