react-native-macos 0.74.24 → 0.74.26

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: 24,
19
+ patch: 26,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -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: @(24),
26
+ RCTVersionPatch: @(26),
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.24
1
+ VERSION_NAME=0.74.26
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", 24,
20
+ "patch", 26,
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 = 24;
20
+ int32_t Patch = 26;
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.24",
3
+ "version": "0.74.26",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- * @flow strict-local
9
- */
10
-
11
- import NativeAddressSanitizerCrash from './NativeAddressSanitizerCrash';
12
-
13
- module.exports = NativeAddressSanitizerCrash;
@@ -1,19 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict-local
8
- * @format
9
- */
10
-
11
- import type {TurboModule} from '../TurboModule/RCTExport';
12
-
13
- import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
14
-
15
- export interface Spec extends TurboModule {}
16
-
17
- export default (TurboModuleRegistry.get<Spec>(
18
- 'RCTAddressSanitizerCrash',
19
- ): ?Spec);
@@ -1,12 +0,0 @@
1
- /*
2
- *
3
- * This source code is licensed under the MIT license found in the
4
- * LICENSE file in the root directory of this source tree.
5
- */
6
-
7
- #import <React/RCTUIKit.h>
8
- #import <React/RCTBridge.h>
9
-
10
- @interface RCTAddressSanitizerCrashManager : NSObject <RCTBridgeModule>
11
-
12
- @end
@@ -1,18 +0,0 @@
1
- //
2
- // RCTAddressSanitizerCrashManager.mm
3
- // Pods
4
- //
5
-
6
- #import "RCTAddressSanitizerCrashManager.h"
7
-
8
- @implementation RCTAddressSanitizerCrashManager
9
-
10
- RCT_EXPORT_MODULE(ASANCrash)
11
-
12
- RCT_EXPORT_METHOD(invokeMemoryCrash) {
13
- char *s = (char*)malloc(100);
14
- free(s);
15
- strcpy(s, "Hello world!"); // AddressSanitizer: heap-use-after-free
16
- }
17
-
18
- @end