react-native-macos 0.78.4 → 0.78.6
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/AppDelegate/RCTReactNativeFactory.mm +4 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTDevLoadingView.mm +1 -1
- package/React/CoreModules/RCTLogBoxView.mm +4 -1
- package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +82 -14
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +18 -4
- package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +1 -1
- package/React/Fabric/Surface/RCTFabricSurface.mm +1 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt +2 -2
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/runtime/TimerManager.cpp +6 -4
- package/ReactCommon/react/runtime/TimerManager.h +3 -1
- package/ReactCommon/react/runtime/tests/cxx/ReactInstanceTest.cpp +9 -5
- package/package.json +9 -9
- package/scripts/codegen/generate-artifacts-executor.js +47 -16
package/React/Base/RCTVersion.m
CHANGED
|
@@ -130,7 +130,7 @@ RCT_EXPORT_MODULE()
|
|
|
130
130
|
self->_window.rootViewController = [UIViewController new];
|
|
131
131
|
#else // [macOS
|
|
132
132
|
self->_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 375, 20)
|
|
133
|
-
styleMask:NSWindowStyleMaskBorderless
|
|
133
|
+
styleMask:NSWindowStyleMaskBorderless | NSWindowStyleMaskFullSizeContentView
|
|
134
134
|
backing:NSBackingStoreBuffered
|
|
135
135
|
defer:YES];
|
|
136
136
|
[self->_window setIdentifier:sRCTDevLoadingViewWindowIdentifier];
|
|
@@ -79,7 +79,10 @@
|
|
|
79
79
|
#if !TARGET_OS_OSX // [macOS]
|
|
80
80
|
self = [super initWithWindowScene:window.windowScene];
|
|
81
81
|
#else // [macOS
|
|
82
|
-
self = [super initWithContentRect:NSMakeRect(0, 0, 600, 800)
|
|
82
|
+
self = [super initWithContentRect:NSMakeRect(0, 0, 600, 800)
|
|
83
|
+
styleMask:NSWindowStyleMaskBorderless | NSWindowStyleMaskFullSizeContentView
|
|
84
|
+
backing:NSBackingStoreBuffered
|
|
85
|
+
defer:YES];
|
|
83
86
|
_window = window;
|
|
84
87
|
#endif // macOS]
|
|
85
88
|
|
|
@@ -16,19 +16,17 @@
|
|
|
16
16
|
@end
|
|
17
17
|
|
|
18
18
|
@interface RCTPausedInDebuggerOverlayController ()
|
|
19
|
-
#if !TARGET_OS_OSX // [macOS]
|
|
20
19
|
|
|
21
|
-
@property (nonatomic, strong)
|
|
20
|
+
@property (nonatomic, strong) RCTPlatformWindow *alertWindow; // [macOS]
|
|
22
21
|
|
|
23
|
-
#endif // [macOS];
|
|
24
22
|
@end
|
|
25
23
|
|
|
26
24
|
@implementation RCTPausedInDebuggerViewController
|
|
27
|
-
#if !TARGET_OS_OSX // [macOS]
|
|
28
25
|
- (void)viewDidLoad
|
|
29
26
|
{
|
|
30
27
|
[super viewDidLoad];
|
|
31
28
|
|
|
29
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
32
30
|
UIView *dimmingView = [[UIView alloc] init];
|
|
33
31
|
dimmingView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
34
32
|
dimmingView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
|
|
@@ -39,15 +37,18 @@
|
|
|
39
37
|
[dimmingView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
|
|
40
38
|
[dimmingView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor]
|
|
41
39
|
]];
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
#endif // [macOS]
|
|
41
|
+
|
|
42
|
+
RCTUILabel *messageLabel = [[RCTUILabel alloc] init]; // [macOS]
|
|
44
43
|
messageLabel.text = self.message;
|
|
45
44
|
messageLabel.textAlignment = NSTextAlignmentCenter;
|
|
45
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
46
46
|
messageLabel.numberOfLines = 0;
|
|
47
|
+
#endif // [macOS]
|
|
47
48
|
messageLabel.font = [UIFont boldSystemFontOfSize:16];
|
|
48
|
-
messageLabel.textColor = [
|
|
49
|
+
messageLabel.textColor = [RCTUIColor blackColor]; // [macOS]
|
|
49
50
|
messageLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
|
50
|
-
|
|
51
|
+
RCTUIView *messageContainer = [[RCTUIView alloc] init]; // [macOS]
|
|
51
52
|
[messageContainer addSubview:messageLabel];
|
|
52
53
|
[NSLayoutConstraint activateConstraints:@[
|
|
53
54
|
[messageLabel.topAnchor constraintEqualToAnchor:messageContainer.topAnchor constant:-1],
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
[messageLabel.trailingAnchor constraintEqualToAnchor:messageContainer.trailingAnchor],
|
|
57
58
|
]];
|
|
58
59
|
|
|
60
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
59
61
|
UIButton *resumeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
60
62
|
UIImage *image = [UIImage systemImageNamed:@"forward.frame.fill"];
|
|
61
63
|
[resumeButton setImage:image forState:UIControlStateNormal];
|
|
@@ -63,11 +65,21 @@
|
|
|
63
65
|
resumeButton.tintColor = [UIColor colorWithRed:0.37 green:0.37 blue:0.37 alpha:1];
|
|
64
66
|
|
|
65
67
|
resumeButton.enabled = NO;
|
|
68
|
+
#else // [macOS
|
|
69
|
+
NSButton *resumeButton = [[NSButton alloc] init];
|
|
70
|
+
[resumeButton setImage:[NSImage imageWithSystemSymbolName:@"forward.frame.fill" accessibilityDescription:@"Resume"]];
|
|
71
|
+
resumeButton.bordered = NO;
|
|
72
|
+
resumeButton.target = self;
|
|
73
|
+
resumeButton.action = @selector(handleResume:);
|
|
74
|
+
resumeButton.contentTintColor = [NSColor colorWithRed:0.37 green:0.37 blue:0.37 alpha:1];
|
|
75
|
+
#endif // macOS]
|
|
76
|
+
|
|
66
77
|
[NSLayoutConstraint activateConstraints:@[
|
|
67
78
|
[resumeButton.widthAnchor constraintEqualToConstant:48],
|
|
68
79
|
[resumeButton.heightAnchor constraintEqualToConstant:46],
|
|
69
80
|
]];
|
|
70
81
|
|
|
82
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
71
83
|
UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[ messageContainer, resumeButton ]];
|
|
72
84
|
stackView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:0.757 alpha:1];
|
|
73
85
|
stackView.layer.cornerRadius = 12;
|
|
@@ -82,41 +94,75 @@
|
|
|
82
94
|
action:@selector(handleResume:)];
|
|
83
95
|
[stackView addGestureRecognizer:gestureRecognizer];
|
|
84
96
|
stackView.userInteractionEnabled = YES;
|
|
97
|
+
#else // [macOS
|
|
98
|
+
NSStackView *stackView = [NSStackView stackViewWithViews:@[ messageContainer, resumeButton ]];
|
|
99
|
+
stackView.wantsLayer = YES;
|
|
100
|
+
stackView.layer.backgroundColor = [NSColor colorWithRed:1 green:1 blue:0.757 alpha:1].CGColor;
|
|
101
|
+
stackView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
102
|
+
stackView.orientation = NSUserInterfaceLayoutOrientationHorizontal;
|
|
103
|
+
stackView.distribution = NSStackViewDistributionFill;
|
|
104
|
+
stackView.alignment = NSLayoutAttributeCenterY;
|
|
105
|
+
|
|
106
|
+
NSClickGestureRecognizer *gestureRecognizer = [[NSClickGestureRecognizer alloc] initWithTarget:self
|
|
107
|
+
action:@selector(handleResume:)];
|
|
108
|
+
[stackView addGestureRecognizer:gestureRecognizer];
|
|
109
|
+
#endif // macOS]
|
|
85
110
|
|
|
111
|
+
#if !TARGET_OS_OSX
|
|
86
112
|
[self.view addSubview:stackView];
|
|
87
113
|
|
|
88
114
|
[NSLayoutConstraint activateConstraints:@[
|
|
89
115
|
[stackView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor constant:12],
|
|
90
116
|
[stackView.centerXAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.centerXAnchor],
|
|
91
117
|
]];
|
|
118
|
+
#else
|
|
119
|
+
[self setView:stackView];
|
|
120
|
+
#endif
|
|
92
121
|
|
|
122
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
93
123
|
stackView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;
|
|
124
|
+
#else // [macOS
|
|
125
|
+
stackView.userInterfaceLayoutDirection = NSUserInterfaceLayoutDirectionLeftToRight;
|
|
126
|
+
#endif // macOS]
|
|
94
127
|
}
|
|
95
128
|
|
|
129
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
96
130
|
- (void)handleResume:(UITapGestureRecognizer *)recognizer
|
|
97
131
|
{
|
|
98
132
|
self.onResume();
|
|
99
133
|
}
|
|
100
|
-
#
|
|
134
|
+
#else // [macOS
|
|
135
|
+
- (void)handleResume:(id)sender
|
|
136
|
+
{
|
|
137
|
+
self.onResume();
|
|
138
|
+
}
|
|
139
|
+
#endif // macOS]
|
|
101
140
|
@end
|
|
102
141
|
|
|
103
142
|
@implementation RCTPausedInDebuggerOverlayController
|
|
104
143
|
|
|
105
|
-
|
|
106
|
-
- (UIWindow *)alertWindow
|
|
144
|
+
- (RCTPlatformWindow *)alertWindow // [macOS]
|
|
107
145
|
{
|
|
108
146
|
if (_alertWindow == nil) {
|
|
147
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
109
148
|
_alertWindow = [[UIWindow alloc] initWithWindowScene:RCTKeyWindow().windowScene];
|
|
110
149
|
|
|
111
150
|
if (_alertWindow) {
|
|
112
151
|
_alertWindow.rootViewController = [UIViewController new];
|
|
113
152
|
_alertWindow.windowLevel = UIWindowLevelAlert + 1;
|
|
114
153
|
}
|
|
154
|
+
#else // [macOS]
|
|
155
|
+
_alertWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
|
|
156
|
+
styleMask:NSWindowStyleMaskBorderless | NSWindowStyleMaskFullSizeContentView
|
|
157
|
+
backing:NSBackingStoreBuffered
|
|
158
|
+
defer:YES];
|
|
159
|
+
_alertWindow.backgroundColor = [NSColor clearColor];
|
|
160
|
+
_alertWindow.opaque = NO;
|
|
161
|
+
#endif // macOS]
|
|
115
162
|
}
|
|
116
163
|
|
|
117
164
|
return _alertWindow;
|
|
118
165
|
}
|
|
119
|
-
#endif // [macOS]
|
|
120
166
|
|
|
121
167
|
- (void)showWithMessage:(NSString *)message onResume:(void (^)(void))onResume
|
|
122
168
|
{
|
|
@@ -127,9 +173,21 @@
|
|
|
127
173
|
view.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
128
174
|
view.message = message;
|
|
129
175
|
view.onResume = onResume;
|
|
176
|
+
|
|
130
177
|
[self.alertWindow makeKeyAndVisible];
|
|
131
178
|
[self.alertWindow.rootViewController presentViewController:view animated:NO completion:nil];
|
|
132
|
-
#
|
|
179
|
+
#else // [macOS]
|
|
180
|
+
view.message = message;
|
|
181
|
+
view.onResume = onResume;
|
|
182
|
+
|
|
183
|
+
self.alertWindow.contentViewController = view;
|
|
184
|
+
NSWindow *parentWindow = RCTKeyWindow();
|
|
185
|
+
if (![[parentWindow sheets] doesContain:self->_alertWindow]) {
|
|
186
|
+
[parentWindow beginSheet:self.alertWindow completionHandler:^(NSModalResponse returnCode) {
|
|
187
|
+
[self->_alertWindow orderOut:self];
|
|
188
|
+
}];
|
|
189
|
+
}
|
|
190
|
+
#endif // macOS]
|
|
133
191
|
}
|
|
134
192
|
|
|
135
193
|
- (void)hide
|
|
@@ -138,9 +196,19 @@
|
|
|
138
196
|
[_alertWindow setHidden:YES];
|
|
139
197
|
|
|
140
198
|
_alertWindow.windowScene = nil;
|
|
199
|
+
#else // [macOS]
|
|
200
|
+
NSWindow *parentWindow = RCTKeyWindow();
|
|
201
|
+
if (parentWindow) {
|
|
202
|
+
for (NSWindow *sheet in [parentWindow sheets]) {
|
|
203
|
+
if (sheet == _alertWindow) {
|
|
204
|
+
[parentWindow endSheet:sheet];
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
#endif // macOS]
|
|
141
210
|
|
|
142
211
|
_alertWindow = nil;
|
|
143
|
-
#endif // macOS]
|
|
144
212
|
}
|
|
145
213
|
|
|
146
214
|
@end
|
|
@@ -174,10 +174,24 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
|
|
|
174
174
|
|
|
175
175
|
- (void)mountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // [macOS]
|
|
176
176
|
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
if (_adapter && index == _adapter.paperView.reactSubviews.count) {
|
|
178
|
+
// This is a new child view that is being added to the end of the children array.
|
|
179
|
+
// After the children is added, we need to call didUpdateReactSubviews to make sure that it is rendered.
|
|
180
|
+
// Without this change, the new child will not be rendered right away because the didUpdateReactSubviews is not
|
|
181
|
+
// called and the `finalizeUpdate` is not invoked.
|
|
182
|
+
if ([childComponentView isKindOfClass:[RCTLegacyViewManagerInteropComponentView class]]) {
|
|
183
|
+
RCTPlatformView *target = ((RCTLegacyViewManagerInteropComponentView *)childComponentView).contentView; // [macOS]
|
|
184
|
+
[_adapter.paperView insertReactSubview:target atIndex:index];
|
|
185
|
+
} else {
|
|
186
|
+
[_adapter.paperView insertReactSubview:childComponentView atIndex:index];
|
|
187
|
+
}
|
|
188
|
+
[_adapter.paperView didUpdateReactSubviews];
|
|
189
|
+
} else {
|
|
190
|
+
[_viewsToBeMounted addObject:@{
|
|
191
|
+
kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
|
|
192
|
+
kRCTLegacyInteropChildComponentKey : childComponentView
|
|
193
|
+
}];
|
|
194
|
+
}
|
|
181
195
|
}
|
|
182
196
|
|
|
183
197
|
- (void)unmountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // [macOS]
|
|
@@ -65,7 +65,7 @@ using namespace facebook::react;
|
|
|
65
65
|
const auto &newSwitchProps = static_cast<const SwitchProps &>(*props);
|
|
66
66
|
|
|
67
67
|
// `value`
|
|
68
|
-
if (oldSwitchProps.value != newSwitchProps.value) {
|
|
68
|
+
if (!_isInitialValueSet || oldSwitchProps.value != newSwitchProps.value) {
|
|
69
69
|
BOOL shouldAnimate = _isInitialValueSet == YES;
|
|
70
70
|
[_switchView setOn:newSwitchProps.value animated:shouldAnimate];
|
|
71
71
|
}
|
|
@@ -145,6 +145,7 @@ using namespace facebook::react;
|
|
|
145
145
|
|
|
146
146
|
if (!_view) {
|
|
147
147
|
_view = [[RCTSurfaceView alloc] initWithSurface:(RCTSurface *)self];
|
|
148
|
+
[self _updateLayoutContext];
|
|
148
149
|
_touchHandler = [RCTSurfaceTouchHandler new];
|
|
149
150
|
[_touchHandler attachToView:_view];
|
|
150
151
|
}
|
|
@@ -136,10 +136,10 @@ public data class BorderRadiusStyle(
|
|
|
136
136
|
(startStart ?: topStart ?: topLeft ?: uniform)?.resolve(width, height)
|
|
137
137
|
?: zeroRadii,
|
|
138
138
|
bottomLeft =
|
|
139
|
-
(endEnd ?:
|
|
139
|
+
(endEnd ?: bottomEnd ?: bottomRight ?: uniform)?.resolve(width, height)
|
|
140
140
|
?: zeroRadii,
|
|
141
141
|
bottomRight =
|
|
142
|
-
(startEnd ?:
|
|
142
|
+
(startEnd ?: bottomStart ?: bottomLeft ?: uniform)?.resolve(width, height)
|
|
143
143
|
?: zeroRadii,
|
|
144
144
|
width = width,
|
|
145
145
|
height = height,
|
|
@@ -300,8 +300,9 @@ void TimerManager::attachGlobals(jsi::Runtime& runtime) {
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
if (!args[0].isObject() || !args[0].asObject(rt).isFunction(rt)) {
|
|
303
|
-
// Do not throw any error to match web spec
|
|
304
|
-
|
|
303
|
+
// Do not throw any error to match web spec; instead return 0, an
|
|
304
|
+
// invalid timer id
|
|
305
|
+
return 0;
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
auto callback = args[0].getObject(rt).getFunction(rt);
|
|
@@ -358,8 +359,9 @@ void TimerManager::attachGlobals(jsi::Runtime& runtime) {
|
|
|
358
359
|
}
|
|
359
360
|
|
|
360
361
|
if (!args[0].isObject() || !args[0].asObject(rt).isFunction(rt)) {
|
|
361
|
-
throw
|
|
362
|
-
|
|
362
|
+
// Do not throw any error to match web spec; instead return 0, an
|
|
363
|
+
// invalid timer id
|
|
364
|
+
return 0;
|
|
363
365
|
}
|
|
364
366
|
auto callback = args[0].getObject(rt).getFunction(rt);
|
|
365
367
|
auto delay = count > 1
|
|
@@ -93,7 +93,9 @@ class TimerManager {
|
|
|
93
93
|
|
|
94
94
|
// Each timeout that is registered on this queue gets a sequential id. This
|
|
95
95
|
// is the global count from which those are assigned.
|
|
96
|
-
|
|
96
|
+
// As per WHATWG HTML 8.6.1 (Timers) ids must be greater than zero, i.e. start
|
|
97
|
+
// at 1
|
|
98
|
+
TimerHandle timerIndex_{1};
|
|
97
99
|
|
|
98
100
|
// The React Native microtask queue is used to back public APIs including
|
|
99
101
|
// `queueMicrotask`, `clearImmediate`, and `setImmediate` (which is used by
|
|
@@ -267,7 +267,9 @@ TEST_F(ReactInstanceTest, testSetTimeoutWithoutDelay) {
|
|
|
267
267
|
EXPECT_CALL(
|
|
268
268
|
*mockRegistry_,
|
|
269
269
|
createTimer(_, 0)); // If delay is not provided, it should use 0
|
|
270
|
-
eval("setTimeout(() => {});");
|
|
270
|
+
auto val = eval("setTimeout(() => {});");
|
|
271
|
+
expectNoError();
|
|
272
|
+
EXPECT_EQ(val.asNumber(), 1); // First timer id should start at 1
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
TEST_F(ReactInstanceTest, testSetTimeoutWithPassThroughArgs) {
|
|
@@ -299,8 +301,9 @@ TEST_F(ReactInstanceTest, testSetTimeoutWithInvalidArgs) {
|
|
|
299
301
|
getErrorMessage("setTimeout();"),
|
|
300
302
|
"setTimeout must be called with at least one argument (the function to call).");
|
|
301
303
|
|
|
302
|
-
eval("setTimeout('invalid')
|
|
304
|
+
auto val = eval("setTimeout('invalid')");
|
|
303
305
|
expectNoError();
|
|
306
|
+
EXPECT_EQ(val.asNumber(), 0);
|
|
304
307
|
|
|
305
308
|
eval("setTimeout(() => {}, 'invalid');");
|
|
306
309
|
expectNoError();
|
|
@@ -417,9 +420,10 @@ TEST_F(ReactInstanceTest, testSetIntervalWithInvalidArgs) {
|
|
|
417
420
|
EXPECT_EQ(
|
|
418
421
|
getErrorMessage("setInterval();"),
|
|
419
422
|
"setInterval must be called with at least one argument (the function to call).");
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
+
|
|
424
|
+
auto val = eval("setInterval('invalid', 100)");
|
|
425
|
+
expectNoError();
|
|
426
|
+
EXPECT_EQ(val.asNumber(), 0);
|
|
423
427
|
}
|
|
424
428
|
|
|
425
429
|
TEST_F(ReactInstanceTest, testClearInterval) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-macos",
|
|
3
|
-
"version": "0.78.
|
|
3
|
+
"version": "0.78.6",
|
|
4
4
|
"description": "React Native for macOS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"peerDependencies": {
|
|
103
103
|
"@types/react": "^19.0.0",
|
|
104
104
|
"react": "^19.0.0",
|
|
105
|
-
"react-native": "0.78.
|
|
105
|
+
"react-native": "0.78.3"
|
|
106
106
|
},
|
|
107
107
|
"peerDependenciesMeta": {
|
|
108
108
|
"@types/react": {
|
|
@@ -111,13 +111,13 @@
|
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
114
|
-
"@react-native-macos/virtualized-lists": "0.78.
|
|
115
|
-
"@react-native/assets-registry": "0.78.
|
|
116
|
-
"@react-native/codegen": "0.78.
|
|
117
|
-
"@react-native/community-cli-plugin": "0.78.
|
|
118
|
-
"@react-native/gradle-plugin": "0.78.
|
|
119
|
-
"@react-native/js-polyfills": "0.78.
|
|
120
|
-
"@react-native/normalize-colors": "0.78.
|
|
114
|
+
"@react-native-macos/virtualized-lists": "0.78.6",
|
|
115
|
+
"@react-native/assets-registry": "0.78.3",
|
|
116
|
+
"@react-native/codegen": "0.78.3",
|
|
117
|
+
"@react-native/community-cli-plugin": "0.78.3",
|
|
118
|
+
"@react-native/gradle-plugin": "0.78.3",
|
|
119
|
+
"@react-native/js-polyfills": "0.78.3",
|
|
120
|
+
"@react-native/normalize-colors": "0.78.3",
|
|
121
121
|
"abort-controller": "^3.0.0",
|
|
122
122
|
"anser": "^1.4.9",
|
|
123
123
|
"ansi-regex": "^5.0.0",
|
|
@@ -325,22 +325,13 @@ function findExternalLibraries(pkgJson, projectRoot) {
|
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
function findLibrariesFromReactNativeConfig(projectRoot) {
|
|
329
|
-
const rnConfigFileName = 'react-native.config.js';
|
|
330
|
-
|
|
328
|
+
function findLibrariesFromReactNativeConfig(projectRoot, rnConfig) {
|
|
331
329
|
codegenLog(
|
|
332
|
-
`Searching for codegen-enabled libraries in
|
|
330
|
+
`Searching for codegen-enabled libraries in react-native.config.js`,
|
|
333
331
|
true,
|
|
334
332
|
);
|
|
335
333
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (!fs.existsSync(rnConfigFilePath)) {
|
|
339
|
-
return [];
|
|
340
|
-
}
|
|
341
|
-
const rnConfig = require(rnConfigFilePath);
|
|
342
|
-
|
|
343
|
-
if (rnConfig.dependencies == null) {
|
|
334
|
+
if (!rnConfig.dependencies) {
|
|
344
335
|
return [];
|
|
345
336
|
}
|
|
346
337
|
return Object.keys(rnConfig.dependencies).flatMap(name => {
|
|
@@ -592,7 +583,7 @@ function mustGenerateNativeCode(includeLibraryPath, schemaInfo) {
|
|
|
592
583
|
);
|
|
593
584
|
}
|
|
594
585
|
|
|
595
|
-
function findCodegenEnabledLibraries(pkgJson, projectRoot) {
|
|
586
|
+
function findCodegenEnabledLibraries(pkgJson, projectRoot, reactNativeConfig) {
|
|
596
587
|
const projectLibraries = findProjectRootLibraries(pkgJson, projectRoot);
|
|
597
588
|
if (pkgJsonIncludesGeneratedCode(pkgJson)) {
|
|
598
589
|
return projectLibraries;
|
|
@@ -600,7 +591,7 @@ function findCodegenEnabledLibraries(pkgJson, projectRoot) {
|
|
|
600
591
|
return [
|
|
601
592
|
...projectLibraries,
|
|
602
593
|
...findExternalLibraries(pkgJson, projectRoot),
|
|
603
|
-
...findLibrariesFromReactNativeConfig(projectRoot),
|
|
594
|
+
...findLibrariesFromReactNativeConfig(projectRoot, reactNativeConfig),
|
|
604
595
|
];
|
|
605
596
|
}
|
|
606
597
|
}
|
|
@@ -925,9 +916,14 @@ function execute(projectRoot, targetPlatform, baseOutputPath, source) {
|
|
|
925
916
|
|
|
926
917
|
buildCodegenIfNeeded();
|
|
927
918
|
|
|
928
|
-
const
|
|
919
|
+
const reactNativeConfig = readReactNativeConfig(projectRoot);
|
|
920
|
+
const codegenEnabledLibraries = findCodegenEnabledLibraries(
|
|
921
|
+
pkgJson,
|
|
922
|
+
projectRoot,
|
|
923
|
+
reactNativeConfig,
|
|
924
|
+
);
|
|
929
925
|
|
|
930
|
-
if (
|
|
926
|
+
if (codegenEnabledLibraries.length === 0) {
|
|
931
927
|
codegenLog('No codegen-enabled libraries found.', true);
|
|
932
928
|
return;
|
|
933
929
|
}
|
|
@@ -936,6 +932,18 @@ function execute(projectRoot, targetPlatform, baseOutputPath, source) {
|
|
|
936
932
|
targetPlatform === 'all' ? supportedPlatforms : [targetPlatform];
|
|
937
933
|
|
|
938
934
|
for (const platform of platforms) {
|
|
935
|
+
const disabledLibraries = findDisabledLibrariesByPlatform(
|
|
936
|
+
reactNativeConfig,
|
|
937
|
+
platform,
|
|
938
|
+
);
|
|
939
|
+
const libraries = codegenEnabledLibraries.filter(
|
|
940
|
+
({name}) => !disabledLibraries.includes(name),
|
|
941
|
+
);
|
|
942
|
+
|
|
943
|
+
if (!libraries.length) {
|
|
944
|
+
continue;
|
|
945
|
+
}
|
|
946
|
+
|
|
939
947
|
const outputPath = computeOutputPath(
|
|
940
948
|
projectRoot,
|
|
941
949
|
baseOutputPath,
|
|
@@ -971,6 +979,29 @@ function execute(projectRoot, targetPlatform, baseOutputPath, source) {
|
|
|
971
979
|
return;
|
|
972
980
|
}
|
|
973
981
|
|
|
982
|
+
/**
|
|
983
|
+
* Finds all disabled libraries by platform based the react native config.
|
|
984
|
+
*
|
|
985
|
+
* This is needed when selectively disabling libraries in react-native.config.js since codegen should exclude those libraries as well.
|
|
986
|
+
*/
|
|
987
|
+
function findDisabledLibrariesByPlatform(reactNativeConfig, platform) {
|
|
988
|
+
const dependencies = reactNativeConfig.dependencies ?? {};
|
|
989
|
+
|
|
990
|
+
return Object.keys(dependencies).filter(
|
|
991
|
+
dependency => dependencies[dependency].platforms?.[platform] === null,
|
|
992
|
+
);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
function readReactNativeConfig(projectRoot) {
|
|
996
|
+
const rnConfigFilePath = path.resolve(projectRoot, 'react-native.config.js');
|
|
997
|
+
|
|
998
|
+
if (!fs.existsSync(rnConfigFilePath)) {
|
|
999
|
+
return {};
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
return require(rnConfigFilePath);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
974
1005
|
module.exports = {
|
|
975
1006
|
execute,
|
|
976
1007
|
generateRNCoreComponentsIOS,
|