react-native-macos 0.81.3 → 0.81.5
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/LinkingIOS/RCTLinkingManager.mm +119 -0
- package/Libraries/LinkingIOS/React-RCTLinking.podspec +0 -4
- package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +2 -2
- package/React/Base/RCTBridge.mm +118 -69
- package/React/Base/RCTBridgeModule.h +17 -5
- package/React/Base/RCTDefines.h +11 -0
- package/React/Base/RCTRootView.m +7 -0
- package/React/Base/RCTUIKit.h +18 -7
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +9 -0
- package/React/Base/macOS/RCTUIKit.m +65 -8
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +6 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +77 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +4 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +69 -3
- package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +306 -8
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +6 -0
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +26 -18
- package/React/Modules/RCTUIManager.mm +1 -1
- package/React/Views/RCTCursor.m +0 -1
- package/React/Views/RCTView.m +1 -2
- package/React/Views/ScrollView/RCTScrollView.m +25 -0
- package/React/Views/UIView+React.m +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.h +10 -0
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm +72 -6
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/PlatformColorParser.mm +18 -0
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/RCTPlatformColorUtils.mm +144 -3
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.h +2 -2
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +3 -3
- package/local-cli/generate-macos.js +0 -3
- package/local-cli/generator-common/index.js +5 -5
- package/local-cli/generator-macos/index.js +7 -22
- package/package.json +2 -2
- package/Libraries/LinkingIOS/macos/RCTLinkingManager.mm +0 -123
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
#import "RCTLinkingPlugins.h"
|
|
16
16
|
|
|
17
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
18
|
+
|
|
17
19
|
static NSString *const kOpenURLNotification = @"RCTOpenURLNotification";
|
|
18
20
|
|
|
19
21
|
static void postNotificationWithURL(NSURL *URL, id sender)
|
|
@@ -22,6 +24,24 @@ static void postNotificationWithURL(NSURL *URL, id sender)
|
|
|
22
24
|
[[NSNotificationCenter defaultCenter] postNotificationName:kOpenURLNotification object:sender userInfo:payload];
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
#else // [macOS
|
|
28
|
+
|
|
29
|
+
NSString *const RCTOpenURLNotification = @"RCTOpenURLNotification";
|
|
30
|
+
|
|
31
|
+
static NSString *initialURL = nil;
|
|
32
|
+
static BOOL moduleInitalized = NO;
|
|
33
|
+
static BOOL alwaysForegroundLastWindow = YES;
|
|
34
|
+
|
|
35
|
+
static void postNotificationWithURL(NSString *url, id sender)
|
|
36
|
+
{
|
|
37
|
+
NSDictionary<NSString *, id> *payload = @{@"url": url};
|
|
38
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:RCTOpenURLNotification
|
|
39
|
+
object:sender
|
|
40
|
+
userInfo:payload];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#endif // macOS]
|
|
44
|
+
|
|
25
45
|
@interface RCTLinkingManager () <NativeLinkingManagerSpec>
|
|
26
46
|
@end
|
|
27
47
|
|
|
@@ -34,6 +54,8 @@ RCT_EXPORT_MODULE()
|
|
|
34
54
|
return dispatch_get_main_queue();
|
|
35
55
|
}
|
|
36
56
|
|
|
57
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
58
|
+
|
|
37
59
|
- (void)startObserving
|
|
38
60
|
{
|
|
39
61
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
@@ -47,11 +69,33 @@ RCT_EXPORT_MODULE()
|
|
|
47
69
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
48
70
|
}
|
|
49
71
|
|
|
72
|
+
#else // [macOS
|
|
73
|
+
|
|
74
|
+
- (void)startObserving
|
|
75
|
+
{
|
|
76
|
+
moduleInitalized = YES;
|
|
77
|
+
|
|
78
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
79
|
+
selector:@selector(handleOpenURLNotification:)
|
|
80
|
+
name:RCTOpenURLNotification
|
|
81
|
+
object:nil];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
- (void)stopObserving
|
|
85
|
+
{
|
|
86
|
+
moduleInitalized = NO;
|
|
87
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#endif // macOS]
|
|
91
|
+
|
|
50
92
|
- (NSArray<NSString *> *)supportedEvents
|
|
51
93
|
{
|
|
52
94
|
return @[ @"url" ];
|
|
53
95
|
}
|
|
54
96
|
|
|
97
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
98
|
+
|
|
55
99
|
+ (BOOL)application:(UIApplication *)app
|
|
56
100
|
openURL:(NSURL *)URL
|
|
57
101
|
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
|
|
@@ -87,6 +131,43 @@ RCT_EXPORT_MODULE()
|
|
|
87
131
|
[self sendEventWithName:@"url" body:notification.userInfo];
|
|
88
132
|
}
|
|
89
133
|
|
|
134
|
+
#else // [macOS
|
|
135
|
+
|
|
136
|
+
+ (void)setAlwaysForegroundLastWindow:(BOOL)alwaysForeground
|
|
137
|
+
{
|
|
138
|
+
alwaysForegroundLastWindow = alwaysForeground;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
+ (void)getUrlEventHandler:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
|
|
142
|
+
{
|
|
143
|
+
// extract url value from the event
|
|
144
|
+
NSString *url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
|
|
145
|
+
|
|
146
|
+
// If the application was launched via URL, this handler will be called before
|
|
147
|
+
// the module is initialized by the bridge. Store the initial URL, because we are not listening to the notification yet.
|
|
148
|
+
if (!moduleInitalized && initialURL == nil) {
|
|
149
|
+
initialURL = url;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
postNotificationWithURL(url, self);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
- (void)handleOpenURLNotification:(NSNotification *)notification
|
|
156
|
+
{
|
|
157
|
+
// Activate app, because [NSApp mainWindow] returns nil when the app is hidden and another app is maximized
|
|
158
|
+
[NSApp activateIgnoringOtherApps:YES];
|
|
159
|
+
// foreground top level window
|
|
160
|
+
if (alwaysForegroundLastWindow) {
|
|
161
|
+
NSWindow *lastWindow = [[NSApp windows] lastObject];
|
|
162
|
+
[lastWindow makeKeyAndOrderFront:nil];
|
|
163
|
+
}
|
|
164
|
+
[self sendEventWithName:@"url" body:notification.userInfo];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
#endif // macOS]
|
|
168
|
+
|
|
169
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
170
|
+
|
|
90
171
|
RCT_EXPORT_METHOD(openURL
|
|
91
172
|
: (NSURL *)URL resolve
|
|
92
173
|
: (RCTPromiseResolveBlock)resolve reject
|
|
@@ -184,6 +265,44 @@ RCT_EXPORT_METHOD(openSettings : (RCTPromiseResolveBlock)resolve reject : (__unu
|
|
|
184
265
|
}];
|
|
185
266
|
}
|
|
186
267
|
|
|
268
|
+
#else // [macOS
|
|
269
|
+
|
|
270
|
+
RCT_EXPORT_METHOD(openURL:(NSURL *)URL
|
|
271
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
272
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
273
|
+
{
|
|
274
|
+
BOOL result = [[NSWorkspace sharedWorkspace] openURL:URL];
|
|
275
|
+
if (result) {
|
|
276
|
+
resolve(@YES);
|
|
277
|
+
} else {
|
|
278
|
+
reject(RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
RCT_EXPORT_METHOD(canOpenURL:(NSURL *)URL
|
|
283
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
284
|
+
reject:(__unused RCTPromiseRejectBlock)reject)
|
|
285
|
+
{
|
|
286
|
+
resolve(@YES);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
RCT_EXPORT_METHOD(getInitialURL:(RCTPromiseResolveBlock)resolve
|
|
290
|
+
reject:(__unused RCTPromiseRejectBlock)reject)
|
|
291
|
+
{
|
|
292
|
+
resolve(RCTNullIfNil(initialURL));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
RCT_EXPORT_METHOD(openSettings:(RCTPromiseResolveBlock)resolve
|
|
296
|
+
reject:(__unused RCTPromiseRejectBlock)reject)
|
|
297
|
+
{
|
|
298
|
+
// macOS doesn't have a direct equivalent of UIApplicationOpenSettingsURLString
|
|
299
|
+
// Open System Preferences instead
|
|
300
|
+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"x-apple.systempreferences:"]];
|
|
301
|
+
resolve(nil);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
#endif // macOS]
|
|
305
|
+
|
|
187
306
|
RCT_EXPORT_METHOD(sendIntent
|
|
188
307
|
: (NSString *)action extras
|
|
189
308
|
: (NSArray *_Nullable)extras resolve
|
|
@@ -32,10 +32,6 @@ Pod::Spec.new do |s|
|
|
|
32
32
|
s.compiler_flags = '-Wno-nullability-completeness'
|
|
33
33
|
s.source = source
|
|
34
34
|
s.source_files = podspec_sources("*.{m,mm}", "")
|
|
35
|
-
# [macOS
|
|
36
|
-
s.osx.exclude_files = "RCTLinkingManager.mm"
|
|
37
|
-
s.osx.source_files = "macos/RCTLinkingManager.mm"
|
|
38
|
-
# macOS]
|
|
39
35
|
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
|
40
36
|
s.header_dir = "RCTLinking"
|
|
41
37
|
s.pod_target_xcconfig = {
|
|
@@ -82,7 +82,7 @@ const _normalizeColorObject = (
|
|
|
82
82
|
// a macOS semantic color
|
|
83
83
|
return color;
|
|
84
84
|
} else if ('dynamic' in color && color.dynamic !== undefined) {
|
|
85
|
-
const normalizeColor = require('./normalizeColor');
|
|
85
|
+
const normalizeColor = require('./normalizeColor').default;
|
|
86
86
|
|
|
87
87
|
// a dynamic, appearance aware color
|
|
88
88
|
const dynamic = color.dynamic;
|
|
@@ -103,7 +103,7 @@ const _normalizeColorObject = (
|
|
|
103
103
|
'colorWithSystemEffect' in color &&
|
|
104
104
|
color.colorWithSystemEffect != null
|
|
105
105
|
) {
|
|
106
|
-
const normalizeColor = require('./normalizeColor');
|
|
106
|
+
const normalizeColor = require('./normalizeColor').default;
|
|
107
107
|
const colorWithSystemEffect = color.colorWithSystemEffect;
|
|
108
108
|
const colorObject: LocalNativeColorValue = {
|
|
109
109
|
colorWithSystemEffect: {
|
package/React/Base/RCTBridge.mm
CHANGED
|
@@ -32,15 +32,130 @@
|
|
|
32
32
|
#import "RCTReloadCommand.h"
|
|
33
33
|
#import "RCTUtils.h"
|
|
34
34
|
|
|
35
|
+
// [macOS
|
|
36
|
+
/**
|
|
37
|
+
* List of core React Native modules.
|
|
38
|
+
*
|
|
39
|
+
* When RCT_MODULE_NO_SELF_LOAD is set to non-zero, module self-registration via +load is disabled.
|
|
40
|
+
* Instead, RCTBridge will register these modules at initialization time.
|
|
41
|
+
*/
|
|
42
|
+
static NSArray<NSString *> *moduleClassNames = @[
|
|
43
|
+
@"RCTViewManager",
|
|
44
|
+
@"RCTActivityIndicatorViewManager",
|
|
45
|
+
@"RCTDebuggingOverlayManager",
|
|
46
|
+
@"RCTModalHostViewManager",
|
|
47
|
+
@"RCTModalManager",
|
|
48
|
+
@"RCTRefreshControlManager",
|
|
49
|
+
@"RCTSafeAreaViewManager",
|
|
50
|
+
@"RCTScrollContentViewManager",
|
|
51
|
+
@"RCTScrollViewManager",
|
|
52
|
+
@"RCTSwitchManager",
|
|
53
|
+
@"RCTUIManager",
|
|
54
|
+
@"RCTAccessibilityManager",
|
|
55
|
+
@"RCTActionSheetManager",
|
|
56
|
+
@"RCTAlertManager",
|
|
57
|
+
@"RCTAppearance",
|
|
58
|
+
@"RCTAppState",
|
|
59
|
+
@"RCTClipboard",
|
|
60
|
+
@"RCTDeviceInfo",
|
|
61
|
+
@"RCTDevLoadingView",
|
|
62
|
+
@"RCTDevMenu",
|
|
63
|
+
@"RCTDevSettings",
|
|
64
|
+
@"RCTDevToolsRuntimeSettingsModule",
|
|
65
|
+
@"RCTEventDispatcher",
|
|
66
|
+
@"RCTExceptionsManager",
|
|
67
|
+
@"RCTI18nManager",
|
|
68
|
+
@"RCTKeyboardObserver",
|
|
69
|
+
@"RCTLogBox",
|
|
70
|
+
@"RCTPerfMonitor",
|
|
71
|
+
@"RCTPlatform",
|
|
72
|
+
@"RCTRedBox",
|
|
73
|
+
@"RCTSourceCode",
|
|
74
|
+
@"RCTStatusBarManager",
|
|
75
|
+
@"RCTTiming",
|
|
76
|
+
@"RCTWebSocketModule",
|
|
77
|
+
@"RCTNativeAnimatedModule",
|
|
78
|
+
@"RCTNativeAnimatedTurboModule",
|
|
79
|
+
@"RCTBlobManager",
|
|
80
|
+
@"RCTFileReaderModule",
|
|
81
|
+
@"RCTBundleAssetImageLoader",
|
|
82
|
+
@"RCTGIFImageDecoder",
|
|
83
|
+
@"RCTImageEditingManager",
|
|
84
|
+
@"RCTImageLoader",
|
|
85
|
+
@"RCTImageStoreManager",
|
|
86
|
+
@"RCTImageViewManager",
|
|
87
|
+
@"RCTLocalAssetImageLoader",
|
|
88
|
+
@"RCTLinkingManager",
|
|
89
|
+
@"RCTDataRequestHandler",
|
|
90
|
+
@"RCTFileRequestHandler",
|
|
91
|
+
@"RCTHTTPRequestHandler",
|
|
92
|
+
@"RCTNetworking",
|
|
93
|
+
@"RCTPushNotificationManager",
|
|
94
|
+
@"RCTSettingsManager",
|
|
95
|
+
@"RCTBaseTextViewManager",
|
|
96
|
+
@"RCTBaseTextInputViewManager",
|
|
97
|
+
@"RCTInputAccessoryViewManager",
|
|
98
|
+
@"RCTMultilineTextInputViewManager",
|
|
99
|
+
@"RCTRawTextViewManager",
|
|
100
|
+
@"RCTSinglelineTextInputViewManager",
|
|
101
|
+
@"RCTTextViewManager",
|
|
102
|
+
@"RCTVirtualTextViewManager",
|
|
103
|
+
@"RCTVibration",
|
|
104
|
+
];
|
|
105
|
+
// macOS]
|
|
106
|
+
|
|
35
107
|
static NSMutableArray<Class> *RCTModuleClasses;
|
|
36
108
|
static dispatch_queue_t RCTModuleClassesSyncQueue;
|
|
109
|
+
|
|
110
|
+
// [macOS
|
|
111
|
+
/**
|
|
112
|
+
* Make sure ModuleClassesSyncQueue is initialized before any referring functions are called.
|
|
113
|
+
*/
|
|
114
|
+
static void RCTEnsureModuleClassesInitialized(void)
|
|
115
|
+
{
|
|
116
|
+
static dispatch_once_t onceToken;
|
|
117
|
+
dispatch_once(&onceToken, ^{
|
|
118
|
+
RCTModuleClasses = [NSMutableArray new];
|
|
119
|
+
RCTModuleClassesSyncQueue =
|
|
120
|
+
dispatch_queue_create("com.facebook.react.ModuleClassesSyncQueue", DISPATCH_QUEUE_CONCURRENT);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// macOS]
|
|
124
|
+
|
|
37
125
|
NSArray<Class> *RCTGetModuleClasses(void)
|
|
38
126
|
{
|
|
127
|
+
// [macOS
|
|
128
|
+
RCTEnsureModuleClassesInitialized();
|
|
129
|
+
|
|
130
|
+
#if RCT_MODULE_NO_SELF_LOAD
|
|
131
|
+
// When RCT_MODULE_NO_SELF_LOAD is enabled, modules don't self-register via +load
|
|
132
|
+
// Add core React Native modules here instead
|
|
133
|
+
__block NSMutableArray<Class> *result;
|
|
134
|
+
dispatch_sync(RCTModuleClassesSyncQueue, ^{
|
|
135
|
+
result = [RCTModuleClasses mutableCopy];
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
for (NSString *className in moduleClassNames) {
|
|
139
|
+
Class cls = NSClassFromString(className);
|
|
140
|
+
if (cls != nil) {
|
|
141
|
+
[result addObject:cls];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
NSArray<Class> *finalResult = [result copy];
|
|
146
|
+
|
|
147
|
+
return finalResult;
|
|
148
|
+
#else
|
|
149
|
+
// macOS]
|
|
39
150
|
__block NSArray<Class> *result;
|
|
40
151
|
dispatch_sync(RCTModuleClassesSyncQueue, ^{
|
|
41
152
|
result = [RCTModuleClasses copy];
|
|
42
153
|
});
|
|
154
|
+
|
|
43
155
|
return result;
|
|
156
|
+
// [macOS
|
|
157
|
+
#endif //RCT_MODULE_NO_SELF_LOAD
|
|
158
|
+
// macOS]
|
|
44
159
|
}
|
|
45
160
|
|
|
46
161
|
NSSet<NSString *> *getCoreModuleClasses(void);
|
|
@@ -49,69 +164,7 @@ NSSet<NSString *> *getCoreModuleClasses(void)
|
|
|
49
164
|
static NSSet<NSString *> *coreModuleClasses = nil;
|
|
50
165
|
static dispatch_once_t onceToken;
|
|
51
166
|
dispatch_once(&onceToken, ^{
|
|
52
|
-
coreModuleClasses = [NSSet setWithArray
|
|
53
|
-
@"RCTViewManager",
|
|
54
|
-
@"RCTActivityIndicatorViewManager",
|
|
55
|
-
@"RCTDebuggingOverlayManager",
|
|
56
|
-
@"RCTModalHostViewManager",
|
|
57
|
-
@"RCTModalManager",
|
|
58
|
-
@"RCTRefreshControlManager",
|
|
59
|
-
@"RCTSafeAreaViewManager",
|
|
60
|
-
@"RCTScrollContentViewManager",
|
|
61
|
-
@"RCTScrollViewManager",
|
|
62
|
-
@"RCTSwitchManager",
|
|
63
|
-
@"RCTUIManager",
|
|
64
|
-
@"RCTAccessibilityManager",
|
|
65
|
-
@"RCTActionSheetManager",
|
|
66
|
-
@"RCTAlertManager",
|
|
67
|
-
@"RCTAppearance",
|
|
68
|
-
@"RCTAppState",
|
|
69
|
-
@"RCTClipboard",
|
|
70
|
-
@"RCTDeviceInfo",
|
|
71
|
-
@"RCTDevLoadingView",
|
|
72
|
-
@"RCTDevMenu",
|
|
73
|
-
@"RCTDevSettings",
|
|
74
|
-
@"RCTDevToolsRuntimeSettingsModule",
|
|
75
|
-
@"RCTEventDispatcher",
|
|
76
|
-
@"RCTExceptionsManager",
|
|
77
|
-
@"RCTI18nManager",
|
|
78
|
-
@"RCTKeyboardObserver",
|
|
79
|
-
@"RCTLogBox",
|
|
80
|
-
@"RCTPerfMonitor",
|
|
81
|
-
@"RCTPlatform",
|
|
82
|
-
@"RCTRedBox",
|
|
83
|
-
@"RCTSourceCode",
|
|
84
|
-
@"RCTStatusBarManager",
|
|
85
|
-
@"RCTTiming",
|
|
86
|
-
@"RCTWebSocketModule",
|
|
87
|
-
@"RCTNativeAnimatedModule",
|
|
88
|
-
@"RCTNativeAnimatedTurboModule",
|
|
89
|
-
@"RCTBlobManager",
|
|
90
|
-
@"RCTFileReaderModule",
|
|
91
|
-
@"RCTBundleAssetImageLoader",
|
|
92
|
-
@"RCTGIFImageDecoder",
|
|
93
|
-
@"RCTImageEditingManager",
|
|
94
|
-
@"RCTImageLoader",
|
|
95
|
-
@"RCTImageStoreManager",
|
|
96
|
-
@"RCTImageViewManager",
|
|
97
|
-
@"RCTLocalAssetImageLoader",
|
|
98
|
-
@"RCTLinkingManager",
|
|
99
|
-
@"RCTDataRequestHandler",
|
|
100
|
-
@"RCTFileRequestHandler",
|
|
101
|
-
@"RCTHTTPRequestHandler",
|
|
102
|
-
@"RCTNetworking",
|
|
103
|
-
@"RCTPushNotificationManager",
|
|
104
|
-
@"RCTSettingsManager",
|
|
105
|
-
@"RCTBaseTextViewManager",
|
|
106
|
-
@"RCTBaseTextInputViewManager",
|
|
107
|
-
@"RCTInputAccessoryViewManager",
|
|
108
|
-
@"RCTMultilineTextInputViewManager",
|
|
109
|
-
@"RCTRawTextViewManager",
|
|
110
|
-
@"RCTSinglelineTextInputViewManager",
|
|
111
|
-
@"RCTTextViewManager",
|
|
112
|
-
@"RCTVirtualTextViewManager",
|
|
113
|
-
@"RCTVibration",
|
|
114
|
-
]];
|
|
167
|
+
coreModuleClasses = [NSSet setWithArray:moduleClassNames]; // [macOS]
|
|
115
168
|
});
|
|
116
169
|
|
|
117
170
|
return coreModuleClasses;
|
|
@@ -146,12 +199,8 @@ void RCTRegisterModule(Class moduleClass)
|
|
|
146
199
|
![getCoreModuleClasses() containsObject:[moduleClass description]]) {
|
|
147
200
|
addModuleLoadedWithOldArch([moduleClass description]);
|
|
148
201
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
RCTModuleClasses = [NSMutableArray new];
|
|
152
|
-
RCTModuleClassesSyncQueue =
|
|
153
|
-
dispatch_queue_create("com.facebook.react.ModuleClassesSyncQueue", DISPATCH_QUEUE_CONCURRENT);
|
|
154
|
-
});
|
|
202
|
+
|
|
203
|
+
RCTEnsureModuleClassesInitialized(); // [macOS]
|
|
155
204
|
|
|
156
205
|
RCTAssert(
|
|
157
206
|
[moduleClass conformsToProtocol:@protocol(RCTBridgeModule)],
|
|
@@ -63,6 +63,18 @@ RCT_EXTERN_C_END
|
|
|
63
63
|
*/
|
|
64
64
|
@protocol RCTBridgeModule <NSObject>
|
|
65
65
|
|
|
66
|
+
// [macOS
|
|
67
|
+
#if RCT_MODULE_NO_SELF_LOAD
|
|
68
|
+
#define RCT_EXPORT_MODULE_LOAD
|
|
69
|
+
#else
|
|
70
|
+
#define RCT_EXPORT_MODULE_LOAD \
|
|
71
|
+
+(void)load \
|
|
72
|
+
{ \
|
|
73
|
+
RCTRegisterModule(self); \
|
|
74
|
+
}
|
|
75
|
+
#endif
|
|
76
|
+
// macOS]
|
|
77
|
+
|
|
66
78
|
/**
|
|
67
79
|
* Place this macro in your class implementation to automatically register
|
|
68
80
|
* your module with the bridge when it loads. The optional js_name argument
|
|
@@ -75,10 +87,7 @@ RCT_EXTERN_C_END
|
|
|
75
87
|
{ \
|
|
76
88
|
return @ #js_name; \
|
|
77
89
|
} \
|
|
78
|
-
|
|
79
|
-
{ \
|
|
80
|
-
RCTRegisterModule(self); \
|
|
81
|
-
}
|
|
90
|
+
RCT_EXPORT_MODULE_LOAD // [macOS]
|
|
82
91
|
|
|
83
92
|
/**
|
|
84
93
|
* Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module
|
|
@@ -91,10 +100,13 @@ RCT_EXTERN_C_END
|
|
|
91
100
|
{ \
|
|
92
101
|
return @ #js_name; \
|
|
93
102
|
} \
|
|
103
|
+
_Pragma("clang diagnostic push") \
|
|
104
|
+
_Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \
|
|
94
105
|
__attribute__((constructor)) static void RCT_CONCAT(initialize_, objc_name)(void) \
|
|
95
106
|
{ \
|
|
96
107
|
RCTRegisterModule([objc_name class]); \
|
|
97
|
-
}
|
|
108
|
+
} \
|
|
109
|
+
_Pragma("clang diagnostic pop")
|
|
98
110
|
|
|
99
111
|
// Implemented by RCT_EXPORT_MODULE
|
|
100
112
|
+ (NSString *)moduleName;
|
package/React/Base/RCTDefines.h
CHANGED
|
@@ -22,6 +22,17 @@
|
|
|
22
22
|
#define RCT_EXTERN_C_END
|
|
23
23
|
#endif
|
|
24
24
|
|
|
25
|
+
// [macOS
|
|
26
|
+
/**
|
|
27
|
+
* The RCT_MODULE_NO_SELF_LOAD macro can be used to disable module self-registration
|
|
28
|
+
* via +load methods. When enabled, modules are registered by RCTBridge instead.
|
|
29
|
+
* This can improve performance during module lazy-loading.
|
|
30
|
+
*/
|
|
31
|
+
#ifndef RCT_MODULE_NO_SELF_LOAD
|
|
32
|
+
#define RCT_MODULE_NO_SELF_LOAD 0
|
|
33
|
+
#endif
|
|
34
|
+
// macOS]
|
|
35
|
+
|
|
25
36
|
/**
|
|
26
37
|
* The RCT_DEBUG macro can be used to exclude error checking and logging code
|
|
27
38
|
* from release builds to improve performance and reduce binary size.
|
package/React/Base/RCTRootView.m
CHANGED
|
@@ -206,6 +206,13 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
|
|
206
206
|
#endif // macOS]
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
#if TARGET_OS_OSX // [macOS
|
|
210
|
+
- (void)viewDidEndLiveResize {
|
|
211
|
+
[super viewDidEndLiveResize];
|
|
212
|
+
[self setNeedsLayout];
|
|
213
|
+
}
|
|
214
|
+
#endif // macOS]
|
|
215
|
+
|
|
209
216
|
- (void)setLoadingView:(RCTUIView *)loadingView // [macOS]
|
|
210
217
|
{
|
|
211
218
|
_loadingView = loadingView;
|
package/React/Base/RCTUIKit.h
CHANGED
|
@@ -64,9 +64,9 @@ UIKIT_STATIC_INLINE void UIBezierPathAppendPath(UIBezierPath *path, UIBezierPath
|
|
|
64
64
|
#define RCTUIImage UIImage
|
|
65
65
|
#define RCTUIPanGestureRecognizer UIPanGestureRecognizer
|
|
66
66
|
|
|
67
|
-
UIKIT_STATIC_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *__nullable event)
|
|
67
|
+
UIKIT_STATIC_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, RCTPlatformView *fromView, __unused UIEvent *__nullable event)
|
|
68
68
|
{
|
|
69
|
-
return [view hitTest:point withEvent:event];
|
|
69
|
+
return [view hitTest:[view convertPoint:point fromView:fromView] withEvent:event];
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
UIKIT_STATIC_INLINE void RCTUIViewSetContentModeRedraw(UIView *view)
|
|
@@ -98,6 +98,7 @@ UIKIT_STATIC_INLINE CGRect CGRectValue(NSValue *value)
|
|
|
98
98
|
// semantically equivalent types
|
|
99
99
|
//
|
|
100
100
|
|
|
101
|
+
#define RCTPlatformColor UIColor
|
|
101
102
|
#define RCTUIColor UIColor
|
|
102
103
|
|
|
103
104
|
// [macOS RCTUIAccessibilityTraits - typedef to UIAccessibilityTraits on iOS
|
|
@@ -376,8 +377,15 @@ NS_INLINE NSAccessibilityRole RCTAccessibilityRoleFromTraits(RCTUIAccessibilityT
|
|
|
376
377
|
// macOS]
|
|
377
378
|
|
|
378
379
|
// UIColor.h/NSColor.h
|
|
380
|
+
#define RCTPlatformColor NSColor
|
|
379
381
|
#define RCTUIColor NSColor
|
|
380
382
|
|
|
383
|
+
@interface NSColor (RCTAppearanceResolving)
|
|
384
|
+
/// Resolve a dynamic/semantic NSColor for a specific appearance, analogous to
|
|
385
|
+
/// UIColor's -resolvedColorWithTraitCollection: on iOS.
|
|
386
|
+
- (NSColor *)resolvedColorWithAppearance:(NSAppearance *)appearance;
|
|
387
|
+
@end
|
|
388
|
+
|
|
381
389
|
// UIFont.h/NSFont.h
|
|
382
390
|
// Both NSFont and UIFont are toll-free bridged to CTFontRef so we'll assume they're semantically equivalent
|
|
383
391
|
@compatibility_alias UIFont NSFont;
|
|
@@ -514,6 +522,7 @@ void UIBezierPathAppendPath(UIBezierPath *path, UIBezierPath *appendPath);
|
|
|
514
522
|
|
|
515
523
|
@property (nonatomic, copy) NSColor *backgroundColor;
|
|
516
524
|
@property (nonatomic) CGAffineTransform transform;
|
|
525
|
+
@property (nonatomic) CATransform3D transform3D;
|
|
517
526
|
|
|
518
527
|
/**
|
|
519
528
|
* Specifies whether the view should receive the mouse down event when the
|
|
@@ -533,12 +542,10 @@ void UIBezierPathAppendPath(UIBezierPath *path, UIBezierPath *appendPath);
|
|
|
533
542
|
*/
|
|
534
543
|
@property (nonatomic, assign) BOOL enableFocusRing;
|
|
535
544
|
|
|
536
|
-
// [macOS
|
|
537
545
|
/**
|
|
538
546
|
* iOS compatibility shim. On macOS, this forwards to accessibilityChildren.
|
|
539
547
|
*/
|
|
540
548
|
@property (nonatomic, copy) NSArray *accessibilityElements;
|
|
541
|
-
// macOS]
|
|
542
549
|
|
|
543
550
|
@end
|
|
544
551
|
|
|
@@ -585,11 +592,15 @@ void UIBezierPathAppendPath(UIBezierPath *path, UIBezierPath *appendPath);
|
|
|
585
592
|
@end
|
|
586
593
|
|
|
587
594
|
|
|
588
|
-
|
|
595
|
+
// Use CALayer coordinate conversion which correctly accounts for layer.transform.
|
|
596
|
+
// NSView's convertPoint:fromView: does not account for layer transforms on macOS.
|
|
597
|
+
// IMPORTANT -- NSView's hitTest: expects a point in the superview's coordinate space,
|
|
598
|
+
// so we convert from fromView → superview using CALayer, which handles layer transforms correctly.
|
|
599
|
+
// This allows hit testing to work correctly between nested RCTUIViews and plain NSViews.
|
|
600
|
+
NS_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, RCTPlatformView *fromView, __unused UIEvent *__nullable event)
|
|
589
601
|
{
|
|
590
|
-
// [macOS IMPORTANT -- point is in local coordinate space, but OSX expects super coordinate space for hitTest:
|
|
591
602
|
NSView *superview = [view superview];
|
|
592
|
-
NSPoint pointInSuperview = superview != nil ? [
|
|
603
|
+
NSPoint pointInSuperview = superview != nil ? [superview.layer convertPoint:point fromLayer:fromView.layer] : point;
|
|
593
604
|
return [view hitTest:pointInSuperview];
|
|
594
605
|
}
|
|
595
606
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -144,6 +144,15 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
|
|
|
144
144
|
_autoHideDisabled = disabled;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
#pragma mark - NSView
|
|
148
|
+
|
|
149
|
+
#if TARGET_OS_OSX // [macOS
|
|
150
|
+
- (void)viewDidEndLiveResize {
|
|
151
|
+
[super viewDidEndLiveResize];
|
|
152
|
+
[self setNeedsLayout];
|
|
153
|
+
}
|
|
154
|
+
#endif // macOS]
|
|
155
|
+
|
|
147
156
|
#pragma mark - isActivityIndicatorViewVisible
|
|
148
157
|
|
|
149
158
|
- (void)setIsActivityIndicatorViewVisible:(BOOL)visible
|