react-native-macos 0.71.29 → 0.71.31

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 (31) hide show
  1. package/Libraries/Components/Pressable/Pressable.js +10 -0
  2. package/Libraries/Components/View/ViewPropTypes.d.ts +1 -0
  3. package/Libraries/Components/View/ViewPropTypes.js +10 -0
  4. package/Libraries/Core/ReactNativeVersion.js +1 -1
  5. package/Libraries/Image/RCTUIImageViewAnimated.h +1 -6
  6. package/Libraries/NativeComponent/BaseViewConfig.macos.js +1 -0
  7. package/Libraries/Text/TextInput/Multiline/RCTUITextView.h +1 -0
  8. package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +1 -1
  9. package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +3 -0
  10. package/Libraries/Text/TextInput/Singleline/RCTUITextField.h +1 -0
  11. package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +1 -1
  12. package/React/Base/RCTUIKit.h +14 -5
  13. package/React/Base/RCTVersion.m +1 -1
  14. package/React/Base/macOS/RCTUIKit.m +93 -21
  15. package/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +5 -4
  16. package/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +3 -3
  17. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +3 -0
  18. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +3 -58
  19. package/React/Fabric/RCTSurfaceTouchHandler.mm +1 -0
  20. package/React/Views/RCTView.h +4 -0
  21. package/React/Views/RCTView.m +3 -0
  22. package/React/Views/RCTViewManager.m +2 -0
  23. package/React/Views/ScrollView/RCTScrollView.m +0 -1
  24. package/React/Views/UIView+React.m +9 -0
  25. package/ReactAndroid/gradle.properties +1 -1
  26. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  27. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  28. package/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm +3 -0
  29. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +2 -3
  30. package/package.json +1 -1
  31. package/template/package.json +1 -1
@@ -232,6 +232,16 @@ type Props = $ReadOnly<{|
232
232
  */
233
233
  enableFocusRing?: ?boolean,
234
234
 
235
+ /**
236
+ * Specifies whether the view ensures it is vibrant on top of other content.
237
+ * For more information, see the following apple documentation:
238
+ * https://developer.apple.com/documentation/appkit/nsview/1483793-allowsvibrancy
239
+ * https://developer.apple.com/documentation/appkit/nsvisualeffectview#1674177
240
+ *
241
+ * @platform macos
242
+ */
243
+ allowsVibrancy?: ?boolean,
244
+
235
245
  /**
236
246
  * Specifies the Tooltip for the Pressable.
237
247
  * @platform macos
@@ -173,6 +173,7 @@ export type DraggedTypesType = DraggedType | DraggedType[];
173
173
 
174
174
  export interface ViewPropsMacOS {
175
175
  acceptsFirstMouse?: boolean | undefined;
176
+ allowsVibrancy?: boolean | undefined;
176
177
  mouseDownCanMoveWindow?: boolean | undefined;
177
178
  enableFocusRing?: boolean | undefined;
178
179
  onMouseEnter?: ((event: MouseEvent) => void) | undefined;
@@ -553,6 +553,16 @@ type MacOSViewProps = $ReadOnly<{|
553
553
  */
554
554
  mouseDownCanMoveWindow?: ?boolean,
555
555
 
556
+ /**
557
+ * Specifies whether the view ensures it is vibrant on top of other content.
558
+ * For more information, see the following apple documentation:
559
+ * https://developer.apple.com/documentation/appkit/nsview/1483793-allowsvibrancy
560
+ * https://developer.apple.com/documentation/appkit/nsvisualeffectview#1674177
561
+ *
562
+ * @platform macos
563
+ */
564
+ allowsVibrancy?: ?boolean,
565
+
556
566
  /**
557
567
  * Specifies whether system focus ring should be drawn when the view has keyboard focus.
558
568
  *
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 71,
15
- patch: 29,
15
+ patch: 31,
16
16
  prerelease: null,
17
17
  };
@@ -8,10 +8,5 @@
8
8
  #import <React/RCTAnimatedImage.h>
9
9
  #import <React/RCTDefines.h>
10
10
 
11
- #if !TARGET_OS_OSX // [macOS]
12
- @interface RCTUIImageViewAnimated : UIImageView
13
- #else // [macOS
14
- @interface RCTUIImageViewAnimated : NSImageView
15
- #endif // macOS]
16
-
11
+ @interface RCTUIImageViewAnimated : RCTUIImageView // [macOS]
17
12
  @end
@@ -48,6 +48,7 @@ const directEventTypes = {
48
48
  const validAttributesForNonEventProps = {
49
49
  acceptsFirstMouse: true,
50
50
  accessibilityTraits: true,
51
+ allowsVibrancy: true,
51
52
  cursor: true,
52
53
  draggedTypes: true,
53
54
  enableFocusRing: true,
@@ -52,6 +52,7 @@ NS_ASSUME_NONNULL_BEGIN
52
52
  @property (nonatomic, copy) NSString *text;
53
53
  @property (nonatomic, assign) NSTextAlignment textAlignment;
54
54
  @property (nonatomic, copy, nullable) NSAttributedString *attributedText;
55
+ @property (nonatomic, assign) CGFloat pointScaleFactor;
55
56
  - (NSSize)sizeThatFits:(NSSize)size;
56
57
  - (void)setReadablePasteBoardTypes:(NSArray<NSPasteboardType> *)readablePasteboardTypes;
57
58
  #endif // macOS]
@@ -459,7 +459,7 @@ static RCTUIColor *defaultPlaceholderColor() // [macOS]
459
459
  .size;
460
460
  placeholderSize = CGSizeMake(RCTCeilPixelValue(placeholderSize.width), RCTCeilPixelValue(placeholderSize.height));
461
461
  #else // [macOS
462
- CGFloat scale = self.window.backingScaleFactor;
462
+ CGFloat scale = _pointScaleFactor ?: self.window.backingScaleFactor;
463
463
  CGSize placeholderSize = [placeholder sizeWithAttributes:[self _placeholderTextAttributes]];
464
464
  placeholderSize = CGSizeMake(RCTCeilPixelValue(placeholderSize.width, scale), RCTCeilPixelValue(placeholderSize.height, scale));
465
465
  #endif // macOS]
@@ -59,6 +59,9 @@ NS_ASSUME_NONNULL_BEGIN
59
59
  @property (nonatomic, assign, readonly) CGFloat zoomScale;
60
60
  @property (nonatomic, assign, readonly) CGPoint contentOffset;
61
61
  @property (nonatomic, assign, readonly) UIEdgeInsets contentInset;
62
+ #if TARGET_OS_OSX // [macOS
63
+ @property (nonatomic, assign) CGFloat pointScaleFactor;
64
+ #endif // macOS]
62
65
 
63
66
  // This protocol disallows direct access to `selectedTextRange` property because
64
67
  // unwise usage of it can break the `delegate` behavior. So, we always have to
@@ -59,6 +59,7 @@ NS_ASSUME_NONNULL_BEGIN
59
59
  @property (nonatomic, assign) BOOL enableFocusRing;
60
60
  @property (nonatomic, strong, nullable) RCTUIColor *selectionColor;
61
61
  @property (weak, nullable) id<RCTUITextFieldDelegate> delegate;
62
+ @property (nonatomic, assign) CGFloat pointScaleFactor;
62
63
  #endif // macOS]
63
64
 
64
65
  @property (nonatomic, getter=isGhostTextChanging) BOOL ghostTextChanging; // [macOS]
@@ -593,7 +593,7 @@
593
593
  size = CGSizeMake(RCTCeilPixelValue(size.width), RCTCeilPixelValue(size.height));
594
594
  #else // [macOS
595
595
  CGSize size = [text sizeWithAttributes:@{NSFontAttributeName: self.font}];
596
- CGFloat scale = self.window.backingScaleFactor;
596
+ CGFloat scale = _pointScaleFactor ?: self.window.backingScaleFactor;
597
597
  RCTAssert(scale != 0.0, @"Layout occurs before the view is in a window?");
598
598
  if (scale == 0) {
599
599
  scale = [[NSScreen mainScreen] backingScaleFactor];
@@ -391,7 +391,6 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
391
391
  - (void)layoutIfNeeded;
392
392
 
393
393
  - (void)layoutSubviews;
394
- - (NSArray<RCTUIView *> *)reactZIndexSortedSubviews; // [macOS]
395
394
 
396
395
  - (void)setNeedsDisplay;
397
396
 
@@ -417,10 +416,6 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
417
416
  * Specifies whether focus ring should be drawn when the view has the first responder status.
418
417
  */
419
418
  @property (nonatomic, assign) BOOL enableFocusRing;
420
- /**
421
- * The z-index of the view.
422
- */
423
- @property (nonatomic, assign) NSInteger reactZIndex;
424
419
 
425
420
  @end
426
421
 
@@ -586,3 +581,17 @@ typedef UITouch RCTUITouch;
586
581
  @interface RCTUITouch : NSEvent
587
582
  @end
588
583
  #endif
584
+
585
+ // RCTUIImageView
586
+
587
+ #if !TARGET_OS_OSX
588
+ typedef UIImageView RCTUIImageView;
589
+ #else
590
+ @interface RCTUIImageView : NSImageView
591
+ NS_ASSUME_NONNULL_BEGIN
592
+ @property (nonatomic, assign) BOOL clipsToBounds;
593
+ @property (nonatomic, strong) RCTUIColor *tintColor;
594
+ @property (nonatomic, assign) UIViewContentMode contentMode;
595
+ NS_ASSUME_NONNULL_END
596
+ @end
597
+ #endif
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(71),
26
- RCTVersionPatch: @(29),
26
+ RCTVersionPatch: @(31),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -416,27 +416,6 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
416
416
  [super layout];
417
417
  }
