react-native-macos 0.81.4 → 0.81.6

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.
Files changed (45) hide show
  1. package/Libraries/Components/Pressable/Pressable.js +8 -1
  2. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +16 -0
  3. package/Libraries/Components/TextInput/TextInput.js +26 -9
  4. package/Libraries/Components/View/View.js +30 -10
  5. package/Libraries/Core/ReactNativeVersion.js +1 -1
  6. package/Libraries/LinkingIOS/RCTLinkingManager.mm +119 -0
  7. package/Libraries/LinkingIOS/React-RCTLinking.podspec +0 -4
  8. package/Libraries/Text/RCTTextAttributes.mm +1 -1
  9. package/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +1 -1
  10. package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +1 -1
  11. package/Libraries/Utilities/normalizeLegacyHandledKeyEvents.js +164 -0
  12. package/React/Base/RCTRootView.m +7 -0
  13. package/React/Base/RCTUIKit.h +18 -7
  14. package/React/Base/RCTVersion.m +1 -1
  15. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +9 -0
  16. package/React/Base/macOS/RCTUIKit.m +65 -8
  17. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +6 -0
  18. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +77 -1
  19. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +4 -0
  20. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +93 -3
  21. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +306 -8
  22. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +6 -0
  23. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +26 -18
  24. package/React/Modules/RCTUIManager.mm +1 -1
  25. package/React/Views/RCTCursor.m +0 -1
  26. package/React/Views/RCTView.m +1 -2
  27. package/React/Views/ScrollView/RCTScrollView.m +25 -0
  28. package/React/Views/UIView+React.m +1 -1
  29. package/ReactAndroid/gradle.properties +1 -1
  30. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  31. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  32. package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +1 -1
  33. package/ReactCommon/react/renderer/graphics/Color.h +1 -0
  34. package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.h +10 -0
  35. package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm +83 -6
  36. package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/PlatformColorParser.mm +18 -0
  37. package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/RCTPlatformColorUtils.mm +144 -3
  38. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +1 -1
  39. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.h +2 -2
  40. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +3 -3
  41. package/local-cli/generate-macos.js +0 -3
  42. package/local-cli/generator-common/index.js +5 -5
  43. package/local-cli/generator-macos/index.js +7 -22
  44. package/package.json +2 -2
  45. package/Libraries/LinkingIOS/macos/RCTLinkingManager.mm +0 -123
@@ -20,9 +20,19 @@ struct DynamicColor {
20
20
  int32_t highContrastDarkColor = 0;
21
21
  };
22
22
 
