react-native-macos 0.74.25 → 0.74.27

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.
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 74,
19
- patch: 25,
19
+ patch: 27,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -38,15 +38,13 @@ RCT_EXPORT_MODULE()
38
38
  _queue.maxConcurrentOperationCount = 2;
39
39
  }
40
40
 
41
- __weak __block NSBlockOperation *weakOp;
42
- __block NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{
43
- // [macOS
44
- NSBlockOperation *strongOp = weakOp; // Strong reference to avoid deallocation during execution
41
+ NSBlockOperation *op = [NSBlockOperation new];
42
+ __weak NSBlockOperation *weakOp = op;
43
+ [op addExecutionBlock:^{
44
+ NSBlockOperation *strongOp = weakOp; // Strong reference to avoid deallocation during execution
45
45
  if (strongOp == nil || [strongOp isCancelled]) {
46
46
  return;
47
47
  }
48
- // macOS]
49
-
50
48
  // Get mime type
51
49
  NSRange firstSemicolon = [request.URL.resourceSpecifier rangeOfString:@";"];
52
50
  NSString *mimeType =
@@ -58,18 +56,17 @@ RCT_EXPORT_MODULE()
58
56
  expectedContentLength:-1
59
57
  textEncodingName:nil];
60
58
 
61
- [delegate URLRequest:strongOp didReceiveResponse:response]; // [macOS]
59
+ [delegate URLRequest:strongOp didReceiveResponse:response];
62
60
 
63
61
  // Load data
64
62
  NSError *error;
65
63
  NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
66
64
  if (data) {
67
- [delegate URLRequest:strongOp didReceiveData:data]; // [macOS]
65
+ [delegate URLRequest:strongOp didReceiveData:data];
68
66
  }
69
- [delegate URLRequest:strongOp didCompleteWithError:error]; // [macOS]
67
+ [delegate URLRequest:strongOp didCompleteWithError:error];
70
68
  }];
71
69
 
72
- weakOp = op;
73
70
  [_queue addOperation:op];
74
71
  return op;
75
72
  }
@@ -46,21 +46,19 @@ RCT_EXPORT_MODULE()
46
46
  _fileQueue.maxConcurrentOperationCount = 4;
47
47
  }
48
48
 
49
- __weak __block NSBlockOperation *weakOp;
50
- __block NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{
51
- // [macOS
52
- NSBlockOperation *strongOp = weakOp; // Strong reference to avoid deallocation during execution
49
+ NSBlockOperation *op = [NSBlockOperation new];
50
+ __weak NSBlockOperation *weakOp = op;
51
+ [op addExecutionBlock:^{
52
+ NSBlockOperation *strongOp = weakOp; // Strong reference to avoid deallocation during execution
53
53
  if (strongOp == nil || [strongOp isCancelled]) {
54
54
  return;
55
55
  }
56
- // macOS]
57
-
58
56
  // Get content length
59
57
  NSError *error = nil;
60
58
  NSFileManager *fileManager = [NSFileManager new];
61
59
  NSDictionary<NSString *, id> *fileAttributes = [fileManager attributesOfItemAtPath:request.URL.path error:&error];
62
60
  if (!fileAttributes) {
63
- [delegate URLRequest:strongOp didCompleteWithError:error]; // [macOS]
61
+ [delegate URLRequest:strongOp didCompleteWithError:error];
64
62
  return;
65
63
  }
66
64
 
@@ -77,17 +75,16 @@ RCT_EXPORT_MODULE()
77
75
  expectedContentLength:[fileAttributes[NSFileSize] ?: @-1 integerValue]
78
76
  textEncodingName:nil];
79
77
 
80
- [delegate URLRequest:strongOp didReceiveResponse:response]; // [macOS]
78
+ [delegate URLRequest:strongOp didReceiveResponse:response];
81
79
 
82
80
  // Load data
83
81
  NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
84
82
  if (data) {
85
- [delegate URLRequest:strongOp didReceiveData:data]; // [macOS]
83
+ [delegate URLRequest:strongOp didReceiveData:data];
86
84
  }
87
- [delegate URLRequest:strongOp didCompleteWithError:error]; // [macOS]
85
+ [delegate URLRequest:strongOp didCompleteWithError:error];
88
86
  }];
89
87
 
90
- weakOp = op;
91
88
  [_fileQueue addOperation:op];
92
89
  return op;
93
90
  }
@@ -128,8 +128,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
128
128
  #else // [macOS
129
129
  // -[NSView hitTest:] takes coordinates in a view's superview coordinate system.
130
130
  // The assumption here is that a RCTUIView/RCTSurfaceView will always have a superview.
131
- CGPoint touchLocation = [self.view.superview convertPoint:touch.locationInWindow fromView:nil];
132
- NSView *targetView = [self.view hitTest:touchLocation];
131
+ NSView *superview = [[self view] superview];
132
+ const CGPoint touchLocationInSuperview = [superview convertPoint:touch.locationInWindow fromView:nil];
133
+ NSView *targetView = [self.view hitTest:touchLocationInSuperview];
133
134
  // Don't record clicks on scrollbars.
134
135
  if ([targetView isKindOfClass:[NSScroller class]]) {
135
136
  continue;
@@ -148,8 +149,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
148
149
  } else {
149
150
  _shouldSendMouseUpOnSystemBehalf = NO;
150
151
  }
