mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 07:06:04 +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(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
self->_image = CGImageRetain(image.CGImage);
|
self->_image = CGImageRetain(image.CGImage);
|
||||||
self->_imageSize = CGSizeMake(CGImageGetWidth(self->_image), CGImageGetHeight(self->_image));
|
self->_imageSize = CGSizeMake(CGImageGetWidth(self->_image), CGImageGetHeight(self->_image));
|
||||||
if (self->_onLoad) {
|
if (self->_onLoad) {
|
||||||
RCTImageSource *sourceLoaded = [src imageSourceWithSize:image.size scale:image.scale];
|
RCTImageSource *sourceLoaded;
|
||||||
NSDictionary *dict = @{
|
#if TARGET_OS_OSX // [macOS]
|
||||||
@"uri" : sourceLoaded.request.URL.absoluteString,
|
sourceLoaded = [src imageSourceWithSize:image.size scale:1];
|
||||||
@"width" : @(sourceLoaded.size.width),
|
#else
|
||||||
@"height" : @(sourceLoaded.size.height),
|
sourceLoaded = [src imageSourceWithSize:image.size scale:image.scale];
|
||||||
};
|
#endif
|
||||||
self->_onLoad(@{@"source" : dict});
|
NSDictionary *dict = @{
|
||||||
}
|
@"uri" : sourceLoaded.request.URL.absoluteString,
|
||||||
|
@"width" : @(sourceLoaded.size.width),
|
||||||
|
@"height" : @(sourceLoaded.size.height),
|
||||||
|
};
|
||||||
|
self->_onLoad(@{@"source" : dict});
|
||||||
|
}
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
});
|
});
|
||||||
}];
|
}];
|
||||||
|
|||||||
Reference in New Issue
Block a user