Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions Libraries/Image/RCTAnimatedImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ - (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale

_imageSource = imageSource;

#if TARGET_OS_OSX // [TODO(macOS ISS#2323203)
self = [super initWithData:data];
#else // ]TODO(macOS ISS#2323203)
// grab image at the first index
UIImage *image = [self animatedImageFrameAtIndex:0];
if (!image) {
return nil;
}
#if TARGET_OS_OSX // [TODO(macOS ISS#2323203)
self = [image copy];
#else // ]TODO(macOS ISS#2323203)
self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:image.imageOrientation];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
Expand Down
13 changes: 6 additions & 7 deletions Libraries/Image/RCTUIImageViewAnimated.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ - (void)setImage:(UIImage *)image
return;
}

#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
#if TARGET_OS_OSX
super.image = image;
Comment thread
marty-wang marked this conversation as resolved.
Outdated
#else // TODO(macOS ISS#2323203)
[self stop];
#endif // TODO(macOS ISS#2323203)

[self resetAnimatedImage];

Comment thread
marty-wang marked this conversation as resolved.
Outdated
if ([image respondsToSelector:@selector(animatedImageFrameAtIndex:)]) {
NSUInteger animatedImageFrameCount = ((UIImage<RCTAnimatedImage> *)image).animatedImageFrameCount;
// In case frame count is 0, there is no reason to continue.
Expand All @@ -116,19 +116,18 @@ - (void)setImage:(UIImage *)image
self.frameBuffer[@(self.currentFrameIndex)] = self.currentFrame;
dispatch_semaphore_signal(self.lock);

#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
// Calculate max buffer size
[self calculateMaxBufferCount];

if ([self paused]) {
[self start];
}
#endif // TODO(macOS ISS#2323203)


[self.layer setNeedsDisplay];
} else {
super.image = image;
}
#endif // TODO(macOS ISS#2323203)
}

#pragma mark - Private
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/examples/Image/ImageExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ exports.examples = [
/>
);
},
platform: 'ios',
platform: ['ios', 'macos'], // TODO(OSS Candidate ISS#2710739)
},
{
title: 'Base64 image',
Expand Down