151
- touchLocation = [targetView convertPoint:touchLocation fromView:self.view.superview];
152
-
152
+
153
153
  while (targetView) {
154
154
  BOOL isUserInteractionEnabled = NO;
155
155
  if ([((RCTUIView*)targetView) respondsToSelector:@selector(isUserInteractionEnabled)]) { // [macOS]
@@ -161,7 +161,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
161
161
  targetView = targetView.superview;
162
162
  }
163
163
 
164
- NSNumber *reactTag = [targetView reactTagAtPoint:touchLocation];
164
+ const CGPoint touchLocationInSelf = [targetView convertPoint:touchLocationInSuperview fromView:self.view.superview];
165
+ NSNumber *reactTag = [targetView reactTagAtPoint:touchLocationInSelf];
165
166
  BOOL isUserInteractionEnabled = NO;
166
167
  if ([((RCTUIView*)targetView) respondsToSelector:@selector(isUserInteractionEnabled)]) { // [macOS]
167
168
  isUserInteractionEnabled = ((RCTUIView*)targetView).isUserInteractionEnabled; // [macOS]
@@ -489,7 +489,10 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
489
489
 
490
490
  NS_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *__nullable event)
491
491
  {
492
- return [view hitTest:point];
492
+ // [macOS IMPORTANT -- point is in local coordinate space, but OSX expects super coordinate space for hitTest:
493
+ NSView *superview = [view superview];
494
+ NSPoint pointInSuperview = superview != nil ? [view convertPoint:point toView:superview] : point;
495
+ return [view hitTest:pointInSuperview];
493
496
  }
494
497
 
495
498
  BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view);
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(74),
26
- RCTVersionPatch: @(25),
26
+ RCTVersionPatch: @(27),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -491,7 +491,10 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
491
491
 
492
492
  - (NSView *)hitTest:(NSPoint)point
493
493
  {
494
- return [self hitTest:NSPointToCGPoint(point) withEvent:nil];
494
+ // IMPORTANT point is passed in super coordinates by OSX, but expected to be passed in local coordinates
495
+ NSView *superview = [self superview];
496
+ NSPoint pointInSelf = superview != nil ? [self convertPoint:point fromView:superview] : point;
497
+ return [self hitTest:pointInSelf withEvent:nil];
495
498
  }
496
499
 
497
500
  - (BOOL)wantsUpdateLayer
@@ -542,7 +545,11 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
542
545
 
543
546
  - (NSView *)hitTest:(CGPoint)point withEvent:(__unused UIEvent *)event
544
547
  {
545
- return self.userInteractionEnabled ? [super hitTest:NSPointFromCGPoint(point)] : nil;
548
+ // [macOS
549
+ // IMPORTANT point is expected to be passed in local coordinates, but OSX expects point to be super
550
+ NSView *superview = [self superview];
551
+ NSPoint pointInSuperview = superview != nil ? [self convertPoint:point toView:superview] : point;
552
+ return self.userInteractionEnabled ? [super hitTest:pointInSuperview] : nil;
546
553
  }
547
554
 
548
555
  - (BOOL)pointInside:(CGPoint)point withEvent:(__unused UIEvent *)event
@@ -252,17 +252,8 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
252
252
  // of the hit view will return YES from -pointInside:withEvent:). See:
253
253
  // - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html
254
254
  for (RCTUIView *subview in [sortedSubviews reverseObjectEnumerator]) { // [macOS]
255
- CGPoint pointForHitTest = CGPointZero; // [macOS
256
- #if !TARGET_OS_OSX // [macOS]
257
- pointForHitTest = [subview convertPoint:point fromView:self];
258
- #else // [macOS
259
- if ([subview isKindOfClass:[RCTView class]]) {
260
- pointForHitTest = [subview convertPoint:point fromView:self];
261
- } else {
262
- pointForHitTest = point;
263
- }
264
- #endif // macOS]
265
- hitSubview = RCTUIViewHitTestWithEvent(subview, pointForHitTest, event); // macOS]
255
+ CGPoint pointForHitTest = [subview convertPoint:point fromView:self];
256
+ hitSubview = RCTUIViewHitTestWithEvent(subview, pointForHitTest, event); // [macOS]
266
257
  if (hitSubview != nil) {
267
258
  break;
268
259
  }
@@ -573,10 +573,13 @@ static __weak RCTPlatformView *_pendingFocusView; // [macOS]
573
573
 
574
574
  // [macOS
575
575
  #pragma mark - Hit testing
576
- #if TARGET_OS_OSX
576
+ #if TARGET_OS_OSX
577
+ // IMPORTANT -- point is in local coordinate space, unlike the hitTest: version from OSX which is in super's coordinate space
577
578
  - (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
578
579
  {
579
- return [self hitTest:point];
580
+ NSView *superview = [self superview];
581
+ NSPoint pointInSuper = superview != nil ? [self convertPoint:point toView:superview] : point;
582
+ return [self hitTest:pointInSuper];
580
583
  }
581
584
  #endif // macOS]
582
585
 
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.74.25
1
+ VERSION_NAME=0.74.27
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", 74,
20
- "patch", 25,
20
+ "patch", 27,
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 = 74;
20
- int32_t Patch = 25;
20
+ int32_t Patch = 27;
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.74.25",
3
+ "version": "0.74.27",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {