react-native-macos 0.77.5 → 0.77.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/Blob/RCTBlobManager.h +0 -0
- package/Libraries/Blob/RCTBlobManager.mm +0 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/StyleSheet/normalizeColor.js +0 -0
- package/React/Base/RCTJavaScriptLoader.h +0 -0
- package/React/Base/RCTJavaScriptLoader.mm +0 -0
- 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/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/local-cli/cli.js +0 -0
- package/package.json +3 -3
- package/scripts/compose-source-maps.js +0 -0
- package/scripts/featureflags/README.md +156 -0
- package/scripts/featureflags/index.js +39 -0
- package/scripts/ios-configure-glog.sh +0 -0
- package/scripts/node-binary.sh +0 -0
- package/scripts/packager.sh +0 -0
- package/scripts/react-native-xcode.sh +0 -0
- package/scripts/react_native_pods_utils/script_phases.sh +0 -0
- package/scripts/xcode/ccache-clang++.sh +0 -0
- package/scripts/xcode/ccache-clang.sh +0 -0
- package/scripts/xcode/with-environment.sh +0 -0
- package/scripts/cocoapods/autolinking.rb +0 -206
- package/scripts/cocoapods/autolinking_utils.rb +0 -25
- package/scripts/cocoapods/codegen.rb +0 -59
- package/scripts/cocoapods/codegen_script_phase_extractor.rb +0 -13
- package/scripts/cocoapods/codegen_utils.rb +0 -389
- package/scripts/cocoapods/fabric.rb +0 -18
- package/scripts/cocoapods/helpers.rb +0 -150
- package/scripts/cocoapods/jsengine.rb +0 -33
- package/scripts/cocoapods/local_podspec_patch.rb +0 -51
- package/scripts/cocoapods/new_architecture.rb +0 -194
- package/scripts/cocoapods/privacy_manifest_utils.rb +0 -194
- package/scripts/cocoapods/runtime.rb +0 -18
- package/scripts/cocoapods/spm.rb +0 -94
- package/scripts/cocoapods/utils.rb +0 -729
- package/scripts/codegen/codegen-utils.js +0 -51
- package/scripts/codegen/generate-artifacts-executor.js +0 -982
- package/scripts/codegen/generate-specs-cli-executor.js +0 -128
- package/scripts/codegen/templates/RCTAppDependencyProviderH.template +0 -25
- package/scripts/codegen/templates/RCTAppDependencyProviderMM.template +0 -55
- package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +0 -18
- package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +0 -33
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderH.template +0 -16
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +0 -23
- package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +0 -34
- package/sdks/hermes-engine/hermes-engine.podspec +0 -168
- package/sdks/hermes-engine/hermes-utils.rb +0 -341
- package/sdks/hermes-engine/utils/build-apple-framework.sh +0 -225
- package/sdks/hermes-engine/utils/build-hermes-xcode.sh +0 -100
- package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +0 -18
- package/sdks/hermes-engine/utils/build-ios-framework.sh +0 -90
- package/sdks/hermes-engine/utils/build-mac-framework.sh +0 -22
- package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +0 -7
- package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +0 -32
- package/sdks/hermes-engine/utils/replace_hermes_version.js +0 -106
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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
|
[resumeButton setImage:[UIImage systemImageNamed:@"forward.frame.fill"] forState:UIControlStateNormal];
|
|
61
63
|
resumeButton.tintColor = [UIColor colorWithRed:0.37 green:0.37 blue:0.37 alpha:1];
|
|
@@ -65,11 +67,21 @@
|
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
resumeButton.enabled = NO;
|
|
70
|
+
#else // [macOS
|
|
71
|
+
NSButton *resumeButton = [[NSButton alloc] init];
|
|
72
|
+
[resumeButton setImage:[NSImage imageWithSystemSymbolName:@"forward.frame.fill" accessibilityDescription:@"Resume"]];
|
|
73
|
+
resumeButton.bordered = NO;
|
|
74
|
+
resumeButton.target = self;
|
|
75
|
+
resumeButton.action = @selector(handleResume:);
|
|
76
|
+
resumeButton.contentTintColor = [NSColor colorWithRed:0.37 green:0.37 blue:0.37 alpha:1];
|
|
77
|
+
#endif // macOS]
|
|
78
|
+
|
|
68
79
|
[NSLayoutConstraint activateConstraints:@[
|
|
69
80
|
[resumeButton.widthAnchor constraintEqualToConstant:48],
|
|
70
81
|
[resumeButton.heightAnchor constraintEqualToConstant:46],
|
|
71
82
|
]];
|
|
72
83
|
|
|
84
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
73
85
|
UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[ messageContainer, resumeButton ]];
|
|
74
86
|
stackView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:0.757 alpha:1];
|
|
75
87
|
stackView.layer.cornerRadius = 12;
|
|
@@ -84,41 +96,75 @@
|
|
|
84
96
|
action:@selector(handleResume:)];
|
|
85
97
|
[stackView addGestureRecognizer:gestureRecognizer];
|
|
86
98
|
stackView.userInteractionEnabled = YES;
|
|
99
|
+
#else // [macOS
|
|
100
|
+
NSStackView *stackView = [NSStackView stackViewWithViews:@[ messageContainer, resumeButton ]];
|
|
101
|
+
stackView.wantsLayer = YES;
|
|
102
|
+
stackView.layer.backgroundColor = [NSColor colorWithRed:1 green:1 blue:0.757 alpha:1].CGColor;
|
|
103
|
+
stackView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
104
|
+
stackView.orientation = NSUserInterfaceLayoutOrientationHorizontal;
|
|
105
|
+
stackView.distribution = NSStackViewDistributionFill;
|
|
106
|
+
stackView.alignment = NSLayoutAttributeCenterY;
|
|
107
|
+
|
|
108
|
+
NSClickGestureRecognizer *gestureRecognizer = [[NSClickGestureRecognizer alloc] initWithTarget:self
|
|
109
|
+
action:@selector(handleResume:)];
|
|
110
|
+
[stackView addGestureRecognizer:gestureRecognizer];
|
|
111
|
+
#endif // macOS]
|
|
87
112
|
|
|
113
|
+
#if !TARGET_OS_OSX
|
|
88
114
|
[self.view addSubview:stackView];
|
|
89
115
|
|
|
90
116
|
[NSLayoutConstraint activateConstraints:@[
|
|
91
117
|
[stackView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor constant:12],
|
|
92
118
|
[stackView.centerXAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.centerXAnchor],
|
|
93
119
|
]];
|
|
120
|
+
#else
|
|
121
|
+
[self setView:stackView];
|
|
122
|
+
#endif
|
|
94
123
|
|
|
124
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
95
125
|
stackView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;
|
|
126
|
+
#else // [macOS
|
|
127
|
+
stackView.userInterfaceLayoutDirection = NSUserInterfaceLayoutDirectionLeftToRight;
|
|
128
|
+
#endif // macOS]
|
|
96
129
|
}
|
|
97
130
|
|
|
131
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
98
132
|
- (void)handleResume:(UITapGestureRecognizer *)recognizer
|
|
99
133
|
{
|
|
100
134
|
self.onResume();
|
|
101
135
|
}
|
|
102
|
-
#
|
|
136
|
+
#else // [macOS
|
|
137
|
+
- (void)handleResume:(id)sender
|
|
138
|
+
{
|
|
139
|
+
self.onResume();
|
|
140
|
+
}
|
|
141
|
+
#endif // macOS]
|
|
103
142
|
@end
|
|
104
143
|
|
|
105
144
|
@implementation RCTPausedInDebuggerOverlayController
|
|
106
145
|
|
|
107
|
-
|
|
108
|
-
- (UIWindow *)alertWindow
|
|
146
|
+
- (RCTPlatformWindow *)alertWindow // [macOS]
|
|
109
147
|
{
|
|
110
148
|
if (_alertWindow == nil) {
|
|
149
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
111
150
|
_alertWindow = [[UIWindow alloc] initWithWindowScene:RCTKeyWindow().windowScene];
|
|
112
151
|
|
|
113
152
|
if (_alertWindow) {
|
|
114
153
|
_alertWindow.rootViewController = [UIViewController new];
|
|
115
154
|
_alertWindow.windowLevel = UIWindowLevelAlert + 1;
|
|
116
155
|
}
|
|
156
|
+
#else // [macOS]
|
|
157
|
+
_alertWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
|
|
158
|
+
styleMask:NSWindowStyleMaskBorderless | NSWindowStyleMaskFullSizeContentView
|
|
159
|
+
backing:NSBackingStoreBuffered
|
|
160
|
+
defer:YES];
|
|
161
|
+
_alertWindow.backgroundColor = [NSColor clearColor];
|
|
162
|
+
_alertWindow.opaque = NO;
|
|
163
|
+
#endif // macOS]
|
|
117
164
|
}
|
|
118
165
|
|
|
119
166
|
return _alertWindow;
|
|
120
167
|
}
|
|
121
|
-
#endif // [macOS]
|
|
122
168
|
|
|
123
169
|
- (void)showWithMessage:(NSString *)message onResume:(void (^)(void))onResume
|
|
124
170
|
{
|
|
@@ -129,9 +175,21 @@
|
|
|
129
175
|
view.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
130
176
|
view.message = message;
|
|
131
177
|
view.onResume = onResume;
|
|
178
|
+
|
|
132
179
|
[self.alertWindow makeKeyAndVisible];
|
|
133
180
|
[self.alertWindow.rootViewController presentViewController:view animated:NO completion:nil];
|
|
134
|
-
#
|
|
181
|
+
#else // [macOS]
|
|
182
|
+
view.message = message;
|
|
183
|
+
view.onResume = onResume;
|
|
184
|
+
|
|
185
|
+
self.alertWindow.contentViewController = view;
|
|
186
|
+
NSWindow *parentWindow = RCTKeyWindow();
|
|
187
|
+
if (![[parentWindow sheets] doesContain:self->_alertWindow]) {
|
|
188
|
+
[parentWindow beginSheet:self.alertWindow completionHandler:^(NSModalResponse returnCode) {
|
|
189
|
+
[self->_alertWindow orderOut:self];
|
|
190
|
+
}];
|
|
191
|
+
}
|
|
192
|
+
#endif // macOS]
|
|
135
193
|
}
|
|
136
194
|
|
|
137
195
|
- (void)hide
|
|
@@ -140,9 +198,19 @@
|
|
|
140
198
|
[_alertWindow setHidden:YES];
|
|
141
199
|
|
|
142
200
|
_alertWindow.windowScene = nil;
|
|
201
|
+
#else // [macOS]
|
|
202
|
+
NSWindow *parentWindow = RCTKeyWindow();
|
|
203
|
+
if (parentWindow) {
|
|
204
|
+
for (NSWindow *sheet in [parentWindow sheets]) {
|
|
205
|
+
if (sheet == _alertWindow) {
|
|
206
|
+
[parentWindow endSheet:sheet];
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
#endif // macOS]
|
|
143
212
|
|
|
144
213
|
_alertWindow = nil;
|
|
145
|
-
#endif // macOS]
|
|
146
214
|
}
|
|
147
215
|
|
|
148
216
|
@end
|
package/local-cli/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-macos",
|
|
3
|
-
"version": "0.77.
|
|
3
|
+
"version": "0.77.6",
|
|
4
4
|
"description": "React Native for macOS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
114
|
-
"@react-native-macos/virtualized-lists": "0.77.
|
|
114
|
+
"@react-native-macos/virtualized-lists": "0.77.6",
|
|
115
115
|
"@react-native/assets-registry": "0.77.2",
|
|
116
116
|
"@react-native/codegen": "0.77.2",
|
|
117
117
|
"@react-native/community-cli-plugin": "0.77.2",
|
|
@@ -166,4 +166,4 @@
|
|
|
166
166
|
}
|
|
167
167
|
]
|
|
168
168
|
}
|
|
169
|
-
}
|
|
169
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Feature Flags
|
|
2
|
+
|
|
3
|
+
Feature flags are values that determine the behavior of specific parts of React
|
|
4
|
+
Native. This directory contains the configuration for those values, and scripts
|
|
5
|
+
to generate files for different languages to access and customize them.
|
|
6
|
+
|
|
7
|
+
There are 2 types of feature flags:
|
|
8
|
+
* Common: can be accessed from any language and they provide consistent values
|
|
9
|
+
everywhere.
|
|
10
|
+
* JS-only: they can only be accessed and customized from JavaScript.
|
|
11
|
+
|
|
12
|
+
## Definition
|
|
13
|
+
|
|
14
|
+
The source of truth for the definition of the flags is the file
|
|
15
|
+
`ReactNativeFeatureFlags.config.js` in this directory.
|
|
16
|
+
|
|
17
|
+
Example contents:
|
|
18
|
+
```javascript
|
|
19
|
+
module.exports = {
|
|
20
|
+
common: {
|
|
21
|
+
enableNativeBehavior: {
|
|
22
|
+
description: 'Enable some behavior both in native and in JS.',
|
|
23
|
+
defaultValue: false
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
jsOnly: {
|
|
27
|
+
enableJSBehavior: {
|
|
28
|
+
description: 'Enables some behavior in the JS layer.',
|
|
29
|
+
defaultValue: false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**After any change to these definitions**, the code that provides access to them
|
|
36
|
+
must be regenerated running this from the `react-native`
|
|
37
|
+
repository:
|
|
38
|
+
|
|
39
|
+
```shell
|
|
40
|
+
yarn featureflags --update
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Access
|
|
44
|
+
|
|
45
|
+
You can access the common feature flags from anywhere in your application using
|
|
46
|
+
the `ReactNativeFeatureFlags` interface (available in C++/Objective-C++,
|
|
47
|
+
Kotlin/Java and JavaScript). JS-only feature flags can only be accessed from
|
|
48
|
+
JavaScript.
|
|
49
|
+
|
|
50
|
+
**Accessing feature flags should be considered fast for all use cases**.
|
|
51
|
+
Feature flags are cached at every layer, which prevents having to go through JNI
|
|
52
|
+
when accessing the values from Kotlin and through JSI when accessing the values
|
|
53
|
+
from JavaScript.
|
|
54
|
+
|
|
55
|
+
### C++ / Objective-C
|
|
56
|
+
|
|
57
|
+
```c++
|
|
58
|
+
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
59
|
+
|
|
60
|
+
if (ReactNativeFeatureFlags::enableNativeBehavior()) {
|
|
61
|
+
// do something
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Kotlin
|
|
66
|
+
|
|
67
|
+
```kotlin
|
|
68
|
+
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
|
|
69
|
+
|
|
70
|
+
fun someMethod() {
|
|
71
|
+
if (ReactNativeFeatureFlags.enableNativeBehavior()) {
|
|
72
|
+
// do something
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### JavaScript
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags';
|
|
81
|
+
|
|
82
|
+
if (ReactNativeFeatureFlags.enableNativeBehavior()) {
|
|
83
|
+
// Native flag
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (ReactNativeFeatureFlags.enableJSBehavior()) {
|
|
87
|
+
// JS-only flag
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Customization
|
|
92
|
+
|
|
93
|
+
Feature flags provide the default values defined in the configuration unless
|
|
94
|
+
overrides are applied at the application level. Overrides for common feature
|
|
95
|
+
flags can only be defined in native, while overrides for JS-ony flags can only
|
|
96
|
+
be defined in JavaScript.
|
|
97
|
+
|
|
98
|
+
Overrides must be applied before any of the available feature flags has been
|
|
99
|
+
accessed. This prevents having inconsistent behavior during the lifecycle of the
|
|
100
|
+
application.
|
|
101
|
+
|
|
102
|
+
### C++/Objective-C
|
|
103
|
+
|
|
104
|
+
```c++
|
|
105
|
+
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
106
|
+
#include <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
|
|
107
|
+
|
|
108
|
+
class CustomReactNativeFeatureFlags : public ReactNativeFeatureFlagsDefaults {
|
|
109
|
+
public:
|
|
110
|
+
CustomReactNativeFeatureFlags();
|
|
111
|
+
|
|
112
|
+
bool enableNativeBehavior() override {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
ReactNativeFeatureFlags::override(std::make_unique<CustomReactNativeFeatureFlags>());
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Kotlin
|
|
121
|
+
|
|
122
|
+
```kotlin
|
|
123
|
+
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
|
|
124
|
+
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsDefaults
|
|
125
|
+
|
|
126
|
+
fun overrideFeatureFlags() {
|
|
127
|
+
ReactNativeFeatureFlags.override(object : ReactNativeFeatureFlagsDefaults() {
|
|
128
|
+
override fun useMicrotasks(): Boolean = true
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### JavaScript
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags';
|
|
137
|
+
|
|
138
|
+
ReactNativeFeatureFlags.override({
|
|
139
|
+
enableJSBehavior: () => true,
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Architecture
|
|
144
|
+
|
|
145
|
+
The architecture of this feature flags system can be described as follows:
|
|
146
|
+
* A shared C++ core, where we provide access to the flags and allow
|
|
147
|
+
customizations.
|
|
148
|
+
* A Kotlin/Java interface that allows accessing and customizing the values in
|
|
149
|
+
the C++ core (via JNI).
|
|
150
|
+
* A JavaScript interface that allows accessing the common values (via a native
|
|
151
|
+
module) and accessing and customizing the JS-only values.
|
|
152
|
+
|
|
153
|
+

|
|
154
|
+
|
|
155
|
+
_This image has an embedded [Excalidraw](https://www.excalidraw.com) diagram,
|
|
156
|
+
so you can upload it there if you need to make further modifications._
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
if (require.main === module) {
|
|
11
|
+
require('../../../../scripts/build/babel-register').registerForMonorepo();
|
|
12
|
+
|
|
13
|
+
let command;
|
|
14
|
+
|
|
15
|
+
if (process.argv.includes('--update')) {
|
|
16
|
+
command = 'update';
|
|
17
|
+
} else if (process.argv.includes('--verify-unchanged')) {
|
|
18
|
+
command = 'verify-unchanged';
|
|
19
|
+
} else if (process.argv.includes('--print')) {
|
|
20
|
+
command = 'print';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
switch (command) {
|
|
24
|
+
case 'update':
|
|
25
|
+
require('./update').default(false);
|
|
26
|
+
break;
|
|
27
|
+
case 'verify-unchanged':
|
|
28
|
+
require('./update').default(true);
|
|
29
|
+
break;
|
|
30
|
+
case 'print':
|
|
31
|
+
require('./print').default(process.argv.includes('--json'));
|
|
32
|
+
break;
|
|
33
|
+
default:
|
|
34
|
+
console.error(
|
|
35
|
+
'Usage: node featureflags.js [--update|--verify-unchanged]',
|
|
36
|
+
);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
File without changes
|
package/scripts/node-binary.sh
CHANGED
|
File without changes
|
package/scripts/packager.sh
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|