react-native-macos 0.74.25 → 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.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/React/Base/RCTTouchHandler.m +6 -5
- package/React/Base/RCTUIKit.h +4 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/macOS/RCTUIKit.m +9 -2
- package/React/Views/RCTView.m +2 -11
- package/React/Views/UIView+React.m +5 -2
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
132
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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]
|
package/React/Base/RCTUIKit.h
CHANGED
|
@@ -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
|
-
|
|
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);
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -491,7 +491,10 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
|
|
|
491
491
|
|
|
492
492
|
- (NSView *)hitTest:(NSPoint)point
|
|
493
493
|
{
|
|
494
|
-
|
|
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
|
-
|
|
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
|
package/React/Views/RCTView.m
CHANGED
|
@@ -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 =
|
|
256
|
-
|
|
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
|
-
|
|
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
|
|