react-native-macos 0.76.5 → 0.76.7

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 (90) hide show
  1. package/Libraries/AppDelegate/RCTAppDelegate.mm +0 -5
  2. package/Libraries/AppDelegate/RCTAppSetupUtils.h +1 -1
  3. package/Libraries/AppDelegate/RCTAppSetupUtils.mm +4 -2
  4. package/Libraries/AppDelegate/RCTRootViewFactory.mm +2 -3
  5. package/Libraries/Core/ReactNativeVersion.js +1 -1
  6. package/Libraries/Image/RCTImageLoader.mm +9 -1
  7. package/Libraries/Image/RCTImageView.mm +5 -0
  8. package/Libraries/Image/RCTImageViewManager.mm +4 -0
  9. package/Libraries/Network/RCTDataRequestHandler.mm +10 -3
  10. package/Libraries/Network/RCTFileRequestHandler.mm +11 -4
  11. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.mm +3 -1
  12. package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +2 -1
  13. package/Libraries/Utilities/Appearance.js +3 -1
  14. package/React/Base/RCTRootView.m +58 -0
  15. package/React/Base/RCTTouchHandler.m +6 -5
  16. package/React/Base/RCTUIKit.h +4 -1
  17. package/React/Base/RCTVersion.m +1 -1
  18. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +2 -5
  19. package/React/Base/macOS/RCTUIKit.m +9 -2
  20. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2354 -0
  21. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +2820 -0
  22. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h +2 -1
  23. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +8 -18
  24. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +3 -0
  25. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +17 -18
  26. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +16 -5
  27. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +14 -11
  28. package/React/Views/RCTFont.h +2 -0
  29. package/React/Views/RCTFont.mm +4 -5
  30. package/React/Views/RCTView.m +2 -11
  31. package/React/Views/ScrollView/RCTScrollView.h +3 -1
  32. package/React/Views/ScrollView/RCTScrollView.m +8 -0
  33. package/React/Views/UIView+React.m +5 -2
  34. package/ReactAndroid/api/ReactAndroid.api +4 -0
  35. package/ReactAndroid/cmake-utils/ReactNative-application.cmake +18 -3
  36. package/ReactAndroid/gradle.properties +1 -1
  37. package/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java +12 -13
  38. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +8 -2
  39. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +15 -8
  40. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +1 -7
  41. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +1 -11
  42. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +1 -3
  43. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +1 -3
  44. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +1 -12
  45. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +1 -3
  46. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  47. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +11 -3
  48. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +11 -3
  49. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +25 -0
  50. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +16 -2
  51. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +1 -0
  52. package/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +17 -19
  53. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +1 -15
  54. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +1 -4
  55. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  56. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +1 -5
  57. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +1 -6
  58. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +47 -65
  59. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +2 -4
  60. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +1 -5
  61. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +1 -2
  62. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +9 -0
  63. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +1 -6
  64. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +1 -3
  65. package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +5 -0
  66. package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +2 -0
  67. package/ReactCommon/react/renderer/attributedstring/conversions.h +5 -0
  68. package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +12 -0
  69. package/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +2 -3
  70. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +8 -4
  71. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTFontUtils.mm +31 -11
  72. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h +2 -2
  73. package/ReactCommon/react/renderer/uimanager/UIManager.cpp +29 -8
  74. package/ReactCommon/react/runtime/ReactInstance.cpp +39 -35
  75. package/ReactCommon/react/runtime/ReactInstance.h +2 -1
  76. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +3 -2
  77. package/gradle/libs.versions.toml +1 -1
  78. package/jest/setup.js +5 -1
  79. package/local-cli/generator-macos/templates/macos/HelloWorld-macOS/AppDelegate.mm +5 -0
  80. package/package.json +8 -8
  81. package/scripts/cocoapods/new_architecture.rb +1 -1
  82. package/scripts/cocoapods/utils.rb +6 -6
  83. package/scripts/codegen/generate-artifacts-executor.js +68 -7
  84. package/src/private/animated/NativeAnimatedHelper.js +3 -1
  85. package/src/private/featureflags/ReactNativeFeatureFlags.js +1 -6
  86. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +1 -2
  87. package/Libraries/AddressSanitizerCrash/AddressSanitizerCrash.js +0 -13
  88. package/Libraries/AddressSanitizerCrash/NativeAddressSanitizerCrash.js +0 -19
  89. package/React/CoreModules/RCTAddressSanitizerCrashManager.h +0 -12
  90. package/React/CoreModules/RCTAddressSanitizerCrashManager.mm +0 -18