418
418
 
419
- - (NSArray<RCTUIView *> *)reactZIndexSortedSubviews
420
- {
421
- // Check if sorting is required - in most cases it won't be.
422
- BOOL sortingRequired = NO;
423
- for (RCTUIView *subview in self.subviews) {
424
- if (subview.reactZIndex != 0) {
425
- sortingRequired = YES;
426
- break;
427
- }
428
- }
429
- return sortingRequired ? [self.subviews sortedArrayUsingComparator:^NSComparisonResult(RCTUIView *a, RCTUIView *b) {
430
- if (a.reactZIndex > b.reactZIndex) {
431
- return NSOrderedDescending;
432
- } else {
433
- // Ensure sorting is stable by treating equal zIndex as ascending so
434
- // that original order is preserved.
435
- return NSOrderedAscending;
436
- }
437
- }] : self.subviews;
438
- }
439
-
440
419
  - (void)setNeedsDisplay
441
420
  {
442
421
  self.needsDisplay = YES;
@@ -472,6 +451,7 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
472
451
  {
473
452
  if (self = [super initWithFrame:frame]) {
474
453
  self.scrollEnabled = YES;
454
+ self.drawsBackground = NO;
475
455
  }
476
456
 
477
457
  return self;
@@ -781,4 +761,96 @@ BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
781
761
 
782
762
  @end
783
763
 
764
+ // RCTUIImageView
765
+
766
+ @implementation RCTUIImageView {
767
+ CALayer *_tintingLayer;
768
+ }
769
+
770
+ - (instancetype)initWithFrame:(CGRect)frame
771
+ {
772
+ if (self = [super initWithFrame:frame]) {
773
+ [self setLayer:[[CALayer alloc] init]];
774
+ [self setWantsLayer:YES];
775
+ }
776
+
777
+ return self;
778
+ }
779
+
780
+ - (BOOL)clipsToBounds
781
+ {
782
+ return [[self layer] masksToBounds];
783
+ }
784
+
785
+ - (void)setClipsToBounds:(BOOL)clipsToBounds
786
+ {
787
+ [[self layer] setMasksToBounds:clipsToBounds];
788
+ }
789
+
790
+ - (void)setContentMode:(UIViewContentMode)contentMode
791
+ {
792
+ _contentMode = contentMode;
793
+
794
+ CALayer *layer = [self layer];
795
+ switch (contentMode) {
796
+ case UIViewContentModeScaleAspectFill:
797
+ [layer setContentsGravity:kCAGravityResizeAspectFill];
798
+ break;
799
+
800
+ case UIViewContentModeScaleAspectFit:
801
+ [layer setContentsGravity:kCAGravityResizeAspect];
802
+ break;
803
+
804
+ case UIViewContentModeScaleToFill:
805
+ [layer setContentsGravity:kCAGravityResize];
806
+ break;
807
+
808
+ case UIViewContentModeCenter:
809
+ [layer setContentsGravity:kCAGravityCenter];
810
+ break;
811
+
812
+ default:
813
+ break;
814
+ }
815
+ }
816
+
817
+ - (UIImage *)image
818
+ {
819
+ return [[self layer] contents];
820
+ }
821
+
822
+ - (void)setImage:(UIImage *)image
823
+ {
824
+ CALayer *layer = [self layer];
825
+
826
+ if ([layer contents] != image || [layer backgroundColor] != nil) {
827
+ if (_tintColor) {
828
+ if (!_tintingLayer) {
829
+ _tintingLayer = [CALayer new];
830
+ [_tintingLayer setFrame:self.bounds];
831
+ [_tintingLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable];
832
+ [_tintingLayer setZPosition:1.0];
833
+ CIFilter *sourceInCompositingFilter = [CIFilter filterWithName:@"CISourceInCompositing"];
834
+ [sourceInCompositingFilter setDefaults];
835
+ [_tintingLayer setCompositingFilter:sourceInCompositingFilter];
836
+ [layer addSublayer:_tintingLayer];
837
+ }
838
+ [_tintingLayer setBackgroundColor:_tintColor.CGColor];
839
+ } else {
840
+ [_tintingLayer removeFromSuperlayer];
841
+ _tintingLayer = nil;
842
+ }
843
+
844
+ if (image != nil && [image resizingMode] == NSImageResizingModeTile) {
845
+ [layer setContents:nil];
846
+ [layer setBackgroundColor:[NSColor colorWithPatternImage:image].CGColor];
847
+ } else {
848
+ [layer setContents:image];
849
+ [layer setBackgroundColor:nil];
850
+ }
851
+ }
852
+ }
853
+
854
+ @end
855
+
784
856
  #endif
@@ -31,10 +31,8 @@ using namespace facebook::react;
31
31
  _props = defaultProps;
32
32
 
33
33
  _imageView = [RCTUIImageViewAnimated new];
34
- #if !TARGET_OS_OSX // [macOS]
35
34
  _imageView.clipsToBounds = YES;
36
35
  _imageView.contentMode = RCTContentModeFromImageResizeMode(defaultProps->resizeMode);
37
- #endif // [macOS]
38
36
  _imageView.layer.minificationFilter = kCAFilterTrilinear;
39
37
  _imageView.layer.magnificationFilter = kCAFilterTrilinear;
40
38
 
@@ -58,7 +56,6 @@ using namespace facebook::react;
58
56
  auto const &oldImageProps = *std::static_pointer_cast<ImageProps const>(_props);
59
57
  auto const &newImageProps = *std::static_pointer_cast<ImageProps const>(props);
60
58
 
61
- #if !TARGET_OS_OSX // [macOS]
62
59
  // `resizeMode`
63
60
  if (oldImageProps.resizeMode != newImageProps.resizeMode) {
64
61
  _imageView.contentMode = RCTContentModeFromImageResizeMode(newImageProps.resizeMode);
@@ -68,7 +65,6 @@ using namespace facebook::react;
68
65
  if (oldImageProps.tintColor != newImageProps.tintColor) {
69
66
  _imageView.tintColor = RCTUIColorFromSharedColor(newImageProps.tintColor);
70
67
  }
71
- #endif // [macOS]
72
68
 
73
69
  [super updateProps:props oldProps:oldProps];
74
70
  }
@@ -149,6 +145,11 @@ using namespace facebook::react;
149
145
  image = [image resizableImageWithCapInsets:RCTUIEdgeInsetsFromEdgeInsets(imageProps.capInsets)
150
146
  resizingMode:UIImageResizingModeStretch];
151
147
  }
148
+ #else
149
+ if (imageProps.resizeMode == ImageResizeMode::Repeat) {
150
+ image.capInsets = RCTUIEdgeInsetsFromEdgeInsets(imageProps.capInsets);
151
+ image.resizingMode = NSImageResizingModeTile;
152
+ }
152
153
  #endif // [macOS]
153
154
 
154
155
  if (imageProps.blurRadius > __FLT_EPSILON__) {
@@ -54,13 +54,13 @@ using namespace facebook::react;
54
54
  }
55
55
 
56
56
  UIEdgeInsets insets = [self _safeAreaInsets];
57
+ CGFloat scale = _layoutMetrics.pointScaleFactor; // [macOS]
57
58
  #if !TARGET_OS_OSX // [macOS]
58
59
  insets.left = RCTRoundPixelValue(insets.left);
59
60
  insets.top = RCTRoundPixelValue(insets.top);
60
61
  insets.right = RCTRoundPixelValue(insets.right);
61
62
  insets.bottom = RCTRoundPixelValue(insets.bottom);
62
63
  #else // [macOS
63
- CGFloat scale = [[NSScreen mainScreen] backingScaleFactor];;
64
64
  insets.left = RCTRoundPixelValue(insets.left, scale);
65
65
  insets.top = RCTRoundPixelValue(insets.top, scale);
66
66
  insets.right = RCTRoundPixelValue(insets.right, scale);
@@ -68,8 +68,8 @@ using namespace facebook::react;
68
68
  #endif // macOS]
69
69
 
70
70
  auto newPadding = RCTEdgeInsetsFromUIEdgeInsets(insets);
71
- auto threshold = 1.0 / RCTScreenScale() + 0.01; // Size of a pixel plus some small threshold.
72
-
71
+ auto threshold = 1.0 / scale + 0.01; // Size of a pixel plus some small threshold. [macOS]
72
+
73
73
  _state->updateState(
74
74
  [=](SafeAreaViewShadowNode::ConcreteState::Data const &oldData)
75
75
  -> SafeAreaViewShadowNode::ConcreteState::SharedData {
@@ -259,6 +259,9 @@ using namespace facebook::react;
259
259
  {
260
260
  [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
261
261
 
262
+ #if TARGET_OS_OSX // [macOS
263
+ _backedTextInputView.pointScaleFactor = layoutMetrics.pointScaleFactor;
264
+ #endif // macOS]
262
265
  _backedTextInputView.frame =
263
266
  UIEdgeInsetsInsetRect(self.bounds, RCTUIEdgeInsetsFromEdgeInsets(layoutMetrics.borderWidth));
264
267
  _backedTextInputView.textContainerInset =
@@ -460,7 +460,6 @@ using namespace facebook::react;
460
460
  return _propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN;
461
461
  }
462
462
 
463
- #if !TARGET_OS_OSX // [macOS]
464
463
  - (RCTUIView *)betterHitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS]
465
464
  {
466
465
  // This is a classic textbook implementation of `hitTest:` with a couple of improvements:
@@ -511,60 +510,6 @@ using namespace facebook::react;
511
510
  return view != self ? view : nil;
512
511
  }
513
512
  }
514
- #else // [macOS
515
-
516
- - (RCTUIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS]
517
- {
518
- BOOL canReceiveTouchEvents = ([self isUserInteractionEnabled] && ![self isHidden]);
519
- if (!canReceiveTouchEvents) {
520
- return nil;
521
- }
522
-
523
- // `hitSubview` is the topmost subview which was hit. The hit point can
524
- // be outside the bounds of `view` (e.g., if -clipsToBounds is NO).
525
- RCTUIView *hitSubview = nil; // [macOS]
526
- BOOL isPointInside = [self pointInside:point withEvent:event];
527
- BOOL needsHitSubview = !(_props->pointerEvents == PointerEventsMode::None || _props->pointerEvents == PointerEventsMode::BoxOnly);
528
- if (needsHitSubview && (![self clipsToBounds] || isPointInside)) {
529
- // Take z-index into account when calculating the touch target.
530
- NSArray<RCTUIView *> *sortedSubviews = [self reactZIndexSortedSubviews]; // [macOS]
531
-
532
- // The default behaviour of UIKit is that if a view does not contain a point,
533
- // then no subviews will be returned from hit testing, even if they contain
534
- // the hit point. By doing hit testing directly on the subviews, we bypass
535
- // the strict containment policy (i.e., UIKit guarantees that every ancestor
536
- // of the hit view will return YES from -pointInside:withEvent:). See:
537
- // - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html
538
- for (RCTUIView *subview in [sortedSubviews reverseObjectEnumerator]) { // [macOS]
539
- CGPoint pointForHitTest = CGPointZero;
540
- if ([subview isKindOfClass:[RCTUIView class]]) { // [macOS]
541
- pointForHitTest = [subview convertPoint:point fromView:self];
542
- } else {
543
- pointForHitTest = point;
544
- }
545
- hitSubview = (RCTUIView *)[subview hitTest:pointForHitTest]; // [macOS]
546
- if (hitSubview != nil) {
547
- break;
548
- }
549
- }
550
- }
551
-
552
- RCTUIView *hitView = (isPointInside ? self : nil); // [macOS]
553
-
554
- switch (_props->pointerEvents) {
555
- case PointerEventsMode::None:
556
- return nil;
557
- case PointerEventsMode::Auto:
558
- return hitSubview ?: hitView;
559
- case PointerEventsMode::BoxOnly:
560
- return hitView;
561
- case PointerEventsMode::BoxNone:
562
- return hitSubview;
563
- default:
564
- return hitSubview ?: hitView;
565
- }
566
- }
567
- #endif // macOS]
568
513
 
569
514
  static RCTCornerRadii RCTCornerRadiiFromBorderRadii(BorderRadii borderRadii)
570
515
  {
@@ -689,7 +634,7 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
689
634
  RCTBorderColors borderColors = RCTCreateRCTBorderColorsFromBorderColors(borderMetrics.borderColors);
690
635
 
691
636
  #if TARGET_OS_OSX // [macOS
692
- CGFloat scaleFactor = self.window.backingScaleFactor;
637
+ CGFloat scaleFactor = _layoutMetrics.pointScaleFactor;
693
638
  #else
694
639
  // On iOS setting the scaleFactor to 0.0 will default to the device's native scale factor.
695
640
  CGFloat scaleFactor = 0.0;
@@ -714,13 +659,13 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
714
659
  CGRect contentsCenter = CGRect{
715
660
  CGPoint{imageCapInsets.left / imageSize.width, imageCapInsets.top / imageSize.height},
716
661
  CGSize{(CGFloat)1.0 / imageSize.width, (CGFloat)1.0 / imageSize.height}};
717
-
662
+
718
663
  #if !TARGET_OS_OSX // [macOS]
719
664
  _borderLayer.contents = (id)image.CGImage;
720
665
  _borderLayer.contentsScale = image.scale;
721
666
  #else // [macOS
722
667
  _borderLayer.contents = [image layerContentsForContentsScale:scaleFactor];
723
- _borderLayer.contentsScale = RCTScreenScale();
668
+ _borderLayer.contentsScale = scaleFactor;
724
669
  #endif // macOS]
725
670
 
726
671
  BOOL isResizable = !UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero);
@@ -660,6 +660,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)act
660
660
  }