23
+ #if TARGET_OS_OSX // [macOS
24
+ struct ColorWithSystemEffect {
25
+ int32_t color = 0;
26
+ std::string effect;
27
+ };
28
+ #endif // macOS]
29
+
23
30
  struct Color {
24
31
  Color(int32_t color);
25
32
  Color(const DynamicColor& dynamicColor);
33
+ #if TARGET_OS_OSX // [macOS
34
+ Color(const ColorWithSystemEffect& colorWithSystemEffect);
35
+ #endif // macOS]
26
36
  Color(const ColorComponents& components);
27
37
  Color() : uiColor_(nullptr){};
28
38
  int32_t getColor() const;
@@ -10,6 +10,7 @@
10
10
  #import <Foundation/Foundation.h>
11
11
  #import <React/RCTUIKit.h> // [macOS]
12
12
  #import <objc/runtime.h>
13
+ #import <react/renderer/graphics/Color.h> // [macOS]
13
14
  #import <react/renderer/graphics/RCTPlatformColorUtils.h>
14
15
  #import <react/utils/ManagedObjectWrapper.h>
15
16
  #import <string>
@@ -20,6 +21,33 @@ NS_ASSUME_NONNULL_BEGIN
20
21
 
21
22
  namespace facebook::react {
22
23
 
24
+ #if TARGET_OS_OSX // [macOS
25
+ RCTPlatformColor *_Nullable UIColorFromColorWithSystemEffect(
26
+ RCTUIColor *baseColor,
27
+ const std::string &systemEffectString)
28
+ {
29
+ if (baseColor == nil) {
30
+ return nil;
31
+ }
32
+
33
+ NSColor *colorWithEffect = baseColor;
34
+ if (!systemEffectString.empty()) {
35
+ if (systemEffectString == "none") {
36
+ colorWithEffect = [baseColor colorWithSystemEffect:NSColorSystemEffectNone];
37
+ } else if (systemEffectString == "pressed") {
38
+ colorWithEffect = [baseColor colorWithSystemEffect:NSColorSystemEffectPressed];
39
+ } else if (systemEffectString == "deepPressed") {
40
+ colorWithEffect = [baseColor colorWithSystemEffect:NSColorSystemEffectDeepPressed];
41
+ } else if (systemEffectString == "disabled") {
42
+ colorWithEffect = [baseColor colorWithSystemEffect:NSColorSystemEffectDisabled];
43
+ } else if (systemEffectString == "rollover") {
44
+ colorWithEffect = [baseColor colorWithSystemEffect:NSColorSystemEffectRollover];
45
+ }
46
+ }
47
+ return colorWithEffect;
48
+ }
49
+ #endif // macOS]
50
+
23
51
  namespace {
24
52
 
25
53
  bool UIColorIsP3ColorSpace(const std::shared_ptr<void> &uiColor)
@@ -104,7 +132,6 @@ RCTUIColor *_Nullable UIColorFromDynamicColor(const facebook::react::DynamicColo
104
132
  } else {
105
133
  return nil;
106
134
  }
107
-
108
135
  return nil;
109
136
  }
110
137
 
@@ -120,7 +147,11 @@ int32_t ColorFromColorComponents(const facebook::react::ColorComponents &compone
120
147
  int32_t ColorFromUIColor(RCTUIColor *color) // [macOS]
121
148
  {
122
149
  CGFloat rgba[4];
150
+ #if !TARGET_OS_OSX // [macOS]
123
151
  [color getRed:&rgba[0] green:&rgba[1] blue:&rgba[2] alpha:&rgba[3]];
152
+ #else // [macOS
153
+ [[color colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]] getRed:&rgba[0] green:&rgba[1] blue:&rgba[2] alpha: &rgba[3]];
154
+ #endif // macOS]
124
155
  return ColorFromColorComponents({(float)rgba[0], (float)rgba[1], (float)rgba[2], (float)rgba[3]});
125
156
  }
126
157
 
@@ -137,6 +168,21 @@ int32_t ColorFromUIColorForSpecificTraitCollection(
137
168
 
138
169
  return 0;
139
170
  }
171
+ #else // [macOS
172
+ int32_t ColorFromUIColorForSpecificAppearance(
173
+ const std::shared_ptr<void> &uiColor,
174
+ NSAppearance *appearance)
175
+ {
176
+ RCTPlatformColor *color = (RCTPlatformColor *)unwrapManagedObject(uiColor);
177
+ if (color) {
178
+ __block int32_t resolvedColorInt = 0;
179
+ [appearance performAsCurrentDrawingAppearance:^{
180
+ resolvedColorInt = ColorFromUIColor(color);
181
+ }];
182
+ return resolvedColorInt;
183
+ }
184
+ return 0;
185
+ }
140
186
  #endif // [macOS]
141
187
 
142
188
  int32_t ColorFromUIColor(const std::shared_ptr<void> &uiColor)
@@ -144,8 +190,7 @@ int32_t ColorFromUIColor(const std::shared_ptr<void> &uiColor)
144
190
  #if !TARGET_OS_OSX // [macOS]
145
191
  return ColorFromUIColorForSpecificTraitCollection(uiColor, [UITraitCollection currentTraitCollection]);
146
192
  #else // [macOS
147
- RCTUIColor *color = (RCTUIColor *)unwrapManagedObject(uiColor);
148
- return ColorFromUIColor(color);
193
+ return ColorFromUIColorForSpecificAppearance(uiColor, [NSApp effectiveAppearance]);
149
194
  #endif // macOS]
150
195
  }
151
196
 
@@ -170,9 +215,7 @@ std::size_t hashFromUIColor(const std::shared_ptr<void> &uiColor)
170
215
  return 0;
171
216
  }
172
217
 
173
- #if TARGET_OS_OSX // [macOS]
174
- return ColorFromUIColor(uiColor);
175
- #else // [macOS
218
+ #if !TARGET_OS_OSX // [macOS]
176
219
  static UITraitCollection *darkModeTraitCollection =
177
220
  [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark];
178
221
  auto darkColor = ColorFromUIColorForSpecificTraitCollection(uiColor, darkModeTraitCollection);
