1 // Most (if not all) of this file could probably go away once react-native-macos's version of RCTUIKit.h makes its way
2 // upstream. https://github.com/microsoft/react-native-macos/issues/242
3 
4 #if !TARGET_OS_OSX
5 
6 #import <UIKit/UIKit.h>
7 
8 #define RNSVGColor UIColor
9 #define RNSVGPlatformView UIView
10 #define RNSVGTextView UILabel
11 #define RNSVGView UIView
12 
13 #else // TARGET_OS_OSX [
14 
15 // Due to name mangling, calling c-style functions from .mm files will fail, therefore we need to wrap them with extern
16 // "C" so they are handled correctly. We also need to have imports positioned in a correct way, so that this extern "C"
17 // wrapper is used before the functions from RCTUIKit are used.
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #import <React/RCTUIKit.h>
23 
24 #ifdef __cplusplus
25 }
26 #endif
27 
28 #define RNSVGColor NSColor
29 #define RNSVGPlatformView NSView
30 #define RNSVGTextView NSTextView
31 
32 @interface RNSVGView : RCTUIView
33 
34 @property CGPoint center;
35 @property (nonatomic, strong) RNSVGColor *tintColor;
36 
37 @end
38 
39 // TODO: These could probably be a part of react-native-macos
40 // See https://github.com/microsoft/react-native-macos/issues/658 and
41 // https://github.com/microsoft/react-native-macos/issues/659
42 @interface NSImage (RNSVGMacOSExtensions)
43 @property (readonly) CGImageRef CGImage;
44 @end
45 
46 @interface NSValue (RNSVGMacOSExtensions)
47 + (NSValue *)valueWithCGAffineTransform:(CGAffineTransform)transform;
48 + (NSValue *)valueWithCGPoint:(CGPoint)point;
49 
50 @property (readonly) CGAffineTransform CGAffineTransformValue;
51 @property (readonly) CGPoint CGPointValue;
52 @end
53 
54 #endif // ] TARGET_OS_OSX
55