@@ -110,11 +110,6 @@
110
110
  #endif // macOS]
111
111
  }
112
112
 
113
- - (void)applicationDidEnterBackground:(UIApplication *)application
114
- {
115
- // Noop
116
- }
117
-
118
113
  - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
119
114
  {
120
115
  [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
@@ -46,7 +46,7 @@ std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupJsExecutorFactory
46
46
  RCT_EXTERN_C_BEGIN
47
47
 
48
48
  void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled);
49
- RCTUIView *RCTAppSetupDefaultRootView( // [macOS]
49
+ RCTPlatformView *RCTAppSetupDefaultRootView( // [macOS]
50
50
  RCTBridge *bridge,
51
51
  NSString *moduleName,
52
52
  NSDictionary *initialProperties,
@@ -48,14 +48,16 @@ void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled)
48
48
  #endif
49
49
  }
50
50
 
51
- RCTUIView * // [macOS]
51
+ RCTPlatformView * // [macOS]
52
52
  RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties, BOOL fabricEnabled)
53
53
  {
54
54
  if (fabricEnabled) {
55
55
  id<RCTSurfaceProtocol> surface = [[RCTFabricSurface alloc] initWithBridge:bridge
56
56
  moduleName:moduleName
57
57
  initialProperties:initialProperties];
58
- return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
58
+ RCTPlatformView *rootView = [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
59
+ [surface start];
60
+ return rootView;
59
61
  }
60
62
  return [[RCTRootView alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
61
63
  }
@@ -159,9 +159,8 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
159
159
 
160
160
  RCTFabricSurface *surface = [self.reactHost createSurfaceWithModuleName:moduleName initialProperties:initProps];
161
161
 
162
- RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView = [[RCTSurfaceHostingProxyRootView alloc]
163
- initWithSurface:surface
164
- sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact];
162
+ RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView =
163
+ [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
165
164
 
166
165
  #if !TARGET_OS_OSX // [macOS]
167
166
  surfaceHostingProxyRootView.backgroundColor = [UIColor systemBackgroundColor];
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 76,
19
- patch: 5,
19
+ patch: 7,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -523,7 +523,15 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image, CGSize size, CGFloat scal
523
523
 
524
524
  // Add missing png extension
525
525
  if (request.URL.fileURL && request.URL.pathExtension.length == 0) {
526
- mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
526
+ // Check if there exists a file with that url on disk already
527
+ // This should fix issue https://github.com/facebook/react-native/issues/46870
528
+ if ([[NSFileManager defaultManager] fileExistsAtPath:request.URL.path]) {
529
+ mutableRequest.URL = request.URL;
530
+ } else {
531
+ // This is the default behavior in case there is no file on disk with no extension.
532
+ // We assume that the extension is `png`.
533
+ mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
534
+ }
527
535
  }
528
536
  if (_redirectDelegate != nil) {
529
537
  mutableRequest.URL = [_redirectDelegate redirectAssetsURL:mutableRequest.URL];
@@ -629,6 +629,11 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
629
629
  return _imageView;
630
630
  }
631
631
 
632
+ - (NSCell *)reactAccessibilityElementCell
633
+ {
634
+ return _imageView.cell;
635
+ }
636
+
632
637
  - (NSColor *)tintColor
633
638
  {
634
639
  return _imageView.tintColor;
@@ -30,6 +30,10 @@ RCT_EXPORT_MODULE()
30
30
  return [[RCTImageView alloc] initWithBridge:self.bridge];
31
31
  }
32
32
 
33
+ #if TARGET_OS_OSX // [macOS
34
+ // setting accessibilityElement on NSImageView has no effect, must be set on NSImageCell
35
+ RCT_REMAP_VIEW_PROPERTY(accessible, reactAccessibilityElementCell.accessibilityElement, BOOL)
36
+ #endif // macOS]
33
37
  RCT_EXPORT_VIEW_PROPERTY(blurRadius, CGFloat)
34
38
  RCT_EXPORT_VIEW_PROPERTY(capInsets, UIEdgeInsets)
35
39
  RCT_REMAP_VIEW_PROPERTY(defaultSource, defaultImage, UIImage)
@@ -40,6 +40,13 @@ RCT_EXPORT_MODULE()
40
40
 
41
41
  __weak __block NSBlockOperation *weakOp;
42
42
  __block NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{
43
+ // [macOS
44
+ NSBlockOperation *strongOp = weakOp; // Strong reference to avoid deallocation during execution
45
+ if (strongOp == nil || [strongOp isCancelled]) {
46
+ return;
47
+ }
48
+ // macOS]
49
+
43
50
  // Get mime type
44
51
  NSRange firstSemicolon = [request.URL.resourceSpecifier rangeOfString:@";"];
45
52
  NSString *mimeType =
@@ -51,15 +58,15 @@ RCT_EXPORT_MODULE()
51
58
  expectedContentLength:-1
52
59
  textEncodingName:nil];
53
60
 
54
- [delegate URLRequest:weakOp didReceiveResponse:response];
61
+ [delegate URLRequest:strongOp didReceiveResponse:response]; // [macOS]
55
62
 
56
63
  // Load data
57
64
  NSError *error;
58
65
  NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
59
66
  if (data) {
60
- [delegate URLRequest:weakOp didReceiveData:data];
67
+ [delegate URLRequest:strongOp didReceiveData:data]; // [macOS]
61
68
  }
62
- [delegate URLRequest:weakOp didCompleteWithError:error];
69
+ [delegate URLRequest:strongOp didCompleteWithError:error]; // [macOS]
63
70
  }];
64
71
 
65
72
  weakOp = op;
@@ -48,12 +48,19 @@ RCT_EXPORT_MODULE()
48
48
 
49
49
  __weak __block NSBlockOperation *weakOp;
50
50
  __block NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{
51
+ // [macOS
52
+ NSBlockOperation *strongOp = weakOp; // Strong reference to avoid deallocation during execution
53
+ if (strongOp == nil || [strongOp isCancelled]) {
54
+ return;
55
+ }
56
+ // macOS]
57
+
51
58
  // Get content length
52
59
  NSError *error = nil;
53
60
  NSFileManager *fileManager = [NSFileManager new];
54
61
  NSDictionary<NSString *, id> *fileAttributes = [fileManager attributesOfItemAtPath:request.URL.path error:&error];
55
62
  if (!fileAttributes) {
56
- [delegate URLRequest:weakOp didCompleteWithError:error];
63
+ [delegate URLRequest:strongOp didCompleteWithError:error]; // [macOS]
57
64
  return;
58
65
  }
59
66
 
@@ -70,14 +77,14 @@ RCT_EXPORT_MODULE()
70
77
  expectedContentLength:[fileAttributes[NSFileSize] ?: @-1 integerValue]
71
78
  textEncodingName:nil];
72
79
 
73
- [delegate URLRequest:weakOp didReceiveResponse:response];
80
+ [delegate URLRequest:strongOp didReceiveResponse:response]; // [macOS]
74
81
 
75
82
  // Load data
76
83
  NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
77
84
  if (data) {
78
- [delegate URLRequest:weakOp didReceiveData:data];
85
+ [delegate URLRequest:strongOp didReceiveData:data]; // [macOS]
79
86
  }
80
- [delegate URLRequest:weakOp didCompleteWithError:error];
87
+ [delegate URLRequest:strongOp didCompleteWithError:error]; // [macOS]
81
88
  }];