@@ -202,6 +245,15 @@ std::size_t hashFromUIColor(const std::shared_ptr<void> &uiColor)
202
245
  darkAccessibilityContrastColor,
203
246
  lightAccessibilityContrastColor,
204
247
  UIColorIsP3ColorSpace(uiColor));
248
+ #else // [macOS
249
+ // Hash both light and dark appearance colors to properly distinguish
250
+ // dynamic colors that change with appearance.
251
+ auto darkColor = ColorFromUIColorForSpecificAppearance(
252
+ uiColor, [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]);
253
+ auto lightColor = ColorFromUIColorForSpecificAppearance(
254
+ uiColor, [NSAppearance appearanceNamed:NSAppearanceNameAqua]);
255
+
256
+ return facebook::react::hash_combine(darkColor, lightColor);
205
257
  #endif // macOS]
206
258
  }
207
259
 
@@ -224,6 +276,21 @@ Color::Color(const DynamicColor &dynamicColor)
224
276
  0);
225
277
  }
226
278
 
279
+ #if TARGET_OS_OSX // [macOS
280
+ Color::Color(const ColorWithSystemEffect &colorWithSystemEffect)
281
+ {
282
+ RCTUIColor *baseColor = UIColorFromInt32(colorWithSystemEffect.color);
283
+ RCTUIColor *colorWithEffect =
284
+ UIColorFromColorWithSystemEffect(baseColor, colorWithSystemEffect.effect);
285
+ if (colorWithEffect != nil) {
286
+ uiColor_ = wrapManagedObject(colorWithEffect);
287
+ }
288
+ uiColorHashValue_ = facebook::react::hash_combine(
289
+ colorWithSystemEffect.color,
290
+ std::hash<std::string>{}(colorWithSystemEffect.effect));
291
+ }
292
+ #endif // macOS]
293
+
227
294
  Color::Color(const ColorComponents &components)
228
295
  {
229
296
  uiColor_ = wrapManagedObject(UIColorFromComponentsColor(components));
@@ -276,6 +343,16 @@ Color Color::createSemanticColor(std::vector<std::string> &semanticItems)
276
343
  return Color(wrapManagedObject(semanticColor));
277
344
  }
278
345
 
346
+ // [macOS
347
+ SharedColor defaultForegroundTextColor() {
348
+ static SharedColor color = [] {
349
+ std::vector<std::string> items = {"labelColor"};
350
+ return SharedColor(Color::createSemanticColor(items));
351
+ }();
352
+ return color;
353
+ }
354
+ // macOS]
355
+
279
356
  } // namespace facebook::react
280
357
 
281
358
  NS_ASSUME_NONNULL_END
@@ -62,6 +62,24 @@ SharedColor parsePlatformColor(const ContextContainer &contextContainer, int32_t
62
62
  items.at("dynamic").hasType<std::unordered_map<std::string, RawValue>>()) {
63
63
  auto dynamicItems = (std::unordered_map<std::string, RawValue>)items.at("dynamic");
64
64
  return RCTPlatformColorComponentsFromDynamicItems(contextContainer, surfaceId, dynamicItems);
65
+ #if TARGET_OS_OSX // [macOS
66
+ } else if (
67
+ items.find("colorWithSystemEffect") != items.end() &&
68
+ items.at("colorWithSystemEffect").hasType<std::unordered_map<std::string, RawValue>>()) {
69
+ auto colorWithSystemEffectItems =
70
+ (std::unordered_map<std::string, RawValue>)items.at("colorWithSystemEffect");
71
+ if (colorWithSystemEffectItems.find("baseColor") != colorWithSystemEffectItems.end() &&
72
+ colorWithSystemEffectItems.find("systemEffect") != colorWithSystemEffectItems.end() &&
73
+ colorWithSystemEffectItems.at("systemEffect").hasType<std::string>()) {
74
+ SharedColor baseColorShared{};
75
+ fromRawValue(contextContainer, surfaceId, colorWithSystemEffectItems.at("baseColor"), baseColorShared);
76
+ if (baseColorShared) {
77
+ std::string systemEffect = (std::string)colorWithSystemEffectItems.at("systemEffect");
78
+ auto baseColor = (*baseColorShared).getColor();
79
+ return SharedColor(Color(ColorWithSystemEffect{baseColor, systemEffect}));
80
+ }
81
+ }
82
+ #endif // macOS]
65
83
  }
