react-native-macos 0.66.12 → 0.66.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 66,
15
- patch: 12,
15
+ patch: 13,
16
16
  prerelease: null,
17
17
  };
@@ -649,18 +649,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
649
649
 
650
650
  - (NSColor *)tintColor
651
651
  {
652
- NSColor *tintColor = nil;
653
- if (@available(macOS 10.14, *)) {
654
- tintColor = _imageView.contentTintColor;
655
- }
656
- return tintColor;
652
+ return _imageView.contentTintColor;
657
653
  }
658
654
 
659
655
  - (void)setTintColor:(NSColor *)tintColor
660
656
  {
661
- if (@available(macOS 10.14, *)) {
662
- _imageView.contentTintColor = tintColor;
663
- }
657
+ _imageView.contentTintColor = tintColor;
664
658
  }
665
659
  #endif // ]TODO(macOS GH#774)
666
660
 
@@ -18,6 +18,8 @@ export opaque type NativeColorValue = {
18
18
  dynamic?: {
19
19
  light: ?(ColorValue | ProcessedColorValue),
20
20
  dark: ?(ColorValue | ProcessedColorValue),
21
+ highContrastLight?: ?(ColorValue | ProcessedColorValue),
22
+ highContrastDark?: ?(ColorValue | ProcessedColorValue),
21
23
  },
22
24
  colorWithSystemEffect?: {
23
25
  baseColor: ?(ColorValue | ProcessedColorValue),
@@ -51,12 +53,21 @@ export const ColorWithSystemEffectMacOSPrivate = (
51
53
  export type DynamicColorMacOSTuplePrivate = {
52
54
  light: ColorValue,
53
55
  dark: ColorValue,
56
+ highContrastLight?: ColorValue,
57
+ highContrastDark?: ColorValue,
54
58
  };
55
59
 
56
60
  export const DynamicColorMacOSPrivate = (
57
61
  tuple: DynamicColorMacOSTuplePrivate,
58
62
  ): ColorValue => {
59
- return {dynamic: {light: tuple.light, dark: tuple.dark}};
63
+ return {
64
+ dynamic: {
65
+ light: tuple.light,
66
+ dark: tuple.dark,
67
+ highContrastLight: tuple.highContrastLight,
68
+ highContrastDark: tuple.highContrastDark,
69
+ },
70
+ };
60
71
  };
61
72
 
62
73
  export const normalizeColorObject = (
@@ -74,6 +85,8 @@ export const normalizeColorObject = (
74
85
  dynamic: {
75
86
  light: normalizeColor(dynamic.light),
76
87
  dark: normalizeColor(dynamic.dark),
88
+ highContrastLight: normalizeColor(dynamic.highContrastLight),
89
+ highContrastDark: normalizeColor(dynamic.highContrastDark),
77
90
  },
78
91
  };
79
92
  return dynamicColor;
@@ -104,6 +117,8 @@ export const processColorObject = (
104
117
  dynamic: {
105
118
  light: processColor(dynamic.light),
106
119
  dark: processColor(dynamic.dark),
120
+ highContrastLight: processColor(dynamic.highContrastLight),
121
+ highContrastDark: processColor(dynamic.highContrastDark),
107
122
  },
108
123
  };
109
124
  return dynamicColor;
@@ -15,6 +15,8 @@ import type {ColorValue} from './StyleSheet';
15
15
  export type DynamicColorMacOSTuple = {
16
16
  light: ColorValue,
17
17
  dark: ColorValue,
18
+ highContrastLight?: ColorValue,
19
+ highContrastDark?: ColorValue,
18
20
  };
19
21
 
20
22
  export const DynamicColorMacOS = (
@@ -19,12 +19,19 @@ import {
19
19
  export type DynamicColorMacOSTuple = {
20
20
  light: ColorValue,
21
21
  dark: ColorValue,
22
+ highContrastLight?: ColorValue,
23
+ highContrastDark?: ColorValue,
22
24
  };
23
25
 
24
26
  export const DynamicColorMacOS = (
25
27
  tuple: DynamicColorMacOSTuple,
26
28
  ): ColorValue => {
27
- return DynamicColorMacOSPrivate({light: tuple.light, dark: tuple.dark});
29
+ return DynamicColorMacOSPrivate({
30
+ light: tuple.light,
31
+ dark: tuple.dark,
32
+ highContrastLight: tuple.highContrastLight,
33
+ highContrastDark: tuple.highContrastDark,
34
+ });
28
35
  };
29
36
 
30
37
  export type SystemEffectMacOS =
package/README.md CHANGED
@@ -62,7 +62,7 @@ You can read more about the macOS implementation on our website - [React Native
62
62
 
63
63
  ## Requirements
64
64
 
65
- You can run React Native for macOS apps on Mac devices with versions Mojave (10.14) or newer.
65
+ You can run React Native for macOS apps on Mac devices with versions Catalina (10.15) or newer.
66
66
 
67
67
  For a full and detailed list of the system requirements and how to set up your development platform, see our [System Requirements](https://microsoft.github.io/react-native-windows/docs/rnm-dependencies) documentation on our website.
68
68
 
@@ -16,10 +16,6 @@
16
16
  #import "RCTParserUtils.h"
17
17
  #import "RCTUtils.h"
18
18
 
19
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
20
- #import "RCTDynamicColor.h"
21
- #endif // ]TODO(macOS GH#774)
22
-
23
19
  @implementation RCTConvert
24
20
 
25
21
  RCT_CONVERTER(id, id, self)
@@ -1043,7 +1039,28 @@ static NSColor *RCTColorWithSystemEffect(NSColor* color, NSString *systemEffectS
1043
1039
  RCTUIColor *highContrastDarkColor = [RCTConvert UIColor:highContrastDark]; // TODO(macOS GH#750)
1044
1040
  if (lightColor != nil && darkColor != nil) {
1045
1041
  #if TARGET_OS_OSX
1046
- RCTDynamicColor *color = [[RCTDynamicColor alloc] initWithAquaColor:lightColor darkAquaColor:darkColor];
1042
+ NSColor *color = [NSColor colorWithName:nil dynamicProvider:^NSColor * _Nonnull(NSAppearance * _Nonnull appearance) {
1043
+ NSMutableArray<NSAppearanceName> *appearances = [NSMutableArray arrayWithArray:@[NSAppearanceNameAqua,NSAppearanceNameDarkAqua]];
1044
+ if (highContrastLightColor != nil) {
1045
+ [appearances addObject:NSAppearanceNameAccessibilityHighContrastAqua];
1046
+ }
1047
+ if (highContrastDarkColor != nil) {
1048
+ [appearances addObject:NSAppearanceNameAccessibilityHighContrastDarkAqua];
1049
+ }
1050
+ NSAppearanceName bestMatchingAppearance = [appearance bestMatchFromAppearancesWithNames:appearances];
1051
+ if (bestMatchingAppearance == NSAppearanceNameAqua) {
1052
+ return lightColor;
1053
+ } else if (bestMatchingAppearance == NSAppearanceNameDarkAqua) {
1054
+ return darkColor;
1055
+ } else if (bestMatchingAppearance == NSAppearanceNameAccessibilityHighContrastAqua) {
1056
+ return highContrastLightColor;
1057
+ } else if (bestMatchingAppearance == NSAppearanceNameAccessibilityHighContrastDarkAqua) {
1058
+ return highContrastDarkColor;
1059
+ } else {
1060
+ RCTLogConvertError(json, @"an NSColorColor. Could not resolve current appearance. Defaulting to light.");
1061
+ return lightColor;
1062
+ }
1063
+ }];
1047
1064
  return color;
1048
1065
  #else
1049
1066
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(66),
26
- RCTVersionPatch: @(12),
26
+ RCTVersionPatch: @(13),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -66,29 +66,28 @@ NSString *RCTColorSchemePreference(UITraitCollection *traitCollection)
66
66
  #else // [TODO(macOS GH#774)
67
67
  NSString *RCTColorSchemePreference(NSAppearance *appearance)
68
68
  {
69
- if (@available(macOS 10.14, *)) {
70
- static NSDictionary *appearances;
71
- static dispatch_once_t onceToken;
72
-
73
- dispatch_once(&onceToken, ^{
74
- appearances = @{
75
- NSAppearanceNameAqua: RCTAppearanceColorSchemeLight,
76
- NSAppearanceNameDarkAqua: RCTAppearanceColorSchemeDark
77
- };
78
- });
79
-
80
- if (!sAppearancePreferenceEnabled) {
81
- // Return the default if the app doesn't allow different color schemes.
82
- return RCTAppearanceColorSchemeLight;
83
- }
84
-
85
- appearance = appearance ?: [NSAppearance currentAppearance];
86
- NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
87
- return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight;
69
+ static NSDictionary *appearances;
70
+ static dispatch_once_t onceToken;
71
+
72
+ dispatch_once(&onceToken, ^{
73
+ appearances = @{
74
+ NSAppearanceNameAqua: RCTAppearanceColorSchemeLight,
75
+ NSAppearanceNameDarkAqua: RCTAppearanceColorSchemeDark
76
+ };
77
+ });
78
+
79
+ if (!sAppearancePreferenceEnabled) {
80
+ // Return the default if the app doesn't allow different color schemes.
81
+ return RCTAppearanceColorSchemeLight;
88
82
  }
89
83
 
90
- // Default to light on older OS version - same behavior as Android.
91
- return RCTAppearanceColorSchemeLight;
84
+ if (@available(macOS 11.0, *)) {
85
+ appearance = appearance ?: [NSAppearance currentDrawingAppearance];
86
+ } else {
87
+ appearance = appearance ?: [NSAppearance currentAppearance];
88
+ }
89
+ NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
90
+ return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight;
92
91
  }
93
92
  #endif // ]TODO(macOS GH#774)
94
93
 
@@ -165,7 +164,7 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getColorScheme)
165
164
 
166
165
  - (void)startObserving
167
166
  {
168
- if (@available(macOS 10.14, iOS 13.0, *)) { // TODO(macOS GH#774)
167
+ if (@available(iOS 13.0, *)) {
169
168
  [[NSNotificationCenter defaultCenter] addObserver:self
170
169
  selector:@selector(appearanceChanged:)
171
170
  name:RCTUserInterfaceStyleDidChangeNotification
@@ -175,7 +174,7 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getColorScheme)
175
174
 
176
175
  - (void)stopObserving
177
176
  {
178
- if (@available(macOS 10.14, iOS 13.0, *)) { // TODO(macOS GH#774)
177
+ if (@available(iOS 13.0, *)) {
179
178
  [[NSNotificationCenter defaultCenter] removeObserver:self];
180
179
  }
181
180
  }
@@ -266,16 +266,21 @@ RCT_EXPORT_METHOD(hide)
266
266
 
267
267
  - (void)showOfflineMessage
268
268
  {
269
- RCTUIColor *color = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
270
- RCTUIColor *backgroundColor = [RCTUIColor blackColor]; // TODO(macOS GH#774)
271
-
272
- if ([self isDarkModeEnabled]) {
273
- color = [RCTUIColor blackColor]; // TODO(macOS GH#774)
274
- backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
275
- }
269
+ // [TODO(macOS GH#774) - isDarkModeEnabled should only be run on the main thread
270
+ __weak __typeof(self) weakSelf = self;
271
+ RCTExecuteOnMainQueue(^{
272
+ RCTUIColor *color = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
273
+ RCTUIColor *backgroundColor = [RCTUIColor blackColor]; // TODO(macOS GH#774)
274
+
275
+ if ([weakSelf isDarkModeEnabled]) {
276
+ color = [RCTUIColor blackColor]; // TODO(macOS GH#774)
277
+ backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774)
278
+ }
276
279
 
277
- NSString *message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME];
278
- [self showMessage:message color:color backgroundColor:backgroundColor];
280
+ NSString *message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME];
281
+ [weakSelf showMessage:message color:color backgroundColor:backgroundColor];
282
+ });
283
+ // ]TODO(macOS GH#774)
279
284
  }
280
285
 
281
286
  - (BOOL)isDarkModeEnabled
@@ -361,4 +366,4 @@ RCT_EXPORT_METHOD(hide)
361
366
  Class RCTDevLoadingViewCls(void)
362
367
  {
363
368
  return RCTDevLoadingView.class;
364
- }
369
+ }
@@ -12,7 +12,7 @@
12
12
  #if !TARGET_OS_OSX // TODO(macOS GH#774)
13
13
  @interface RCTSwitch : UISwitch
14
14
  #else // [TODO(macOS GH#774)
15
- @interface RCTSwitch : NSButton
15
+ @interface RCTSwitch : NSSwitch
16
16
  #endif // ]TODO(macOS GH#774)
17
17
 
18
18
  #if !TARGET_OS_OSX // TODO(macOS GH#774)
@@ -7,25 +7,10 @@
7
7
 
8
8
  #import "RCTSwitch.h"
9
9
 
10
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
11
- #import <QuartzCore/QuartzCore.h>
12
- #endif // ]TODO(macOS GH#774)
13
-
14
10
  #import "UIView+React.h"
15
11
 
16
12
  @implementation RCTSwitch
17
13
 
18
- #if TARGET_OS_OSX // [TODO(macOS GH#774)
19
- - (instancetype)initWithFrame:(CGRect)frame
20
- {
21
- if ((self = [super initWithFrame:frame])) {
22
- self.buttonType = NSButtonTypeSwitch;
23
- self.title = @""; // default is "Button"
24
- }
25
- return self;
26
- }
27
- #endif
28
-
29
14
  #if !TARGET_OS_OSX // TODO(macOS GH#774)
30
15
  - (void)setOn:(BOOL)on animated:(BOOL)animated
31
16
  {
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.66.12
1
+ VERSION_NAME=0.66.13
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  POM_NAME=ReactNative
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 66,
20
- "patch", 12,
20
+ "patch", 13,
21
21
  "prerelease", null);
22
22
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 66;
20
- int32_t Patch = 12;
20
+ int32_t Patch = 13;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.66.12",
3
+ "version": "0.66.13",
4
4
  "bin": "./cli.js",
5
5
  "description": "[Microsoft Fork] A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "17.0.2",
14
- "react-native": "0.66.12"
14
+ "react-native": "0.66.13"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.12.9",
@@ -1,28 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- // TODO(macOS GH#774)
9
-
10
- #include <AppKit/AppKit.h>
11
-
12
- /** A dynamic, theme aware subclass of NSColor.
13
- * It is a tuple that contains two NSColors for light and dark
14
- * theme appearances. Like a semantic NSColor or an
15
- * asset catalog named NSColor, the effective color values
16
- * returned by the various methods and properties vary
17
- * depending on the current [NSAppearance currentAppearance].
18
- */
19
- @interface RCTDynamicColor : NSColor
20
-
21
- /** Inits a RCTDynamicColor with a pair of NSColors
22
- * @param aquaColor the color to use when the current appearance is not dark
23
- * @param darkAquaColor the color to use when the current appearance is dark
24
- */
25
- - (instancetype)initWithAquaColor:(NSColor *)aquaColor
26
- darkAquaColor:(nullable NSColor *)darkAquaColor;
27
-
28
- @end
@@ -1,219 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- // TODO(macOS GH#774)
9
-
10
- #import "RCTDynamicColor.h"
11
-
12
- #define RCT_FORWARD_PROPERTY( PROP, TYPE ) \
13
- - (TYPE)PROP { return [[self effectiveColor] PROP]; }
14
-
15
- static NSString *const RCTAquaColor = @"aquaColor";
16
- static NSString *const RCTDarkAquaColor = @"darkAquaColor";
17
-
18
- @implementation RCTDynamicColor
19
- {
20
- NSColor *_aquaColor;
21
- NSColor *_darkAquaColor;
22
- }
23
-
24
- - (instancetype)initWithAquaColor:(NSColor *)aquaColor
25
- darkAquaColor:(NSColor *)darkAquaColor
26
- {
27
- self = [super init];
28
- if (self) {
29
- _aquaColor = [aquaColor copy];
30
- _darkAquaColor = [darkAquaColor copy];
31
- }
32
- return self;
33
- }
34
-
35
- + (BOOL)supportsSecureCoding
36
- {
37
- return YES;
38
- }
39
-
40
- - (instancetype)initWithCoder:(NSCoder *)coder
41
- {
42
- self = [super initWithCoder:coder];
43
- if (self) {
44
- _aquaColor = [coder decodeObjectOfClass:[NSColor class] forKey:RCTAquaColor];
45
- _darkAquaColor = [coder decodeObjectOfClass:[NSColor class] forKey:RCTDarkAquaColor];
46
- }
47
- return self;
48
- }
49
-
50
- - (void)encodeWithCoder:(NSCoder *)aCoder
51
- {
52
- [super encodeWithCoder:aCoder];
53
- [aCoder encodeObject:_aquaColor forKey:RCTAquaColor];
54
- if (_darkAquaColor) {
55
- [aCoder encodeObject:_darkAquaColor forKey:RCTDarkAquaColor];
56
- }
57
- }
58
-
59
- - (NSColor *)effectiveColor
60
- {
61
- NSColor *effectiveColor = _aquaColor;
62
- if (@available(macOS 10.14, *)) {
63
- NSAppearance *appearance = [NSAppearance currentAppearance] ?: [NSApp effectiveAppearance];
64
-
65
- NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
66
-
67
- if (_darkAquaColor != nil && [appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
68
- effectiveColor = _darkAquaColor;
69
- }
70
- }
71
- return effectiveColor;
72
- }
73
-
74
- RCT_FORWARD_PROPERTY(colorSpace, NSColorSpace *)
75
- - (NSColor *)colorUsingColorSpace:(NSColorSpace *)space
76
- {
77
- return [[self effectiveColor] colorUsingColorSpace:space];
78
- }
79
-
80
- RCT_FORWARD_PROPERTY(colorSpaceName, NSColorSpaceName)
81
- - (NSColor *)colorUsingColorSpaceName:(NSColorSpaceName)name
82
- {
83
- return [[self effectiveColor] colorUsingColorSpaceName:name];
84
- }
85
-
86
- RCT_FORWARD_PROPERTY(numberOfComponents, NSInteger)
87
- - (void)getComponents:(CGFloat *)components
88
- {
89
- return [[self effectiveColor] getComponents:components];
90
- }
91
-
92
- #pragma mark - RGB colorspace
93
-
94
- RCT_FORWARD_PROPERTY(redComponent, CGFloat)
95
- RCT_FORWARD_PROPERTY(greenComponent, CGFloat)
96
- RCT_FORWARD_PROPERTY(blueComponent, CGFloat)
97
-
98
- - (void)getRed:(nullable CGFloat *)red green:(nullable CGFloat *)green blue:(nullable CGFloat *)blue alpha:(nullable CGFloat *)alpha
99
- {
100
- return [[self effectiveColor] getRed:red green:green blue:blue alpha:alpha];
101
- }
102
-
103
- #pragma mark - HSB colorspace
104
-
105
- RCT_FORWARD_PROPERTY(hueComponent, CGFloat)
106
- RCT_FORWARD_PROPERTY(saturationComponent, CGFloat)
107
- RCT_FORWARD_PROPERTY(brightnessComponent, CGFloat)
108
-
109
- - (void)getHue:(nullable CGFloat *)hue saturation:(nullable CGFloat *)saturation brightness:(nullable CGFloat *)brightness alpha:(nullable CGFloat *)alpha
110
- {
111
- return [[self effectiveColor] getHue:hue saturation:saturation brightness:brightness alpha:alpha];
112
- }
113
-
114
- #pragma mark - Gray colorspace
115
-
116
- RCT_FORWARD_PROPERTY(whiteComponent, CGFloat)
117
-
118
- - (void)getWhite:(CGFloat *)white alpha:(CGFloat *)alpha
119
- {
120
- return [[self effectiveColor] getWhite:white alpha:alpha];
121
- }
122
-
123
- #pragma mark - CMYK colorspace
124
-
125
- RCT_FORWARD_PROPERTY(cyanComponent, CGFloat)
126
- RCT_FORWARD_PROPERTY(magentaComponent, CGFloat)
127
- RCT_FORWARD_PROPERTY(yellowComponent, CGFloat)
128
- RCT_FORWARD_PROPERTY(blackComponent, CGFloat)
129
-
130
- - (void)getCyan:(nullable CGFloat *)cyan magenta:(nullable CGFloat *)magenta yellow:(nullable CGFloat *)yellow black:(nullable CGFloat *)black alpha:(nullable CGFloat *)alpha
131
- {
132
- return [[self effectiveColor] getCyan:cyan magenta:magenta yellow:yellow black:black alpha:alpha];
133
- }
134
-
135
- #pragma mark - Others
136
-
137
- RCT_FORWARD_PROPERTY(alphaComponent, CGFloat)
138
- RCT_FORWARD_PROPERTY(CGColor, CGColorRef)
139
- RCT_FORWARD_PROPERTY(catalogNameComponent, NSColorListName)
140
- RCT_FORWARD_PROPERTY(colorNameComponent, NSColorName)
141
- RCT_FORWARD_PROPERTY(localizedCatalogNameComponent, NSColorListName)
142
- RCT_FORWARD_PROPERTY(localizedColorNameComponent, NSString *)
143
-
144
- - (void)setStroke
145
- {
146
- [[self effectiveColor] setStroke];
147
- }
148
-
149
- - (void)setFill
150
- {
151
- [[self effectiveColor] setFill];
152
- }
153
-
154
- - (void)set
155
- {
156
- [[self effectiveColor] set];
157
- }
158
-
159
- - (nullable NSColor *)highlightWithLevel:(CGFloat)val
160
- {
161
- return [[self effectiveColor] highlightWithLevel:val];
162
- }
163
-
164
- - (NSColor *)shadowWithLevel:(CGFloat)val
165
- {
166
- return [[self effectiveColor] shadowWithLevel:val];
167
- }
168
-
169
- - (NSColor *)colorWithAlphaComponent:(CGFloat)alpha
170
- {
171
- return [[self effectiveColor] colorWithAlphaComponent:alpha];
172
- }
173
-
174
- - (nullable NSColor *)blendedColorWithFraction:(CGFloat)fraction ofColor:(NSColor *)color
175
- {
176
- return [[self effectiveColor] blendedColorWithFraction:fraction ofColor:color];
177
- }
178
-
179
- - (NSColor *)colorWithSystemEffect:(NSColorSystemEffect)systemEffect NS_AVAILABLE_MAC(10_14)
180
- {
181
- NSColor *aquaColorWithSystemEffect = [_aquaColor colorWithSystemEffect:systemEffect];
182
- NSColor *darkAquaColorWithSystemEffect = [_darkAquaColor colorWithSystemEffect:systemEffect];
183
- return [[RCTDynamicColor alloc] initWithAquaColor:aquaColorWithSystemEffect darkAquaColor:darkAquaColorWithSystemEffect];
184
- }
185
-
186
- - (NSUInteger)hash
187
- {
188
- const NSUInteger prime = 31;
189
- NSUInteger result = 1;
190
- result = prime * result + [_aquaColor hash];
191
- result = prime * result + [_darkAquaColor hash];
192
- return result;
193
- }
194
-
195
- - (BOOL)isEqual:(id)other {
196
- if (other == self) {
197
- return YES;
198
- }
199
-
200
- return other != nil && [other isKindOfClass:[self class]] && [self isEqualToDynamicColor:other];
201
- }
202
-
203
- - (BOOL)isEqualToDynamicColor:(RCTDynamicColor *)other {
204
- if (self == other) {
205
- return YES;
206
- }
207
-
208
- if ([_aquaColor isNotEqualTo:other->_aquaColor]) {
209
- return NO;
210
- }
211
-
212
- if ([_darkAquaColor isNotEqualTo:other->_darkAquaColor]) {
213
- return NO;
214
- }
215
-
216
- return YES;
217
- }
218
-
219
- @end