mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 15:44:24 +00:00
fix: react-native-macos@0.76+ (#2531)
# Summary On `react-native-macos` 0.76, `UIGraphicsBeginImageContextWithOptions` and some other UIGraphics directives were removed so the temporary solution is to copy the removed functions here. More details here https://github.com/software-mansion/react-native-svg/issues/2528 and here https://github.com/microsoft/react-native-macos/pull/2209 Closes #2528 ## Test Plan Built the `fabric-macos-example` for with `react-native-macos@0.76.0` ## Compatibility | OS | Implemented | | ------- | :---------: | | MacOS | ✅ | ## Checklist - [x] I have tested this on a device and a simulator
This commit is contained in:
@@ -11,6 +11,10 @@
|
||||
#import "RNSVGFabricConversions.h"
|
||||
#endif // RCT_NEW_ARCH_ENABLED
|
||||
|
||||
#if TARGET_OS_OSX // [macOS
|
||||
#import "RNSVGUIKit.h"
|
||||
#endif // macOS]
|
||||
|
||||
@implementation RNSVGFilter {
|
||||
NSMutableDictionary<NSString *, CIImage *> *resultsMap;
|
||||
}
|
||||
@@ -142,7 +146,7 @@ using namespace facebook::react;
|
||||
|
||||
- (CGContext *)openContext:(CGSize)size
|
||||
{
|
||||
UIGraphicsBeginImageContextWithOptions(size, NO, 1.0);
|
||||
RNSVGUIGraphicsBeginImageContextWithOptions(size, NO, 1.0);
|
||||
CGContextRef cropContext = UIGraphicsGetCurrentContext();
|
||||
#if TARGET_OS_OSX
|
||||
CGFloat scale = [RNSVGRenderUtils getScreenScale];
|
||||
@@ -156,7 +160,7 @@ using namespace facebook::react;
|
||||
|
||||
- (void)endContext:(CGContext *)context
|
||||
{
|
||||
UIGraphicsEndImageContext();
|
||||
RNSVGUIGraphicsEndImageContext();
|
||||
}
|
||||
|
||||
- (CIImage *)getMaskFromRect:(CGContext *)context rect:(CGRect)rect ctm:(CGAffineTransform)ctm
|
||||
|
||||
Reference in New Issue
Block a user