661
661
  _activeTouches.erase(touch);
662
662
  #else // [macOS
663
+ _identifierPool.enqueue(activeTouch.touch.identifier);
663
664
  _activeTouches.erase(touch.eventNumber);
664
665
  #endif // macOS]
665
666
  }
@@ -152,6 +152,10 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
152
152
 
153
153
  @property (nonatomic, assign) CATransform3D transform3D;
154
154
 
155
+ // `allowsVibrancy` is readonly on NSView, so let's create a new property to make it assignable
156
+ // that we can set through JS and the getter for `allowsVibrancy` can read in RCTView.
157
+ @property (nonatomic, assign) BOOL allowsVibrancyInternal;
158
+
155
159
  @property (nonatomic, copy) RCTDirectEventBlock onMouseEnter;
156
160
  @property (nonatomic, copy) RCTDirectEventBlock onMouseLeave;
157
161
  @property (nonatomic, copy) RCTDirectEventBlock onDragEnter;
@@ -1509,6 +1509,9 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
1509
1509
  _mouseDownCanMoveWindow = mouseDownCanMoveWindow;
1510
1510
  }
1511
1511
 
1512
+ - (BOOL)allowsVibrancy {
1513
+ return _allowsVibrancyInternal;
1514
+ }
1512
1515
 