66
84
  }
67
85
 
@@ -13,17 +13,24 @@
13
13
  #import <react/utils/ManagedObjectWrapper.h>
14
14
 
15
15
  #include <string>
16
+ #include <vector> // [macOS]
16
17
 
17
18
  NS_ASSUME_NONNULL_BEGIN
18
19
 
19
20
  static NSString *const kColorSuffix = @"Color";
20
21
  static NSString *const kFallbackARGBKey = @"fallback-argb";
22
+ #if TARGET_OS_OSX // [macOS
23
+ static NSString *const kFallbackKey = @"fallback";
24
+ static NSString *const kSelectorKey = @"selector";
25
+ static NSString *const kIndexKey = @"index";
26
+ #endif // macOS]
21
27
 
22
28
  static NSDictionary<NSString *, NSDictionary *> *_PlatformColorSelectorsDict()
23
29
  {
24
30
  static NSDictionary<NSString *, NSDictionary *> *dict;
25
31
  static dispatch_once_t once_token;
26
32
  dispatch_once(&once_token, ^(void) {
33
+ #if !TARGET_OS_OSX // [macOS]
27
34
  dict = @{
28
35
  // https://developer.apple.com/documentation/uikit/uicolor/ui_element_colors
29
36
  // Label Colors
@@ -130,6 +137,105 @@ static NSDictionary<NSString *, NSDictionary *> *_PlatformColorSelectorsDict()
130
137
  kFallbackARGBKey : @(0x00000000) // iOS 13.0
131
138
  },
132
139
  };
140
+ #else // [macOS
141
+ NSMutableDictionary<NSString *, NSDictionary *> *map = [@{
142
+ // https://developer.apple.com/documentation/appkit/nscolor/ui_element_colors
143
+ // Label Colors
144
+ @"labelColor": @{},
145
+ @"secondaryLabelColor": @{},
146
+ @"tertiaryLabelColor": @{},
147
+ @"quaternaryLabelColor": @{},
148
+ // Text Colors
149
+ @"textColor": @{},
150
+ @"placeholderTextColor": @{},
151
+ @"selectedTextColor": @{},
152
+ @"textBackgroundColor": @{},
153
+ @"selectedTextBackgroundColor": @{},
154
+ @"keyboardFocusIndicatorColor": @{},
155
+ @"unemphasizedSelectedTextColor": @{
156
+ kFallbackKey: @"selectedTextColor"
157
+ },
158
+ @"unemphasizedSelectedTextBackgroundColor": @{
159
+ kFallbackKey: @"textBackgroundColor"
160
+ },
161
+ // Content Colors
162
+ @"linkColor": @{},
163
+ @"separatorColor": @{
164
+ kFallbackKey: @"gridColor"
165
+ },
166
+ @"selectedContentBackgroundColor": @{
167
+ kFallbackKey: @"alternateSelectedControlColor"
168
+ },
169
+ @"unemphasizedSelectedContentBackgroundColor": @{
170
+ kFallbackKey: @"secondarySelectedControlColor"
171
+ },
172
+ // Menu Colors
173
+ @"selectedMenuItemTextColor": @{},
174
+ // Table Colors
175
+ @"gridColor": @{},
176
+ @"headerTextColor": @{},
177
+ @"alternatingEvenContentBackgroundColor": @{
178
+ kSelectorKey: @"alternatingContentBackgroundColors",
179
+ kIndexKey: @0,
180
+ kFallbackKey: @"controlAlternatingRowBackgroundColors"
181
+ },
182
+ @"alternatingOddContentBackgroundColor": @{
183
+ kSelectorKey: @"alternatingContentBackgroundColors",
184
+ kIndexKey: @1,
185
+ kFallbackKey: @"controlAlternatingRowBackgroundColors"
186
+ },
187
+ // Control Colors
188
+ @"controlAccentColor": @{
189
+ kFallbackKey: @"controlColor"
190
+ },
191
+ @"controlColor": @{},
192
+ @"controlBackgroundColor": @{},
193
+ @"controlTextColor": @{},
194
+ @"disabledControlTextColor": @{},
195
+ @"selectedControlColor": @{},
196
+ @"selectedControlTextColor": @{},
197
+ @"alternateSelectedControlTextColor": @{},
198
+ @"scrubberTexturedBackgroundColor": @{},
199
+ // Window Colors
200
+ @"windowBackgroundColor": @{},
201
+ @"windowFrameTextColor": @{},
202
+ @"underPageBackgroundColor": @{},
203
+ // Highlights and Shadows
204
+ @"findHighlightColor": @{
205
+ kFallbackKey: @"highlightColor"
206
+ },
207
+ @"highlightColor": @{},
208
+ @"shadowColor": @{},
209
+ // https://developer.apple.com/documentation/appkit/nscolor/standard_colors
210
+ // Standard Colors
211
+ @"systemBlueColor": @{},
212
+ @"systemBrownColor": @{},
213
+ @"systemGrayColor": @{},
214
+ @"systemGreenColor": @{},
215
+ @"systemOrangeColor": @{},
216
+ @"systemPinkColor": @{},
217
+ @"systemPurpleColor": @{},
218
+ @"systemRedColor": @{},
219
+ @"systemYellowColor": @{},
220
+ // Transparent Color
221
+ @"clearColor" : @{},
222
+ } mutableCopy];
223
+
224
+ NSMutableDictionary<NSString *, NSDictionary *> *aliases = [NSMutableDictionary new];
225
+ for (NSString *objcSelector in map) {
226
+ NSMutableDictionary *entry = [map[objcSelector] mutableCopy];
227
+ if ([entry objectForKey:kSelectorKey] == nil) {
228
+ entry[kSelectorKey] = objcSelector;
229
+ }
230
+ if ([objcSelector hasSuffix:kColorSuffix]) {
231
+ NSString *swiftSelector = [objcSelector substringToIndex:[objcSelector length] - [kColorSuffix length]];
232
+ aliases[swiftSelector] = entry;
233
+ }
234
+ }
235
+ [map addEntriesFromDictionary:aliases];
236
+
237
+ dict = [map copy];
238
+ #endif // macOS]
133
239
  });
