Skip to content

Commit 643b056

Browse files
authored
replace all references to 10.14 (#938)
1 parent 5ad4444 commit 643b056

File tree

6 files changed

+41
-62
lines changed

6 files changed

+41
-62
lines changed

Libraries/Image/RCTImageView.mm

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,18 +649,12 @@ - (RCTPlatformView *)reactAccessibilityElement
649649

650650
- (NSColor *)tintColor
651651
{
652-
NSColor *tintColor = nil;
653-
if (@available(macOS 10.14, *)) {
654-
tintColor = _imageView.contentTintColor;
655-
}
656-
return tintColor;
652+
return _imageView.contentTintColor;
657653
}
658654

659655
- (void)setTintColor:(NSColor *)tintColor
660656
{
661-
if (@available(macOS 10.14, *)) {
662-
_imageView.contentTintColor = tintColor;
663-
}
657+
_imageView.contentTintColor = tintColor;
664658
}
665659
#endif // ]TODO(macOS GH#774)
666660

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ You can read more about the macOS implementation on our website - [React Native
6262

6363
## Requirements
6464

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.
6666

6767
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.
6868

React-Core.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Pod::Spec.new do |s|
7878
end
7979

8080
s.subspec "Hermes" do |ss|
81-
ss.platforms = { :osx => "10.15" }
81+
ss.platforms = { :osx => "10.15", :ios => "11.0" }
8282
ss.source_files = "ReactCommon/hermes/executor/*.{cpp,h}",
8383
"ReactCommon/hermes/inspector/*.{cpp,h}",
8484
"ReactCommon/hermes/inspector/chrome/*.{cpp,h}",

React/Base/macOS/RCTDynamicColor.m

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,12 @@ - (void)encodeWithCoder:(NSCoder *)aCoder
5959
- (NSColor *)effectiveColor
6060
{
6161
NSColor *effectiveColor = _aquaColor;
62-
if (@available(macOS 10.14, *)) {
63-
NSAppearance *appearance = [NSAppearance currentAppearance] ?: [NSApp effectiveAppearance];
62+
NSAppearance *appearance = [NSAppearance currentAppearance] ?: [NSApp effectiveAppearance];
6463

65-
NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
64+
NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
6665

67-
if (_darkAquaColor != nil && [appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
68-
effectiveColor = _darkAquaColor;
69-
}
66+
if (_darkAquaColor != nil && [appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
67+
effectiveColor = _darkAquaColor;
7068
}
7169
return effectiveColor;
7270
}

React/CoreModules/RCTAppearance.mm

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,24 @@ void RCTOverrideAppearancePreference(NSString *const colorSchemeOverride)
6666
#else // [TODO(macOS GH#774)
6767
NSString *RCTColorSchemePreference(NSAppearance *appearance)
6868
{
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;
8882
}
8983

90-
// Default to light on older OS version - same behavior as Android.
91-
return RCTAppearanceColorSchemeLight;
84+
appearance = appearance ?: [NSAppearance currentAppearance];
85+
NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
86+
return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight;
9287
}
9388
#endif // ]TODO(macOS GH#774)
9489

@@ -165,7 +160,7 @@ - (void)appearanceChanged:(NSNotification *)notification
165160

166161
- (void)startObserving
167162
{
168-
if (@available(macOS 10.14, iOS 13.0, *)) { // TODO(macOS GH#774)
163+
if (@available(iOS 13.0, *)) {
169164
[[NSNotificationCenter defaultCenter] addObserver:self
170165
selector:@selector(appearanceChanged:)
171166
name:RCTUserInterfaceStyleDidChangeNotification
@@ -175,7 +170,7 @@ - (void)startObserving
175170

176171
- (void)stopObserving
177172
{
178-
if (@available(macOS 10.14, iOS 13.0, *)) { // TODO(macOS GH#774)
173+
if (@available(iOS 13.0, *)) {
179174
[[NSNotificationCenter defaultCenter] removeObserver:self];
180175
}
181176
}

packages/rn-tester/RNTesterUnitTests/RCTConvert_NSColorTests.m

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,14 @@ - (void)testAlternatingColorEven
5555
{
5656
id json = RCTJSONParse(@"{ \"semantic\": \"alternatingContentBackgroundColorEven\" }", nil);
5757
NSColor *value = [RCTConvert UIColor:json];
58-
if (@available(macOS 10.14, *)) {
59-
XCTAssertEqualObjects(value, [NSColor alternatingContentBackgroundColors][0]);
60-
}
58+
XCTAssertEqualObjects(value, [NSColor alternatingContentBackgroundColors][0]);
6159
}
6260

6361
- (void)testAlternatingColorOdd
6462
{
6563
id json = RCTJSONParse(@"{ \"semantic\": \"alternatingContentBackgroundColorOdd\" }", nil);
6664
NSColor *value = [RCTConvert UIColor:json];
67-
if (@available(macOS 10.14, *)) {
68-
XCTAssertEqualObjects(value, [NSColor alternatingContentBackgroundColors][1]);
69-
}
65+
XCTAssertEqualObjects(value, [NSColor alternatingContentBackgroundColors][1]);
7066
}
7167

7268
- (void)testAlternatingColorFallbackEven
@@ -99,14 +95,12 @@ - (void)testDynamicColor
9995
XCTAssertEqual(b, 0);
10096
XCTAssertEqual(a, 0);
10197

102-
if (@available(macOS 10.14, *)) {
103-
[NSAppearance setCurrentAppearance:[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]];
104-
[value getRed:&r green:&g blue:&b alpha:&a];
105-
XCTAssertEqual(r, 1);
106-
XCTAssertEqual(g, 1);
107-
XCTAssertEqual(b, 1);
108-
XCTAssertEqual(a, 0);
109-
}
98+
[NSAppearance setCurrentAppearance:[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]];
99+
[value getRed:&r green:&g blue:&b alpha:&a];
100+
XCTAssertEqual(r, 1);
101+
XCTAssertEqual(g, 1);
102+
XCTAssertEqual(b, 1);
103+
XCTAssertEqual(a, 0);
110104

111105
[NSAppearance setCurrentAppearance:nil];
112106
}
@@ -127,15 +121,13 @@ - (void)testCompositeDynamicColor
127121
XCTAssertEqual(b1, b2);
128122
XCTAssertEqual(a1, a2);
129123

130-
if (@available(macOS 10.14, *)) {
131-
[NSAppearance setCurrentAppearance:[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]];
132-
[[value colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&r1 green:&g1 blue:&b1 alpha:&a1];
133-
[[[NSColor systemBlueColor] colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&r2 green:&g2 blue:&b2 alpha:&a2];
134-
XCTAssertEqual(r1, r2);
135-
XCTAssertEqual(g1, g2);
136-
XCTAssertEqual(b1, b2);
137-
XCTAssertEqual(a1, a2);
138-
}
124+
[NSAppearance setCurrentAppearance:[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]];
125+
[[value colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&r1 green:&g1 blue:&b1 alpha:&a1];
126+
[[[NSColor systemBlueColor] colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&r2 green:&g2 blue:&b2 alpha:&a2];
127+
XCTAssertEqual(r1, r2);
128+
XCTAssertEqual(g1, g2);
129+
XCTAssertEqual(b1, b2);
130+
XCTAssertEqual(a1, a2);
139131

140132
[NSAppearance setCurrentAppearance:nil];
141133
}

0 commit comments

Comments
 (0)