mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-01 06:07:41 +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:
@@ -17,6 +17,10 @@
|
||||
#define RNSVGView UIView
|
||||
#endif // RCT_NEW_ARCH_ENABLED
|
||||
|
||||
#define RNSVGUIGraphicsBeginImageContextWithOptions UIGraphicsBeginImageContextWithOptions
|
||||
#define RNSVGUIGraphicsEndImageContext UIGraphicsEndImageContext
|
||||
#define RNSVGUIGraphicsGetImageFromCurrentImageContext UIGraphicsGetImageFromCurrentImageContext
|
||||
|
||||
#else // TARGET_OS_OSX [
|
||||
|
||||
// Due to name mangling, calling c-style functions from .mm files will fail, therefore we need to wrap them with extern
|
||||
@@ -67,4 +71,11 @@ extern "C" {
|
||||
@property (readonly) CGPoint CGPointValue;
|
||||
@end
|
||||
|
||||
// These functions are copied from react-native-macos to enable compatibility with react-native-macos@0.76+
|
||||
// https://github.com/microsoft/react-native-macos/blob/7361b165ef633d3d95dbdb69da58ff6119f07369/packages/react-native/React/Base/macOS/RCTUIKit.m
|
||||
// See https://github.com/software-mansion/react-native-svg/issues/2528
|
||||
void RNSVGUIGraphicsBeginImageContextWithOptions(CGSize size, __unused BOOL opaque, CGFloat scale);
|
||||
void RNSVGUIGraphicsEndImageContext(void);
|
||||
NSImage *RNSVGUIGraphicsGetImageFromCurrentImageContext(void);
|
||||
|
||||
#endif // ] TARGET_OS_OSX
|
||||
|
||||
Reference in New Issue
Block a user