Skip to content

Commit

Permalink
fix: implement protocol on RNSVGImage.mm
Browse files Browse the repository at this point in the history
  • Loading branch information
WoLewicki committed Aug 19, 2024
1 parent c659a11 commit b0de2a9
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion apple/Elements/RNSVGImage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ - (void)didReceiveImage:(UIImage *)image metadata:(id)metadata fromObserver:(voi
});
}

- (void)didReceiveFailure:(nonnull NSError *)error fromObserver:(nonnull const void *)observer
{
if (_image) {
CGImageRelease(_image);
}
_image = nil;
}

- (void)didReceiveProgress:(float)progress
loaded:(int64_t)loaded
total:(int64_t)total
fromObserver:(nonnull const void *)observer
{
}

#pragma mark - RCTImageResponseDelegate - < RN 0.75

- (void)didReceiveProgress:(float)progress fromObserver:(void const *)observer
{
}
Expand Down Expand Up @@ -183,6 +200,7 @@ - (void)prepareForRecycle
_imageSize = CGSizeZero;
_reloadImageCancellationBlock = nil;
}

#endif // RCT_NEW_ARCH_ENABLED

- (void)setSrc:(RCTImageSource *)src
Expand Down Expand Up @@ -218,7 +236,7 @@ - (void)setSrc:(RCTImageSource *)src
#if TARGET_OS_OSX // [macOS]
sourceLoaded = [src imageSourceWithSize:image.size scale:1];
#else
sourceLoaded = [src imageSourceWithSize:image.size scale:image.scale];
sourceLoaded = [src imageSourceWithSize:image.size scale:image.scale];
#endif
NSDictionary *dict = @{
@"uri" : sourceLoaded.request.URL.absoluteString,
Expand Down

0 comments on commit b0de2a9

Please sign in to comment.