react-native-macos 0.77.0 → 0.77.2
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/Libraries/Network/RCTDataRequestHandler.mm +10 -6
- package/Libraries/Network/RCTFileRequestHandler.mm +11 -7
- package/Libraries/Utilities/Platform.macos.js +5 -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/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +1 -11
- package/React/Views/RCTView.m +2 -13
- 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/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTFontUtils.mm +0 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h +2 -2
- package/package.json +2 -2
- package/scripts/cocoapods/new_architecture.rb +1 -1
- package/Libraries/AddressSanitizerCrash/AddressSanitizerCrash.js +0 -13
- package/Libraries/AddressSanitizerCrash/NativeAddressSanitizerCrash.js +0 -19
- package/React/CoreModules/RCTAddressSanitizerCrashManager.h +0 -12
- package/React/CoreModules/RCTAddressSanitizerCrashManager.mm +0 -18
|
@@ -38,8 +38,13 @@ RCT_EXPORT_MODULE()
|
|
|
38
38
|
_queue.maxConcurrentOperationCount = 2;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
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
|
+
if (strongOp == nil || [strongOp isCancelled]) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
43
48
|
// Get mime type
|
|
44
49
|
NSRange firstSemicolon = [request.URL.resourceSpecifier rangeOfString:@";"];
|
|
45
50
|
NSString *mimeType =
|
|
@@ -51,18 +56,17 @@ RCT_EXPORT_MODULE()
|
|
|
51
56
|
expectedContentLength:-1
|
|
52
57
|
textEncodingName:nil];
|
|
53
58
|
|
|
54
|
-
[delegate URLRequest:
|
|
59
|
+
[delegate URLRequest:strongOp didReceiveResponse:response];
|
|
55
60
|
|
|
56
61
|
// Load data
|
|
57
62
|
NSError *error;
|
|
58
63
|
NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
|
|
59
64
|
if (data) {
|
|
60
|
-
[delegate URLRequest:
|
|
65
|
+
[delegate URLRequest:strongOp didReceiveData:data];
|
|
61
66
|
}
|
|
62
|
-
[delegate URLRequest:
|
|
67
|
+
[delegate URLRequest:strongOp didCompleteWithError:error];
|
|
63
68
|
}];
|
|
64
69
|
|
|
65
|
-
weakOp = op;
|
|
66
70
|
[_queue addOperation:op];
|
|
67
71
|
return op;
|
|
68
72
|
}
|
|
@@ -46,14 +46,19 @@ RCT_EXPORT_MODULE()
|
|
|
46
46
|
_fileQueue.maxConcurrentOperationCount = 4;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
if (strongOp == nil || [strongOp isCancelled]) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
51
56
|
// Get content length
|
|
52
57
|
NSError *error = nil;
|
|
53
58
|
NSFileManager *fileManager = [NSFileManager new];
|
|
54
59
|
NSDictionary<NSString *, id> *fileAttributes = [fileManager attributesOfItemAtPath:request.URL.path error:&error];
|
|
55
60
|
if (!fileAttributes) {
|
|
56
|
-
[delegate URLRequest:
|
|
61
|
+
[delegate URLRequest:strongOp didCompleteWithError:error];
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
64
|
|
|
@@ -70,17 +75,16 @@ RCT_EXPORT_MODULE()
|
|
|
70
75
|
expectedContentLength:[fileAttributes[NSFileSize] ?: @-1 integerValue]
|
|
71
76
|
textEncodingName:nil];
|
|
72
77
|
|
|
73
|
-
[delegate URLRequest:
|
|
78
|
+
[delegate URLRequest:strongOp didReceiveResponse:response];
|
|
74
79
|
|
|
75
80
|
// Load data
|
|
76
81
|
NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
|
|
77
82
|
if (data) {
|
|
78
|
-
[delegate URLRequest:
|
|
83
|
+
[delegate URLRequest:strongOp didReceiveData:data];
|
|
79
84
|
}
|
|
80
|
-
[delegate URLRequest:
|
|
85
|
+
[delegate URLRequest:strongOp didCompleteWithError:error];
|
|
81
86
|
}];
|
|
82
87
|
|
|
83
|
-
weakOp = op;
|
|
84
88
|
[_fileQueue addOperation:op];
|
|
85
89
|
return op;
|
|
86
90
|
}
|
|
@@ -84,7 +84,11 @@ const Platform: PlatformType = {
|
|
|
84
84
|
},
|
|
85
85
|
select: <T>(spec: PlatformSelectSpec<T>): T =>
|
|
86
86
|
// $FlowFixMe[incompatible-return]
|
|
87
|
-
'
|
|
87
|
+
'macos' in spec
|
|
88
|
+
? spec.macos
|
|
89
|
+
: 'native' in spec
|
|
90
|
+
? spec.native
|
|
91
|
+
: spec.default,
|
|
88
92
|
};
|
|
89
93
|
|
|
90
94
|
module.exports = Platform;
|
|
@@ -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
|
@@ -484,7 +484,10 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
|
|
|
484
484
|
|
|
485
485
|
NS_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *__nullable event)
|
|
486
486
|
{
|
|
487
|
-
|
|
487
|
+
// [macOS IMPORTANT -- point is in local coordinate space, but OSX expects super coordinate space for hitTest:
|
|
488
|
+
NSView *superview = [view superview];
|
|
489
|
+
NSPoint pointInSuperview = superview != nil ? [view convertPoint:point toView:superview] : point;
|
|
490
|
+
return [view hitTest:pointInSuperview];
|
|
488
491
|
}
|
|
489
492
|
|
|
490
493
|
BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view);
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -454,7 +454,10 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
|
|
|
454
454
|
|
|
455
455
|
- (NSView *)hitTest:(NSPoint)point
|
|
456
456
|
{
|
|
457
|
-
|
|
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
|
-
|
|
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
|
|
@@ -680,17 +680,7 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
|
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
for (RCTUIView *subview in [self.subviews reverseObjectEnumerator]) { // [macOS]
|
|
683
|
-
#if !TARGET_OS_OSX // [macOS]
|
|
684
683
|
RCTUIView *hitView = [subview hitTest:[subview convertPoint:point fromView:self] withEvent:event]; // [macOS]
|
|
685
|
-
#else // [macOS
|
|
686
|
-
// Native macOS views require the point to be in the super view coordinate space for hit testing.
|
|
687
|
-
CGPoint hitTestPoint = point;
|
|
688
|
-
// Fabric components use the target view coordinate space for hit testing
|
|
689
|
-
if ([subview isKindOfClass:[RCTViewComponentView class]]) {
|
|
690
|
-
hitTestPoint = [subview convertPoint:point fromView:self];
|
|
691
|
-
}
|
|
692
|
-
RCTUIView *hitView = [subview hitTest:hitTestPoint withEvent:event]; // [macOS]
|
|
693
|
-
#endif // macOS]
|
|
694
684
|
if (hitView) {
|
|
695
685
|
return hitView;
|
|
696
686
|
}
|
|
@@ -1533,4 +1523,4 @@ Class<RCTComponentViewProtocol> RCTViewCls(void);
|
|
|
1533
1523
|
Class<RCTComponentViewProtocol> RCTViewCls(void)
|
|
1534
1524
|
{
|
|
1535
1525
|
return RCTViewComponentView.class;
|
|
1536
|
-
}
|
|
1526
|
+
}
|
package/React/Views/RCTView.m
CHANGED
|
@@ -251,18 +251,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
|
|
|
251
251
|
// of the hit view will return YES from -pointInside:withEvent:). See:
|
|
252
252
|
// - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html
|
|
253
253
|
for (RCTUIView *subview in [sortedSubviews reverseObjectEnumerator]) { // [macOS]
|
|
254
|
-
CGPoint pointForHitTest =
|
|
255
|
-
#if !TARGET_OS_OSX // [macOS]
|
|
256
|
-
pointForHitTest = [subview convertPoint:point fromView:self];
|
|
257
|
-
#else // [macOS
|
|
258
|
-
// Paper and Fabric components use the target view coordinate space for hit testing
|
|
259
|
-
if ([subview isKindOfClass:[RCTView class]] || [subview respondsToSelector:@selector(updateProps:oldProps:)]) {
|
|
260
|
-
pointForHitTest = [subview convertPoint:point fromView:self];
|
|
261
|
-
} else {
|
|
262
|
-
// Native macOS views require the point to be in the super view coordinate space for hit testing.
|
|
263
|
-
pointForHitTest = point;
|
|
264
|
-
}
|
|
265
|
-
#endif // macOS]
|
|
254
|
+
CGPoint pointForHitTest = [subview convertPoint:point fromView:self];
|
|
266
255
|
hitSubview = RCTUIViewHitTestWithEvent(subview, pointForHitTest, event); // macOS]
|
|
267
256
|
if (hitSubview != nil) {
|
|
268
257
|
break;
|
|
@@ -1653,4 +1642,4 @@ NSMutableDictionary<NSNumber *, NSNumber *> *GetEventDispatchStateDictionary(NSE
|
|
|
1653
1642
|
}
|
|
1654
1643
|
#endif // macOS]
|
|
1655
1644
|
|
|
1656
|
-
@end
|
|
1645
|
+
@end
|
|
@@ -562,10 +562,13 @@ static __weak RCTPlatformView *_pendingFocusView; // [macOS]
|
|
|
562
562
|
|
|
563
563
|
// [macOS
|
|
564
564
|
#pragma mark - Hit testing
|
|
565
|
-
#if TARGET_OS_OSX
|
|
565
|
+
#if TARGET_OS_OSX
|
|
566
|
+
// IMPORTANT -- point is in local coordinate space, unlike the hitTest: version from OSX which is in super's coordinate space
|
|
566
567
|
- (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
|
567
568
|
{
|
|
568
|
-
|
|
569
|
+
NSView *superview = [self superview];
|
|
570
|
+
NSPoint pointInSuper = superview != nil ? [self convertPoint:point toView:superview] : point;
|
|
571
|
+
return [self hitTest:pointInSuper];
|
|
569
572
|
}
|
|
570
573
|
#endif // macOS]
|
|
571
574
|
|
|
@@ -149,7 +149,6 @@ static UIFont *RCTDefaultFontWithFontProperties(RCTFontProperties fontProperties
|
|
|
149
149
|
#if TARGET_OS_OSX // [macOS
|
|
150
150
|
NSArray<NSString *> *RCTFontNamesForFamilyName(NSString *familyName) {
|
|
151
151
|
NSArray<NSArray *> *fontMembers = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:familyName];
|
|
152
|
-
NSLog(@"SAAD");
|
|
153
152
|
NSMutableArray<NSString *> *fontNames = [NSMutableArray array];
|
|
154
153
|
|
|
155
154
|
for (NSArray *fontMember in fontMembers) {
|
|
@@ -107,9 +107,9 @@ inline static NSUnderlineStyle RCTNSUnderlineStyleFromTextDecorationStyle(
|
|
|
107
107
|
case facebook::react::TextDecorationStyle::Double:
|
|
108
108
|
return NSUnderlineStyleDouble;
|
|
109
109
|
case facebook::react::TextDecorationStyle::Dashed:
|
|
110
|
-
return
|
|
110
|
+
return NSUnderlineStylePatternDash | NSUnderlineStyleSingle; // [macOS]
|
|
111
111
|
case facebook::react::TextDecorationStyle::Dotted:
|
|
112
|
-
return
|
|
112
|
+
return NSUnderlineStylePatternDot | NSUnderlineStyleSingle; // [macOS]
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-macos",
|
|
3
|
-
"version": "0.77.
|
|
3
|
+
"version": "0.77.2",
|
|
4
4
|
"description": "React Native for macOS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
113
|
-
"@react-native-mac/virtualized-lists": "0.77.
|
|
113
|
+
"@react-native-mac/virtualized-lists": "0.77.2",
|
|
114
114
|
"@react-native/assets-registry": "0.77.0",
|
|
115
115
|
"@react-native/codegen": "0.77.0",
|
|
116
116
|
"@react-native/community-cli-plugin": "0.77.0",
|
|
@@ -189,6 +189,6 @@ class NewArchitectureHelper
|
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
def self.new_arch_enabled
|
|
192
|
-
return ENV["RCT_NEW_ARCH_ENABLED"] ==
|
|
192
|
+
return ENV["RCT_NEW_ARCH_ENABLED"] == "1" # [macOS] Disable Fabric by default till macOS supports it
|
|
193
193
|
end
|
|
194
194
|
end
|
|
@@ -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
|