mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-06 07:06:11 +00:00
fix: add check in RNSVGImage for macos platform (#2324)
# Summary add check-in RNSVGImage for the Maco platform
This commit is contained in:
@@ -210,15 +210,20 @@ using namespace facebook::react;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self->_image = CGImageRetain(image.CGImage);
|
||||
self->_imageSize = CGSizeMake(CGImageGetWidth(self->_image), CGImageGetHeight(self->_image));
|
||||
if (self->_onLoad) {
|
||||
RCTImageSource *sourceLoaded = [src imageSourceWithSize:image.size scale:image.scale];
|
||||
NSDictionary *dict = @{
|
||||
@"uri" : sourceLoaded.request.URL.absoluteString,
|
||||
@"width" : @(sourceLoaded.size.width),
|
||||
@"height" : @(sourceLoaded.size.height),
|
||||
};
|
||||
self->_onLoad(@{@"source" : dict});
|
||||
}
|
||||
if (self->_onLoad) {
|
||||
RCTImageSource *sourceLoaded;
|
||||
#if TARGET_OS_OSX // [macOS]
|
||||
sourceLoaded = [src imageSourceWithSize:image.size scale:1];
|
||||
#else
|
||||
sourceLoaded = [src imageSourceWithSize:image.size scale:image.scale];
|
||||
#endif
|
||||
NSDictionary *dict = @{
|
||||
@"uri" : sourceLoaded.request.URL.absoluteString,
|
||||
@"width" : @(sourceLoaded.size.width),
|
||||
@"height" : @(sourceLoaded.size.height),
|
||||
};
|
||||
self->_onLoad(@{@"source" : dict});
|
||||
}
|
||||
[self invalidate];
|
||||
});
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user