mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-06 07:06:11 +00:00
fix: mac os crashes (#2385)
# Summary Fix some crashes on MacOS * patch `reanimated` * update fabric type * invert axis in `FeOffset`
This commit is contained in:
@@ -34,16 +34,12 @@ using namespace facebook::react;
|
||||
const auto &newProps = static_cast<const RNSVGFeMergeProps &>(*props);
|
||||
|
||||
if (newProps.nodes.size() > 0) {
|
||||
NSMutableArray *nodesArray = [NSMutableArray new];
|
||||
NSMutableArray<NSString *> *nodesArray = [NSMutableArray new];
|
||||
for (auto node : newProps.nodes) {
|
||||
id json = RNSVGConvertFollyDynamicToId(node);
|
||||
if ([json isKindOfClass:[NSString class]]) {
|
||||
[nodesArray addObject:[json stringValue]];
|
||||
}
|
||||
[nodesArray addObject:[NSString stringWithCString:node.c_str() encoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
self.nodes = nodesArray;
|
||||
}
|
||||
|
||||
setCommonFilterProps(newProps, self);
|
||||
_props = std::static_pointer_cast<RNSVGFeMergeProps const>(props);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#import "RNSVGFeOffset.h"
|
||||
#if TARGET_OS_OSX
|
||||
#import "RNSVGRenderUtils.h"
|
||||
#endif
|
||||
|
||||
#ifdef RCT_NEW_ARCH_ENABLED
|
||||
#import <React/RCTConversions.h>
|
||||
@@ -106,8 +109,14 @@ using namespace facebook::react;
|
||||
|
||||
// reset ctm translation
|
||||
CGAffineTransform contextTransform = CGAffineTransformConcat(ctm, CGAffineTransformMakeTranslation(-ctm.tx, -ctm.ty));
|
||||
|
||||
#if !TARGET_OS_OSX // [macOS]
|
||||
CGPoint translate = CGPointMake(dx, dy);
|
||||
#else
|
||||
CGPoint translate = CGPointMake(dx, -dy);
|
||||
CGFloat scale = [RNSVGRenderUtils getScreenScale];
|
||||
CGAffineTransform screenScaleCTM = CGAffineTransformMake(scale, 0, 0, scale, 0, 0);
|
||||
translate = CGPointApplyAffineTransform(translate, screenScaleCTM);
|
||||
#endif
|
||||
translate = CGPointApplyAffineTransform(translate, contextTransform);
|
||||
CGAffineTransform transform = CGAffineTransformMakeTranslation(translate.x, translate.y);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user