134
240
  return dict;
135
241
  }
@@ -154,6 +260,7 @@ static RCTUIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString
154
260
  NSDictionary<NSString *, NSDictionary *> *platformColorSelectorsDict = _PlatformColorSelectorsDict();
155
261
  NSDictionary<NSString *, id> *colorInfo = platformColorSelectorsDict[platformColorString];
156
262
  if (colorInfo) {
263
+ #if !TARGET_OS_OSX // [macOS]
157
264
  SEL objcColorSelector = NSSelectorFromString([platformColorString stringByAppendingString:kColorSuffix]);
158
265
  if (![RCTUIColor respondsToSelector:objcColorSelector]) { // [macOS]
159
266
  NSNumber *fallbackRGB = colorInfo[kFallbackARGBKey];
@@ -169,6 +276,43 @@ static RCTUIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString
169
276
  return colorObject;
170
277
  }
171
278
  }
279
+ #else // [macOS
280
+ NSString *selectorName = colorInfo[kSelectorKey];
281
+ if (selectorName == nil) {
282
+ selectorName = [platformColorString stringByAppendingString:kColorSuffix];
283
+ }
284
+
285
+ SEL objcColorSelector = NSSelectorFromString(selectorName);
286
+ if (![RCTPlatformColor respondsToSelector:objcColorSelector]) {
287
+ NSNumber *fallbackRGB = colorInfo[kFallbackARGBKey];
288
+ if (fallbackRGB) {
289
+ return _UIColorFromHexValue(fallbackRGB);
290
+ }
291
+ NSString *fallbackColorName = colorInfo[kFallbackKey];
292
+ if (fallbackColorName) {
293
+ return _UIColorFromSemanticString(fallbackColorName);
294
+ }
295
+ } else {
296
+ Class colorClass = [RCTPlatformColor class];
297
+ IMP imp = [colorClass methodForSelector:objcColorSelector];
298
+ id (*getColor)(id, SEL) = ((id(*)(id, SEL))imp);
299
+ id colorObject = getColor(colorClass, objcColorSelector);
300
+ if ([colorObject isKindOfClass:[NSArray class]]) {
301
+ NSNumber *index = colorInfo[kIndexKey];
302
+ if (index != nil) {
303
+ NSArray *colors = colorObject;
304
+ NSUInteger idx = [index unsignedIntegerValue];
305
+ if (idx < colors.count) {
306
+ colorObject = colors[idx];
307
+ }
308
+ }
309
+ }
310
+
311
+ if ([colorObject isKindOfClass:[RCTPlatformColor class]]) {
312
+ return colorObject;
313
+ }
314
+ }
315
+ #endif // macOS]
172
316
  }