82
89
 
83
90
  weakOp = op;
@@ -134,7 +134,9 @@
134
134
  CGSize textViewSize = [_backedTextInputView intrinsicContentSize];
135
135
  NSClipView *clipView = (NSClipView *)_scrollView.contentView;
136
136
  if (textViewSize.height > clipView.bounds.size.height) {
137
- return YES;
137
+ // Sometimes dimensions returned are in floating point numbers.
138
+ // If the floats are close enough, then don't show the scrollbar even if there is a fraction of overflow with the text.
139
+ return fabs(textViewSize.height - clipView.bounds.size.height) >= 1;
138
140
  };
139
141
 
140
142
  return NO;
@@ -47,6 +47,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
47
47
  {
48
48
  if (![self isDescendantOfView:scrollView]) {
49
49
  // View is outside scroll view
50
+ scrollView.firstResponderViewOutsideScrollView = self.backedTextInputView;
50
51
  return;
51
52
  }
52
53
 
@@ -611,7 +612,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
611
612
  _maxLength.integerValue - (NSInteger)backedTextInputView.attributedText.string.length + (NSInteger)range.length,
612
613
  0);
613
614
 
614
- if (text.length > _maxLength.integerValue) {
615
+ if (text.length > allowedLength) {
615
616
  // If we typed/pasted more than one character, limit the text inputted.
616
617
  if (text.length > 1) {
617
618
  if (allowedLength > 0) {
@@ -105,7 +105,9 @@ export function setColorScheme(colorScheme: ?ColorSchemeName): void {
105
105
  const {NativeAppearance} = state;
106
106
  if (NativeAppearance != null) {
107
107
  NativeAppearance.setColorScheme(colorScheme ?? 'unspecified');
108
- state.appearance = {colorScheme};
108
+ state.appearance = {
109
+ colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
110
+ };
109
111
  }
110
112
  }
111
113
 
@@ -16,6 +16,7 @@
16
16
  #import "RCTBridge.h"
17
17
  #import "RCTConstants.h"
18
18
  #import "RCTDevSettings.h" // [macOS]
19
+ #import "RCTFocusChangeEvent.h" // [macOS]
19
20
  // [macOS] remove #import "RCTKeyCommands.h"
20
21
  #import "RCTLog.h"
21
22
  #import "RCTPerformanceLogger.h"
@@ -432,6 +433,63 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
432
433
  #endif // macOS]
433
434
 
434
435
 
436
+ #pragma mark - Key window blur/focus
437
+
438
+ #if TARGET_OS_OSX // [macOS
439
+ - (void)viewDidMoveToWindow {
440
+ [super viewDidMoveToWindow];
441
+
442
+ NSWindow *window = [self window];
443
+ if (window == nil) {
444
+ return;
445
+ }
446
+
447
+ [[NSNotificationCenter defaultCenter] addObserver:self
448
+ selector:@selector(containingWindowDidBecomeKey)
449
+ name:NSWindowDidBecomeKeyNotification
450
+ object:window];
451
+
452
+ [[NSNotificationCenter defaultCenter] addObserver:self
453
+ selector:@selector(containingWindowDidResignKey)
454
+ name:NSWindowDidResignKeyNotification
455
+ object:window];
456
+ }
457
+
458
+ + (NSNumber *)reactTagClosestToView:(RCTPlatformView *)view {
459
+ // The first responder may not necessarily have a React tag. For example, if we're focused on
460
+ // a multiline <TextInput>, the RN component whose blur/focus events we need to touch is an
461
+ // RCTMultilineTextInputView, but the first responder will be the underlying RCTUITextView.
462
+ for (RCTPlatformView *testView = view; testView != nil; testView = [testView superview]) {
463
+ NSNumber *reactTag = [testView reactTag];
464
+ if (reactTag != nil) {
465
+ return reactTag;
466
+ }
467
+ }
468
+ return nil;
469
+ }
470
+
471
+ - (void)containingWindowDidBecomeKey {
472
+ NSResponder *firstResponder = [[self window] firstResponder];
473
+ if ([firstResponder isKindOfClass:[RCTPlatformView class]]) {
474
+ NSNumber *reactTag = [RCTRootView reactTagClosestToView:(RCTPlatformView *)firstResponder];
475
+ if (reactTag != nil) {
476
+ [[[self bridge] eventDispatcher] sendEvent:[RCTFocusChangeEvent focusEventWithReactTag:reactTag]];
477
+ }
478
+ }
479
+ }
480
+
481
+ - (void)containingWindowDidResignKey {
482
+ NSResponder *firstResponder = [[self window] firstResponder];
483
+ if ([firstResponder isKindOfClass:[RCTPlatformView class]]) {
484
+ NSNumber *reactTag = [RCTRootView reactTagClosestToView:(RCTPlatformView *)firstResponder];
485
+ if (reactTag != nil) {
486
+ [[[self bridge] eventDispatcher] sendEvent:[RCTFocusChangeEvent blurEventWithReactTag:reactTag]];
487
+ }
488
+ }
489
+ }
490
+ #endif // macOS]
491
+
492
+
435
493
  #if TARGET_OS_OSX // [macOS
436
494
  - (NSMenu *)menuForEvent:(NSEvent *)event
437
495
  {
@@ -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]
@@ -486,7 +486,10 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
486
486
 
487
487
  NS_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *__nullable event)
488
488
  {
489
- return [view hitTest:point];
489
+ // [macOS IMPORTANT -- point is in local coordinate space, but OSX expects super coordinate space for hitTest:
490
+ NSView *superview = [view superview];
491
+ NSPoint pointInSuperview = superview != nil ? [view convertPoint:point toView:superview] : point;
492
+ return [view hitTest:pointInSuperview];
490
493
  }
491
494
 
492
495
  BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view);
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(76),
26
- RCTVersionPatch: @(5),
26
+ RCTVersionPatch: @(7),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -53,11 +53,8 @@ static RCTRootViewSizeFlexibility convertToRootViewSizeFlexibility(RCTSurfaceSiz
53
53
 
54
54
  - (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface
55
55
  {
56
- if (self = [super initWithSurface:surface
57
- sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact]) {
58
- [surface start];
59
- }
60
- return self;
56
+ return [super initWithSurface:surface
57
+ sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact];
61
58
  }
62
59
 
63
60
  RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
@@ -454,7 +454,10 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
454
454
 
455
455
  - (NSView *)hitTest:(NSPoint)point
456
456
  {
457
- return [self hitTest:NSPointToCGPoint(point) withEvent:nil];
457
+ // IMPORTANT point is passed in super coordinates by OSX, but expected to be passed in local coordinates
458
+ NSView *superview = [self superview];
459
+ NSPoint pointInSelf = superview != nil ? [self convertPoint:point fromView:superview] : point;
460
+ return [self hitTest:pointInSelf withEvent:nil];
458
461
  }
459
462
 
460
463
  - (BOOL)wantsUpdateLayer
@@ -505,7 +508,11 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
505
508
 
506
509
  - (NSView *)hitTest:(CGPoint)point withEvent:(__unused UIEvent *)event
507
510
  {
508
- return self.userInteractionEnabled ? [super hitTest:NSPointFromCGPoint(point)] : nil;
511
+ // [macOS
512
+ // IMPORTANT point is expected to be passed in local coordinates, but OSX expects point to be super
513
+ NSView *superview = [self superview];
514
+ NSPoint pointInSuperview = superview != nil ? [self convertPoint:point toView:superview] : point;
515
+ return self.userInteractionEnabled ? [super hitTest:pointInSuperview] : nil;
509
516
  }
510
517
 
511
518
  - (BOOL)pointInside:(CGPoint)point withEvent:(__unused UIEvent *)event