not-react-native-macos 0.87.1-rc.2 → 0.87.1-rc.4
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.
- package/Libraries/Components/View/ViewPropTypes.js +58 -0
- package/Libraries/NativeComponent/BaseViewConfig.macos.js +66 -11
- package/Libraries/NativeComponent/ViewConfigIgnore.js +5 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +147 -10
- package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js +34 -0
- package/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js +55 -0
- package/Libraries/Utilities/Platform.macos.js +78 -11
- package/React/Base/RCTConvert.mm +49 -0
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +150 -0
- package/ReactCommon/React-Fabric.podspec +9 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformTouch.h +16 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +39 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewEventEmitter.h +39 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewEvents.h +59 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewProps.cpp +113 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewProps.h +66 -0
- package/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +37 -0
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.h +6 -0
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm +31 -0
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/PlatformColorParser.mm +34 -0
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/RCTPlatformColorUtils.mm +23 -0
- package/index.js +10 -0
- package/macos/UIKitCompat/UIKit/UIColor.m +7 -1
- package/package.json +1 -1
|
@@ -183,6 +183,13 @@ static inline NSString *_NSStringFromCString(
|
|
|
183
183
|
static inline facebook::react::ColorComponents _ColorComponentsFromUIColor(UIColor *color)
|
|
184
184
|
{
|
|
185
185
|
CGFloat rgba[4];
|
|
186
|
+
#if TARGET_OS_OSX // [macOS] catalog colours need converting first
|
|
187
|
+
NSColor *rgbColor = [color colorUsingColorSpace:NSColorSpace.sRGBColorSpace];
|
|
188
|
+
if (rgbColor == nil) {
|
|
189
|
+
return {.red = 0, .green = 0, .blue = 0, .alpha = 0};
|
|
190
|
+
}
|
|
191
|
+
color = rgbColor;
|
|
192
|
+
#endif // macOS]
|
|
186
193
|
[color getRed:&rgba[0] green:&rgba[1] blue:&rgba[2] alpha:&rgba[3]];
|
|
187
194
|
return {.red = (float)rgba[0], .green = (float)rgba[1], .blue = (float)rgba[2], .alpha = (float)rgba[3]};
|
|
188
195
|
}
|
|
@@ -204,6 +211,22 @@ UIColor *RCTPlatformColorFromSemanticItems(std::vector<std::string> &semanticIte
|
|
|
204
211
|
if (uiColor != nil) {
|
|
205
212
|
return uiColor;
|
|
206
213
|
}
|
|
214
|
+
#if TARGET_OS_OSX // [macOS
|
|
215
|
+
// _UIColorFromSemanticString only knows UIKit's vocabulary. AppKit's own --
|
|
216
|
+
// labelColor, controlAccentColor, windowBackgroundColor and the rest -- are
|
|
217
|
+
// class properties on NSColor, so asking NSColor directly covers all of
|
|
218
|
+
// them without a second table. Without this a macOS-only name silently
|
|
219
|
+
// resolves to clearColor and the view just renders transparent.
|
|
220
|
+
SEL appKitSelector = NSSelectorFromString(semanticNSString);
|
|
221
|
+
if (appKitSelector != nil && [UIColor respondsToSelector:appKitSelector]) {
|
|
222
|
+
IMP imp = [[UIColor class] methodForSelector:appKitSelector];
|
|
223
|
+
id (*getColor)(id, SEL) = (id (*)(id, SEL))imp;
|
|
224
|
+
id candidate = getColor([UIColor class], appKitSelector);
|
|
225
|
+
if ([candidate isKindOfClass:[UIColor class]]) {
|
|
226
|
+
return candidate;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
#endif // macOS]
|
|
207
230
|
}
|
|
208
231
|
|
|
209
232
|
return UIColor.clearColor;
|
package/index.js
CHANGED
|
@@ -270,6 +270,16 @@ module.exports = {
|
|
|
270
270
|
return require('./Libraries/StyleSheet/PlatformColorValueTypesIOS')
|
|
271
271
|
.DynamicColorIOS;
|
|
272
272
|
},
|
|
273
|
+
// [macOS] AppKit's appearance-aware and system-effect colours.
|
|
274
|
+
get DynamicColorMacOS() {
|
|
275
|
+
return require('./Libraries/StyleSheet/PlatformColorValueTypesMacOS')
|
|
276
|
+
.DynamicColorMacOS;
|
|
277
|
+
},
|
|
278
|
+
get ColorWithSystemEffectMacOS() {
|
|
279
|
+
return require('./Libraries/StyleSheet/PlatformColorValueTypesMacOS')
|
|
280
|
+
.ColorWithSystemEffectMacOS;
|
|
281
|
+
},
|
|
282
|
+
// macOS]
|
|
273
283
|
get Easing() {
|
|
274
284
|
return require('./Libraries/Animated/Easing').default;
|
|
275
285
|
},
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
#import "UIColor.h"
|
|
10
|
+
#import "UITraitCollection.h"
|
|
10
11
|
|
|
11
12
|
@implementation NSColor (UIKitCompat)
|
|
12
13
|
|
|
@@ -14,7 +15,12 @@
|
|
|
14
15
|
{
|
|
15
16
|
return [NSColor colorWithName:nil
|
|
16
17
|
dynamicProvider:^NSColor *(NSAppearance *appearance) {
|
|
17
|
-
|
|
18
|
+
// UIKit hands the provider a UITraitCollection and callers
|
|
19
|
+
// read -userInterfaceStyle and -accessibilityContrast off it.
|
|
20
|
+
// AppKit hands out an NSAppearance, which answers neither, so
|
|
21
|
+
// passing it straight through raises "unrecognized selector"
|
|
22
|
+
// the first time a dynamic colour is resolved.
|
|
23
|
+
return provider([UITraitCollection traitCollectionWithAppearance:appearance]);
|
|
18
24
|
}];
|
|
19
25
|
}
|
|
20
26
|
|