173
317
  return nil;
174
318
  }
@@ -183,9 +327,6 @@ static inline NSString *_NSStringFromCString(
183
327
  static inline facebook::react::ColorComponents _ColorComponentsFromUIColor(RCTUIColor *color) // [macOS]
184
328
  {
185
329
  CGFloat rgba[4];
186
- #if TARGET_OS_OSX // [macOS
187
- color = [color colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]];
188
- #endif // macOS]
189
330
  [color getRed:&rgba[0] green:&rgba[1] blue:&rgba[2] alpha:&rgba[3]];
190
331
  return {(float)rgba[0], (float)rgba[1], (float)rgba[2], (float)rgba[3]};
191
332
  }
@@ -144,7 +144,7 @@ inline static UIFont *RCTEffectiveFontFromTextAttributes(const TextAttributes &t
144
144
 
145
145
  inline static RCTUIColor *RCTEffectiveForegroundColorFromTextAttributes(const TextAttributes &textAttributes) // [macOS]
146
146
  {
147
- RCTUIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ? RCTUIColorFromSharedColor(textAttributes.foregroundColor) : [RCTUIColor blackColor]; // [macOS]
147
+ RCTUIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [RCTUIColor labelColor]; // [macOS]
148
148
 
149
149
  if (!isnan(textAttributes.opacity)) {
150
150
  effectiveForegroundColor = [effectiveForegroundColor
@@ -59,11 +59,11 @@ using RCTTextLayoutFragmentEnumerationBlock =
59
59
  frame:(CGRect)frame
60
60
  usingBlock:(RCTTextLayoutFragmentEnumerationBlock)block;
61
61
 
62
- #if TARGET_OS_OSX // [macOS
62
+ // [macOS iOS
63
63
  - (NSTextStorage *)getTextStorageForAttributedString:(facebook::react::AttributedString)attributedString
64
64
  paragraphAttributes:(facebook::react::ParagraphAttributes)paragraphAttributes
65
65
  size:(CGSize)size;
66
- #endif // macOS]
66
+ // macOS iOS]
67
67
 
68
68
  @end
69
69
 
@@ -438,7 +438,7 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
438
438
  return TextMeasurement{{size.width, size.height}, attachments};
439
439
  }
440
440
 
441
- #if TARGET_OS_OSX // [macOS
441
+ // [macOS iOS
442
442
  - (NSTextStorage *)getTextStorageForAttributedString:(AttributedString)attributedString
443
443
  paragraphAttributes:(ParagraphAttributes)paragraphAttributes
444
444
  size:(CGSize)size
@@ -447,9 +447,9 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
447
447
  NSTextStorage *textStorage = [self _textStorageAndLayoutManagerWithAttributesString:nsAttributedString
448
448
  paragraphAttributes:paragraphAttributes
449
449
  size:size];
450
-
450
+
451
451
  return textStorage;
452
452
  }
453
- #endif // macOS]
453
+ // macOS iOS]
454
454
 
455
455
  @end
@@ -3,7 +3,6 @@
3
3
 
4
4
  const {
5
5
  copyProjectTemplateAndReplace,
6
- installDependencies,
7
6
  printFinishMessage,
8
7
  } = require('./generator-macos');
9
8
  const fs = require('fs');
@@ -21,8 +20,6 @@ function generateMacOS (projectDir, name, options) {
21
20
  fs.mkdirSync(projectDir);
22
21
  }
23
22
 
24
- installDependencies(options);
25
-
26
23
  copyProjectTemplateAndReplace(
27
24
  path.join(__dirname, 'generator-macos', 'templates'),
28
25
  projectDir,
@@ -1,8 +1,8 @@
1
1
  // @ts-check
2
2
 
3
3
  // @noflow
4
- const chalk = require('chalk');
5
4
  const fs = require('fs');
5
+ const { styleText } = require('node:util');
6
6
  const path = require('path');
7
7
 
8
8
  // Copied from `copyAndReplace` in react-native-community/cli as it's deleted in newer versions
@@ -330,11 +330,11 @@ function alwaysOverwriteContentChangedCallback(
330
330
  contentChanged
331
331
  ) {
332
332
  if (contentChanged === 'new') {
333
- console.log(`${chalk.bold('new')} ${relativeDestPath}`);
333
+ console.log(`${styleText('bold','new')} ${relativeDestPath}`);
334
334
  return 'overwrite';
335
335
  }
336
336
  if (contentChanged === 'changed') {
337
- console.log(`${chalk.bold('changed')} ${relativeDestPath} ${chalk.yellow('[overwriting]')}`);
337
+ console.log(`${styleText('bold','changed')} ${relativeDestPath} ${styleText('yellow','[overwriting]')}`);
338
338
  return 'overwrite';
339
339
  }
340
340
  if (contentChanged === 'identical') {
@@ -351,12 +351,12 @@ function upgradeFileContentChangedCallback(
351
351
  contentChanged
352
352
  ) {
353
353
  if (contentChanged === 'new') {
354
- console.log(`${chalk.bold('new')} ${relativeDestPath}`);
354
+ console.log(`${styleText('bold','new')} ${relativeDestPath}`);
355
355
  return 'overwrite';
356
356
  }
357
357
  if (contentChanged === 'changed') {
358
358
  console.log(
359
- `${chalk.bold(relativeDestPath)} ` +
359
+ `${styleText('bold',relativeDestPath)} ` +
360
360
  `has changed in the new version.\nDo you want to keep your ${relativeDestPath} or replace it with the ` +
361
361
  'latest version?\nIf you ever made any changes ' +
362
362
  'to this file, you\'ll probably want to keep it.\n' +
@@ -7,9 +7,7 @@ const {
7
7
  copyAndReplaceAll,
8
8
  createDir,
9
9
  } = require('../generator-common');
10
- const chalk = require('chalk');
11
- const childProcess = require('child_process');
12
- const fs = require('fs');
10
+ const { styleText } = require('node:util');
13
11
  const path = require('path');
14
12
 
15
13
  const macOSDir = 'macos';
@@ -102,34 +100,21 @@ function schemePath(basename, platform) {
102
100
  return path.join(schemesPath(basename), projectName(basename, platform) + '.xcscheme');
103
101
  }
104
102
 
105
- /**
106
- * @param {{ verbose?: boolean }=} options
107
- */
108
- function installDependencies(options) {
109
- const cwd = process.cwd();
110
-
111
- // Install dependencies using correct package manager
112
- const isYarn = fs.existsSync(path.join(cwd, 'yarn.lock'));
113
-
114
- /** @type {{ stdio?: 'inherit' }} */
115
- const execOptions = options && options.verbose ? { stdio: 'inherit' } : {};
116
- childProcess.execSync(isYarn ? 'yarn' : 'npm i', execOptions);
117
- }
118
-
119
103
  /**
120
104
  * @param {string} newProjectName
121
105
  */
122
106
  function printFinishMessage(newProjectName) {
123
107
  console.log(`
124
- ${chalk.blue(`Run instructions for ${chalk.bold('macOS')}`)}:
125
- • pod install --project-directory=macos
126
- • npx react-native run-macos
127
- • yarn start:macos
108
+ ${styleText('blue', `Run instructions for ${styleText('bold', 'macOS')}`)}:
109
+ • ${styleText('cyan', 'pod install --project-directory=macos')}
110
+ • ${styleText('cyan', 'npx react-native run-macos')}
111
+
112
+ To start the Metro bundler separately:
113
+ • ${styleText('cyan', 'npx react-native start')}
128
114
  `);
129
115
  }
130
116
 
131
117
  module.exports = {
132
118
  copyProjectTemplateAndReplace,
133
- installDependencies,
134
119
  printFinishMessage,
135
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.81.4",
3
+ "version": "0.81.6",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -166,7 +166,7 @@
166
166
  },
167
167
  "dependencies": {
168
168
  "@jest/create-cache-key-function": "^29.7.0",
169
- "@react-native-macos/virtualized-lists": "0.81.4",
169
+ "@react-native-macos/virtualized-lists": "0.81.6",
170
170
  "@react-native/assets-registry": "0.81.6",
171
171
  "@react-native/codegen": "0.81.6",
172
172
  "@react-native/community-cli-plugin": "0.81.6",