1513
1516
  - (NSDictionary*)locationInfoFromEvent:(NSEvent*)event
1514
1517
  {
@@ -420,6 +420,8 @@ RCT_CUSTOM_VIEW_PROPERTY(acceptsFirstMouse, BOOL, RCTView)
420
420
 
421
421
  RCT_EXPORT_VIEW_PROPERTY(mouseDownCanMoveWindow, BOOL)
422
422
 
423
+ RCT_REMAP_VIEW_PROPERTY(allowsVibrancy, allowsVibrancyInternal, BOOL)
424
+
423
425
  RCT_CUSTOM_VIEW_PROPERTY(focusable, BOOL, RCTView)
424
426
  {
425
427
  if ([view respondsToSelector:@selector(setFocusable:)]) {
@@ -476,7 +476,6 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
476
476
  _scrollView.delegate = self;
477
477
  _scrollView.delaysContentTouches = NO;
478
478
  #else // [macOS
479
- _scrollView.drawsBackground = NO;
480
479
  _scrollView.postsBoundsChangedNotifications = YES;
481
480
  _lastScrollPosition = NSZeroPoint;
482
481
  #endif // macOS]
@@ -413,6 +413,15 @@ static __weak RCTPlatformView *_pendingFocusView; // [macOS]
413
413
  self, @selector(accessibilityValueInternal), accessibilityValue, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
414
414
  }
415
415
 
416
+ // [macOS
417
+ #pragma mark - Hit testing
418
+ #if TARGET_OS_OSX
419
+ - (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
420
+ {
421
+ return [self hitTest:point];
422
+ }
423
+ #endif // macOS]
424
+
416
425
  #pragma mark - Debug
417
426
  - (void)react_addRecursiveDescriptionToString:(NSMutableString *)string atLevel:(NSUInteger)level
418
427
  {
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.71.29
1
+ VERSION_NAME=0.71.31
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  # JVM Versions
@@ -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", 71,
20
- "patch", 29,
20
+ "patch", 31,
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 = 71;
20
- int32_t Patch = 29;
20
+ int32_t Patch = 31;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -180,6 +180,9 @@ static inline NSString *_NSStringFromCString(
180
180
  static inline facebook::react::ColorComponents _ColorComponentsFromUIColor(RCTUIColor *color) // [macOS]
181
181
  {
182
182
  CGFloat rgba[4];
183
+ #if TARGET_OS_OSX // [macOS
184
+ color = [color colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]];
185
+ #endif // macOS]
183
186
  RCTGetRGBAColorComponents(color.CGColor, rgba);
184
187
  return {(float)rgba[0], (float)rgba[1], (float)rgba[2], (float)rgba[3]};
185
188
  }
@@ -416,9 +416,8 @@ static void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText)
416
416
  if (!font) {
417
417
  return;
418
418
  }
419
- #if !TARGET_OS_OSX // [macOS]
420
- maximumFontLineHeight = MAX(font.lineHeight, maximumFontLineHeight);
421
- #endif // [macOS]
419
+
420
+ maximumFontLineHeight = MAX(UIFontLineHeight(font), maximumFontLineHeight); // [macOS]
422
421
  }];
423
422
 
424
423
  if (maximumLineHeight < maximumFontLineHeight) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.71.29",
3
+ "version": "0.71.31",
4
4
  "bin": "./cli.js",
5
5
  "description": "React Native for macOS",
6
6
  "license": "MIT",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "react": "18.2.0",
15
- "react-native-macos": "0.71.29"
15
+ "react-native-macos": "0.71.31"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@babel/core": "^7.20.0",