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:
Jakub Grzywacz
2024-07-31 16:27:35 +02:00
committed by GitHub
parent 7acbee41f3
commit cec99a5035
3 changed files with 128 additions and 7 deletions

View File

@@ -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);
}

View File

@@ -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);