Skip to content

Instantly share code, notes, and snippets.

@ryanlntn
Last active June 21, 2024 02:00
Show Gist options
  • Save ryanlntn/33f10e4b1dcb07948799a221e71c88ae to your computer and use it in GitHub Desktop.
Save ryanlntn/33f10e4b1dcb07948799a221e71c88ae to your computer and use it in GitHub Desktop.
diff --git a/node_modules/react-native-svg/apple/Elements/RNSVGSvgView.h b/node_modules/react-native-svg/apple/Elements/RNSVGSvgView.h
index e589dad..4c0e6a3 100644
--- a/node_modules/react-native-svg/apple/Elements/RNSVGSvgView.h
+++ b/node_modules/react-native-svg/apple/Elements/RNSVGSvgView.h
@@ -12,18 +12,9 @@
#import "RNSVGPainter.h"
#import "RNSVGVBMOS.h"
-#ifdef RCT_NEW_ARCH_ENABLED
-#import <React/RCTViewComponentView.h>
-#endif // RCT_NEW_ARCH_ENABLED
-
@class RNSVGNode;
-@interface RNSVGSvgView :
-#ifdef RCT_NEW_ARCH_ENABLED
- RCTViewComponentView <RNSVGContainer>
-#else
- RNSVGView <RNSVGContainer>
-#endif // RCT_NEW_ARCH_ENABLED
+@interface RNSVGSvgView : RNSVGView <RNSVGContainer>
@property (nonatomic, strong) RNSVGLength *bbWidth;
@property (nonatomic, strong) RNSVGLength *bbHeight;
diff --git a/node_modules/react-native-svg/apple/RNSVGNode.h b/node_modules/react-native-svg/apple/RNSVGNode.h
index 3c65e10..1e6ab43 100644
--- a/node_modules/react-native-svg/apple/RNSVGNode.h
+++ b/node_modules/react-native-svg/apple/RNSVGNode.h
@@ -12,10 +12,6 @@
#import <React/RCTPointerEvents.h>
#import <React/UIView+React.h>
-#ifdef RCT_NEW_ARCH_ENABLED
-#import <React/RCTViewComponentView.h>
-#endif // RCT_NEW_ARCH_ENABLED
-
@class RNSVGGroup;
/**
@@ -23,12 +19,7 @@
*interfaces for all non-definition nodes.
*/
-@interface RNSVGNode :
-#ifdef RCT_NEW_ARCH_ENABLED
- RCTViewComponentView
-#else
- RNSVGView
-#endif // RCT_NEW_ARCH_ENABLED
+@interface RNSVGNode : RNSVGView
/*
N[1/Sqrt[2], 36]
The inverse of the square root of 2.
diff --git a/node_modules/react-native-svg/apple/RNSVGUIKit.h b/node_modules/react-native-svg/apple/RNSVGUIKit.h
index 3562fe4..7fa2fd5 100644
--- a/node_modules/react-native-svg/apple/RNSVGUIKit.h
+++ b/node_modules/react-native-svg/apple/RNSVGUIKit.h
@@ -1,6 +1,10 @@
// Most (if not all) of this file could probably go away once react-native-macos's version of RCTUIKit.h makes its way
// upstream. https://github.com/microsoft/react-native-macos/issues/242
+#ifdef RCT_NEW_ARCH_ENABLED
+#import <React/RCTViewComponentView.h>
+#endif // RCT_NEW_ARCH_ENABLED
+
#if !TARGET_OS_OSX
#import <UIKit/UIKit.h>
@@ -8,7 +12,11 @@
#define RNSVGColor UIColor
#define RNSVGPlatformView UIView
#define RNSVGTextView UILabel
+#ifdef RCT_NEW_ARCH_ENABLED
+#define RNSVGView RCTViewComponentView
+#else
#define RNSVGView UIView
+#endif // RCT_NEW_ARCH_ENABLED
#else // TARGET_OS_OSX [
@@ -29,7 +37,16 @@ extern "C" {
#define RNSVGPlatformView NSView
#define RNSVGTextView NSTextView
-@interface RNSVGView : RCTUIView
+@interface RNSVGColor (CGColor)
+- (NSColor *)CGColor;
+@end
+
+@interface RNSVGView :
+#ifdef RCT_NEW_ARCH_ENABLED
+ RCTViewComponentView
+#else
+ RCTUIView
+#endif // RCT_NEW_ARCH_ENABLED
@property CGPoint center;
@property (nonatomic, strong) RNSVGColor *tintColor;
diff --git a/node_modules/react-native-svg/apple/Utils/RNSVGFabricConversions.h b/node_modules/react-native-svg/apple/Utils/RNSVGFabricConversions.h
index 0e0f521..2da6257 100644
--- a/node_modules/react-native-svg/apple/Utils/RNSVGFabricConversions.h
+++ b/node_modules/react-native-svg/apple/Utils/RNSVGFabricConversions.h
@@ -127,7 +127,11 @@ void setCommonNodeProps(const T &nodeProps, RNSVGNode *node)
node.pointerEvents = RCTPointerEventsUnspecified;
}
node.accessibilityIdentifier = RCTNSStringFromStringNilIfEmpty(nodeProps.testId);
+#if !TARGET_OS_OSX
node.isAccessibilityElement = nodeProps.accessible;
+#else
+ node.accessibilityElement = nodeProps.accessible;
+#endif // !TARGET_OS_OSX
node.accessibilityLabel = RCTNSStringFromStringNilIfEmpty(nodeProps.accessibilityLabel);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment