react-native-macos 0.73.21 → 0.73.22

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: 73,
15
- patch: 21,
15
+ patch: 22,
16
16
  prerelease: null,
17
17
  };
@@ -192,7 +192,7 @@ export function parseComponentStack(message: string): ComponentStack {
192
192
  if (!s) {
193
193
  return null;
194
194
  }
195
- const match = s.match(/(.*) \(at (.*\.js):([\d]+)\)/);
195
+ const match = s.match(/(.*) \(at (.*\.(?:js|jsx|ts|tsx)):([\d]+)\)/);
196
196
  if (!match) {
197
197
  return null;
198
198
  }
@@ -154,7 +154,7 @@ typedef BOOL css_backface_visibility_t;
154
154
  + (RCTTextDecorationLineType)RCTTextDecorationLineType:(id)json;
155
155
 
156
156
  #if TARGET_OS_OSX // [macOS
157
- + (NSString *)accessibilityRoleFromTraits:(id)json;
157
+ + (NSString *)accessibilityRoleFromTraits:(id)json useAriaMappings:(BOOL) useAriaMappings;
158
158
 
159
159
  + (NSArray<RCTHandledKey *> *)RCTHandledKeyArray:(id)json;
160
160
  #endif // macOS]
@@ -1487,6 +1487,104 @@ RCT_ENUM_CONVERTER(
1487
1487
  integerValue)
1488
1488
 
1489
1489
  #if TARGET_OS_OSX // [macOS
1490
+ // This is for the role prop & has slightly different mappings than the
1491
+ // old accessibilityRole prop for back compatability. `role` matches ARIA Core
1492
+ // AAM spec and takes precedence. See https://www.w3.org/TR/core-aam-1.1/
1493
+ + (NSString*) accessibilityRoleFromAriaRole:(NSString*)ariaRole
1494
+ {
1495
+ // rowgroup is explicitly not mapped
1496
+ if ([ariaRole isEqualToString:@"rowgroup"]) {
1497
+ return nil;
1498
+ }
1499
+ static NSDictionary<NSString *, NSAccessibilityRole> * ariaRoleToNSAccessibilityRole;
1500
+ static dispatch_once_t onceToken;
1501
+ dispatch_once(&onceToken, ^{
1502
+ ariaRoleToNSAccessibilityRole = @{
1503
+ @"alert": NSAccessibilityGroupRole,
1504
+ @"alertdialog": NSAccessibilityGroupRole,
1505
+ @"application": NSAccessibilityGroupRole,
1506
+ @"article": NSAccessibilityGroupRole,
1507
+ @"banner": NSAccessibilityGroupRole,
1508
+ @"button": NSAccessibilityButtonRole,
1509
+ @"cell": NSAccessibilityCellRole,
1510
+ @"checkbox": NSAccessibilityCheckBoxRole,
1511
+ @"columnheader": NSAccessibilityCellRole,
1512
+ @"combobox": NSAccessibilityComboBoxRole,
1513
+ @"complementary": NSAccessibilityGroupRole,
1514
+ @"contentinfo": NSAccessibilityGroupRole,
1515
+ @"definition": NSAccessibilityGroupRole,
1516
+ @"dialog": NSAccessibilityGroupRole,
1517
+ @"directory": NSAccessibilityListRole,
1518
+ @"document": NSAccessibilityGroupRole,
1519
+ @"feed": NSAccessibilityGroupRole,
1520
+ @"figure": NSAccessibilityGroupRole,
1521
+ @"form": NSAccessibilityGroupRole,
1522
+ @"grid": NSAccessibilityTableRole,
1523
+ @"gridcell": NSAccessibilityCellRole,
1524
+ @"group": NSAccessibilityGroupRole,
1525
+ @"heading": NSAccessibilityStaticTextRole,
1526
+ @"image": NSAccessibilityImageRole,
1527
+ @"img": NSAccessibilityImageRole,
1528
+ @"link": NSAccessibilityLinkRole,
1529
+ @"list": NSAccessibilityListRole,
1530
+ @"listbox": NSAccessibilityListRole,
1531
+ @"listitem": NSAccessibilityGroupRole,
1532
+ @"log": NSAccessibilityGroupRole,
1533
+ @"main": NSAccessibilityGroupRole,
1534
+ @"marquee": NSAccessibilityGroupRole,
1535
+ @"math": NSAccessibilityGroupRole,
1536
+ @"menu": NSAccessibilityMenuRole,
1537
+ @"menubar": NSAccessibilityMenuBarRole,
1538
+ @"menuitem": NSAccessibilityMenuItemRole,
1539
+ @"menuitemcheckbox": NSAccessibilityMenuItemRole,
1540
+ @"menuitemradio": NSAccessibilityMenuItemRole,
1541
+ @"meter": NSAccessibilityLevelIndicatorRole,
1542
+ @"navigation": NSAccessibilityGroupRole,
1543
+ @"none": NSAccessibilityGroupRole,
1544
+ @"note": NSAccessibilityGroupRole,
1545
+ @"option": NSAccessibilityStaticTextRole,
1546
+ @"presentation": NSAccessibilityGroupRole,
1547
+ @"progressbar": NSAccessibilityProgressIndicatorRole,
1548
+ @"radio": NSAccessibilityRadioButtonRole,
1549
+ @"radiogroup": NSAccessibilityRadioGroupRole,
1550
+ @"region": NSAccessibilityGroupRole,
1551
+ @"row": NSAccessibilityRowRole,
1552
+ @"rowheader": NSAccessibilityCellRole,
1553
+ @"scrollbar": NSAccessibilityScrollBarRole,
1554
+ @"search": NSAccessibilityGroupRole,
1555
+ @"searchbox": NSAccessibilityTextFieldRole,
1556
+ @"separator": NSAccessibilitySplitterRole,
1557
+ @"slider": NSAccessibilitySliderRole,
1558
+ @"spinbutton": NSAccessibilityIncrementorRole,
1559
+ @"status": NSAccessibilityGroupRole,
1560
+ @"switch": NSAccessibilityCheckBoxRole,
1561
+ @"tab": NSAccessibilityRadioButtonRole,
1562
+ @"table": NSAccessibilityTableRole,
1563
+ @"tablist": NSAccessibilityTabGroupRole,
1564
+ @"tabpanel": NSAccessibilityGroupRole,
1565
+ @"term": NSAccessibilityGroupRole,
1566
+ @"textbox": NSAccessibilityTextFieldRole,
1567
+ @"timer": NSAccessibilityGroupRole,
1568
+ @"toolbar": NSAccessibilityToolbarRole,
1569
+ @"tooltip": NSAccessibilityGroupRole,
1570
+ @"tree": NSAccessibilityOutlineRole,
1571
+ @"treegrid": NSAccessibilityTableRole,
1572
+ @"treeitem": NSAccessibilityRowRole,
1573
+ };
1574
+ });
1575
+ NSAccessibilityRole nsRole = [ariaRoleToNSAccessibilityRole valueForKey: ariaRole];
1576
+ if (nsRole == nil) {
1577
+ // Fall back to legacy mappings if an aria mapping is not found. This would
1578
+ // include macOS specific roles like disclosure and legacy accessibilityTrait
1579
+ // based mappings like adjustable
1580
+ nsRole = [RCTConvert accessibilityRoleFromTrait:ariaRole];
1581
+ }
1582
+ return nsRole;
1583
+ }
1584
+
1585
+ // This function is for accessibilityRole & has slightly different mappings
1586
+ // than the new role prop for back compatability. role matches ARIA spec and
1587
+ // takes precedence.
1490
1588
  + (NSString*)accessibilityRoleFromTrait:(NSString*)trait
1491
1589
  {
1492
1590
  static NSDictionary<NSString *, NSString *> *traitOrRoleToAccessibilityRole;
@@ -1538,13 +1636,13 @@ RCT_ENUM_CONVERTER(
1538
1636
  return role;
1539
1637
  }
1540
1638
 
1541
- + (NSString *)accessibilityRoleFromTraits:(id)json
1639
+ + (NSString *)accessibilityRoleFromTraits:(id)json useAriaMappings:(BOOL)useAriaMappings
1542
1640
  {
1543
1641
  if ([json isKindOfClass:[NSString class]]) {
1544
- return [RCTConvert accessibilityRoleFromTrait:json];
1642
+ return useAriaMappings ? [RCTConvert accessibilityRoleFromAriaRole:json] : [RCTConvert accessibilityRoleFromTrait:json];
1545
1643
  } else if ([json isKindOfClass:[NSArray class]]) {
1546
1644
  for (NSString *trait in json) {
1547
- NSString *accessibilityRole = [RCTConvert accessibilityRoleFromTrait:trait];
1645
+ NSString *accessibilityRole = useAriaMappings ? [RCTConvert accessibilityRoleFromAriaRole:json] : [RCTConvert accessibilityRoleFromTrait:trait];
1548
1646
  if (![accessibilityRole isEqualToString:NSAccessibilityUnknownRole]) {
1549
1647
  return accessibilityRole;
1550
1648
  }
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(73),
26
- RCTVersionPatch: @(21),
26
+ RCTVersionPatch: @(22),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -29,7 +29,7 @@ using namespace facebook::react;
29
29
 
30
30
  @implementation RCTViewComponentView {
31
31
  RCTUIColor *_backgroundColor; // [macOS]
32
- CALayer *_borderLayer;
32
+ __weak CALayer *_borderLayer;
33
33
  BOOL _needsInvalidateLayer;
34
34
  BOOL _isJSResponder;
35
35
  BOOL _removeClippedSubviews;
@@ -430,9 +430,7 @@ using namespace facebook::react;
430
430
  _layoutMetrics = layoutMetrics;
431
431
  _needsInvalidateLayer = YES;
432
432
 
433
- if (_borderLayer) {
434
- _borderLayer.frame = self.layer.bounds;
435
- }
433
+ _borderLayer.frame = self.layer.bounds;
436
434
 
437
435
  if (_contentView) {
438
436
  _contentView.frame = RCTCGRectFromRect(_layoutMetrics.getContentFrame());
@@ -714,10 +712,7 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
714
712
 
715
713
  if (useCoreAnimationBorderRendering) {
716
714
  layer.mask = nil;
717
- if (_borderLayer) {
718
- [_borderLayer removeFromSuperlayer];
719
- _borderLayer = nil;
720
- }
715
+ [_borderLayer removeFromSuperlayer];
721
716
 
722
717
  layer.borderWidth = (CGFloat)borderMetrics.borderWidths.left;
723
718
  CGColorRef borderColor = RCTCreateCGColorRefFromSharedColor(borderMetrics.borderColors.left);
@@ -730,11 +725,12 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
730
725
  layer.backgroundColor = _backgroundColor.CGColor;
731
726
  } else {
732
727
  if (!_borderLayer) {
733
- _borderLayer = [CALayer new];
734
- _borderLayer.zPosition = -1024.0f;
735
- _borderLayer.frame = layer.bounds;
736
- _borderLayer.magnificationFilter = kCAFilterNearest;
737
- [layer addSublayer:_borderLayer];
728
+ CALayer *borderLayer = [CALayer new];
729
+ borderLayer.zPosition = -1024.0f;
730
+ borderLayer.frame = layer.bounds;
731
+ borderLayer.magnificationFilter = kCAFilterNearest;
732
+ [layer addSublayer:borderLayer];
733
+ _borderLayer = borderLayer;
738
734
  }
739
735
 
740
736
  layer.backgroundColor = nil;
@@ -787,6 +783,10 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
787
783
  }
788
784
  }
789
785
 
786
+ // If mutations are applied inside of Animation block, it may cause _borderLayer to be animated.
787
+ // To stop that, imperatively remove all animations from _borderLayer.
788
+ [_borderLayer removeAllAnimations];
789
+
790
790
  // Stage 2.5. Custom Clipping Mask
791
791
  CAShapeLayer *maskLayer = nil;
792
792
  CGFloat cornerRadius = 0;
@@ -415,11 +415,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
415
415
 
416
416
  // TODO: This logic makes VoiceOver describe some AccessibilityRole which do not have a backing UIAccessibilityTrait.
417
417
  // It does not run on Fabric.
418
- #if !TARGET_OS_OSX // [macOS]
419
418
  NSString *role = self.role ?: self.accessibilityRole;
420
- #else // [macOS renamed prop so it doesn't conflict with -[NSAccessibility accessibilityRole].
421
- NSString *role = self.role ?: self.accessibilityRoleInternal;
422
- #endif
423
419
  NSString *roleDescription = role ? rolesAndStatesDescription[role] : nil;
424
420
  if (roleDescription) {
425
421
  [valueComponents addObject:roleDescription];
@@ -238,10 +238,9 @@ RCT_REMAP_VIEW_PROPERTY(onMagicTap, reactAccessibilityElement.onMagicTap, RCTDir
238
238
  #else // [macOS accessibilityTraits is gone in react-native and deprecated in react-native-macos, use accessibilityRole instead
239
239
  RCT_CUSTOM_VIEW_PROPERTY(accessibilityTraits, NSString, RCTView)
240
240
  {
241
- if (json) {
242
- view.accessibilityRole = [RCTConvert accessibilityRoleFromTraits:json];
243
- } else {
244
- view.accessibilityRole = defaultView.accessibilityRole;
241
+ view.reactAccessibilityElement.accessibilityRoleInternal = json ? [RCTConvert accessibilityRoleFromTraits:json useAriaMappings:NO] : nil;
242
+ if (view.reactAccessibilityElement.accessibilityRole != view.reactAccessibilityElement.accessibilityRoleInternal) {
243
+ [self updateAccessibilityRole:view withDefaultView:defaultView];
245
244
  }
246
245
  }
247
246
  #endif // macOS]
@@ -292,7 +291,7 @@ RCT_REMAP_VIEW_PROPERTY(transformOrigin, reactTransformOrigin, RCTTransformOrigi
292
291
 
293
292
  RCT_CUSTOM_VIEW_PROPERTY(accessibilityRole, UIAccessibilityTraits, RCTView)
294
293
  {
295
- #if !TARGET_OS_OSX // [macOS]
294
+ #if !TARGET_OS_OSX // [macOS]
296
295
  UIAccessibilityTraits accessibilityRoleTraits =
297
296
  json ? [RCTConvert UIAccessibilityTraits:json] : UIAccessibilityTraitNone;
298
297
  if (view.reactAccessibilityElement.accessibilityRoleTraits != accessibilityRoleTraits) {
@@ -300,26 +299,36 @@ RCT_CUSTOM_VIEW_PROPERTY(accessibilityRole, UIAccessibilityTraits, RCTView)
300
299
  view.reactAccessibilityElement.accessibilityRole = json ? [RCTConvert NSString:json] : nil;
301
300
  [self updateAccessibilityTraitsForRole:view withDefaultView:defaultView];
302
301
  }
303
- #else // [macOS
304
- if (json) {
305
- view.reactAccessibilityElement.accessibilityRole = [RCTConvert accessibilityRoleFromTraits:json];
306
- } else {
307
- view.reactAccessibilityElement.accessibilityRole = defaultView.accessibilityRole;
308
- }
309
- #endif // macOS]
302
+ #else // [macOS
303
+ // accessibilityRoleInternal is used to cache the converted value from the prop
304
+ view.reactAccessibilityElement.accessibilityRoleInternal = json ? [RCTConvert accessibilityRoleFromTraits:json useAriaMappings:NO] : nil;
305
+ // update the actual NSAccessibilityRole if it doesn't match
306
+ if (view.reactAccessibilityElement.accessibilityRole != view.reactAccessibilityElement.accessibilityRoleInternal) {
307
+ [self updateAccessibilityRole:view withDefaultView:defaultView];
308
+ }
309
+ #endif // macOS]
310
310
  }
311
311
 
312
- #if !TARGET_OS_OSX // [macOS]
313
312
  RCT_CUSTOM_VIEW_PROPERTY(role, UIAccessibilityTraits, RCTView)
314
313
  {
314
+ #if !TARGET_OS_OSX // [macOS]
315
315
  UIAccessibilityTraits roleTraits = json ? [RCTConvert UIAccessibilityTraits:json] : UIAccessibilityTraitNone;
316
316
  if (view.reactAccessibilityElement.roleTraits != roleTraits) {
317
317
  view.roleTraits = roleTraits;
318
318
  view.reactAccessibilityElement.role = json ? [RCTConvert NSString:json] : nil;
319
319
  [self updateAccessibilityTraitsForRole:view withDefaultView:defaultView];
320
320
  }
321
+ #else // [macOS
322
+ // role is used to cache the converted value from the prop
323
+ view.reactAccessibilityElement.role = json ? [RCTConvert accessibilityRoleFromTraits:json useAriaMappings:YES] : nil;
324
+ // update the actual NSAccessibilityRole if it doesn't match
325
+ if (view.reactAccessibilityElement.accessibilityRole != view.reactAccessibilityElement.role) {
326
+ [self updateAccessibilityRole:view withDefaultView:defaultView];
327
+ }
328
+ #endif // macOS]
321
329
  }
322
330
 
331
+ #if !TARGET_OS_OSX // [macOS]
323
332
  - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTView *)defaultView
324
333
  {
325
334
  const UIAccessibilityTraits AccessibilityRolesMask = UIAccessibilityTraitNone | UIAccessibilityTraitButton |
@@ -336,7 +345,17 @@ RCT_CUSTOM_VIEW_PROPERTY(role, UIAccessibilityTraits, RCTView)
336
345
  : view.reactAccessibilityElement.accessibilityRole ? view.reactAccessibilityElement.accessibilityRoleTraits
337
346
  : (defaultView.accessibilityTraits & AccessibilityRolesMask);
338
347
  }
339
- #endif // [macOS]
348
+ #else // [macOS
349
+ - (void) updateAccessibilityRole:(RCTView *)view withDefaultView:(RCTView *)defaultView
350
+ {
351
+ // First check the value from `role`
352
+ view.reactAccessibilityElement.accessibilityRole = view.reactAccessibilityElement.role ? view.reactAccessibilityElement.role : nil;
353
+ // Fallback to `accessibilityRole` if nil, or the defaultView's NSAccessibilityRole
354
+ if (view.reactAccessibilityElement.accessibilityRole == nil) {
355
+ view.reactAccessibilityElement.accessibilityRole = view.reactAccessibilityElement.accessibilityRoleInternal ? view.reactAccessibilityElement.accessibilityRoleInternal : defaultView.accessibilityRole;
356
+ }
357
+ }
358
+ #endif // macOS]
340
359
 
341
360
  RCT_CUSTOM_VIEW_PROPERTY(accessibilityState, NSDictionary, RCTView)
342
361
  {
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.73.21
1
+ VERSION_NAME=0.73.22
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -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", 73,
20
- "patch", 21,
20
+ "patch", 22,
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 = 73;
20
- int32_t Patch = 21;
20
+ int32_t Patch = 22;
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.73.21",
3
+ "version": "0.73.22",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -86,6 +86,27 @@ class ReactNativePodsUtils
86
86
  end
87
87
  end
88
88
 
89
+ def self.fix_flipper_for_xcode_15_3(installer)
90
+ installer.pods_project.targets.each do |target|
91
+ if target.name == 'Flipper'
92
+ file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
93
+ if !File.exist?(file_path)
94
+ return
95
+ end
96
+
97
+ contents = File.read(file_path)
98
+ if contents.include?('#include <functional>')
99
+ return
100
+ end
101
+ mod_content = contents.gsub("#pragma once", "#pragma once\n#include <functional>")
102
+ File.chmod(0755, file_path)
103
+ File.open(file_path, 'w') do |file|
104
+ file.puts(mod_content)
105
+ end
106
+ end
107
+ end
108
+ end
109
+
89
110
  def self.set_use_hermes_build_setting(installer, hermes_enabled)
90
111
  Pod::UI.puts("Setting USE_HERMES build settings")
91
112
  projects = self.extract_projects(installer)
@@ -322,6 +322,7 @@ def react_native_post_install(
322
322
  ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
323
323
  ReactNativePodsUtils.apply_xcode_15_patch(installer)
324
324
  ReactNativePodsUtils.updateOSDeploymentTarget(installer)
325
+ ReactNativePodsUtils.fix_flipper_for_xcode_15_3(installer)
325
326
 
326
327
  NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
327
328
  NewArchitectureHelper.modify_flags_for_new_architecture(installer, NewArchitectureHelper.new_arch_enabled)
@@ -8,6 +8,7 @@ require 'rexml/document'
8
8
  require 'open3' # [macOS]
9
9
 
10
10
  HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
11
+ ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"
11
12
 
12
13
  module HermesEngineSourceType
13
14
  LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball
@@ -31,7 +32,7 @@ end
31
32
  # - To use a specific tarball, install the dependencies with:
32
33
  # `HERMES_ENGINE_TARBALL_PATH=<path_to_tarball> bundle exec pod install`
33
34
  # - To force a build from source, install the dependencies with:
34
- # `BUILD_FROM_SOURCE=true bundle exec pod install`
35
+ # `RCT_BUILD_HERMES_FROM_SOURCE=true bundle exec pod install`
35
36
  # If none of the two are provided, Cocoapods will check whether there is a tarball for the current version
36
37
  # (either release or nightly). If not, it will fall back to building from source (the latest commit on main).
37
38
  #
@@ -86,11 +87,11 @@ def hermes_commit_envvar_defined()
86
87
  end
87
88
 
88
89
  def force_build_from_tag(react_native_path)
89
- return ENV['BUILD_FROM_SOURCE'] === 'true' && File.exist?(hermestag_file(react_native_path))
90
+ return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
90
91
  end
91
92
 
92
93
  def force_build_from_main(react_native_path)
93
- return ENV['BUILD_FROM_SOURCE'] === 'true' && !File.exist?(hermestag_file(react_native_path))
94
+ return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && !File.exist?(hermestag_file(react_native_path))
94
95
  end
95
96
 
96
97
  def release_artifact_exists(version)