Skip to content

Commit 355c7d2

Browse files
author
Adam Gleitman
committed
Merge branch 'facebook-main' into core-ios-dynamic-type
2 parents 2393f04 + 6a43faf commit 355c7d2

File tree

33 files changed

+596
-1086
lines changed

33 files changed

+596
-1086
lines changed

.circleci/config.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,11 @@ jobs:
760760
description: The Android build type. Must be one of "Debug", "Release".
761761
type: enum
762762
enum: ["Debug", "Release"]
763-
newarchitecture:
764-
type: boolean
765-
default: false
763+
architecture:
764+
default: "OldArch"
765+
description: Which React Native architecture to use. Must be one of "NewArch", "OldArch".
766+
type: enum
767+
enum: [ "NewArch", "OldArch" ]
766768
jsengine:
767769
default: "Hermes"
768770
description: Which JavaScript engine to use. Must be one of "Hermes", "JSC".
@@ -775,17 +777,6 @@ jobs:
775777
- run_yarn
776778
- attach_workspace:
777779
at: .
778-
- when:
779-
condition:
780-
equal: ["JSC", << parameters.jsengine >>]
781-
steps:
782-
- run:
783-
name: Set enableHermes in buld.gradle to false
784-
command: |
785-
node ./scripts/set-rn-engine.js -e jsc
786-
echo "Hermes disabled."
787-
grep enableHermes: template/android/app/build.gradle
788-
789780
- run:
790781
name: Create Android template project
791782
command: |
@@ -796,10 +787,20 @@ jobs:
796787
yarn
797788
798789
- run:
799-
name: Build the template application for << parameters.flavor >> with New Architecture set to << parameters.newarchitecture >>, and using the << parameters.jsengine>> JS engine.
790+
name: Build the template application for << parameters.flavor >> with Architecture set to << parameters.architecture >>, and using the << parameters.jsengine>> JS engine.
800791
command: |
801792
cd /tmp/$PROJECT_NAME/android/
802-
./gradlew assemble<< parameters.flavor >> -PnewArchEnabled=<< parameters.newarchitecture >> -PREACT_NATIVE_MAVEN_LOCAL_REPO=/root/react-native/maven-local
793+
if [[ << parameters.architecture >> == "NewArch" ]]; then
794+
export ORG_GRADLE_PROJECT_newArchEnabled=true
795+
else
796+
export ORG_GRADLE_PROJECT_newArchEnabled=false
797+
fi
798+
if [[ << parameters.jsengine >> == "Hermes" ]]; then
799+
export ORG_GRADLE_PROJECT_hermesEnabled=true
800+
else
801+
export ORG_GRADLE_PROJECT_hermesEnabled=false
802+
fi
803+
./gradlew assemble<< parameters.flavor >> -PREACT_NATIVE_MAVEN_LOCAL_REPO=/root/react-native/maven-local
803804
804805
# -------------------------
805806
# JOBS: Test iOS Template
@@ -1602,7 +1603,7 @@ workflows:
16021603
- build_npm_package
16031604
matrix:
16041605
parameters:
1605-
newarchitecture: [true, false]
1606+
architecture: ["NewArch", "OldArch"]
16061607
jsengine: ["Hermes", "JSC"]
16071608
flavor: ["Debug", "Release"]
16081609
- test_buck

BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ rn_library(
742742
"//xplat/js:node_modules__abort_19controller",
743743
"//xplat/js:node_modules__anser",
744744
"//xplat/js:node_modules__base64_19js",
745+
"//xplat/js:node_modules__deprecated_19react_19native_19prop_19types",
745746
"//xplat/js:node_modules__event_19target_19shim",
746747
"//xplat/js:node_modules__invariant",
747748
"//xplat/js:node_modules__memoize_19one",

Libraries/Components/TextInput/TextInput.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,13 @@ const ExportedForwardRef: React.AbstractComponent<
16501650
);
16511651
});
16521652

1653+
/**
1654+
* Switch to `deprecated-react-native-prop-types` for compatibility with future
1655+
* releases. This is deprecated and will be removed in the future.
1656+
*/
1657+
ExportedForwardRef.propTypes =
1658+
require('deprecated-react-native-prop-types').TextInputPropTypes;
1659+
16531660
// $FlowFixMe[prop-missing]
16541661
ExportedForwardRef.State = {
16551662
currentlyFocusedInput: TextInputState.currentlyFocusedInput,

Libraries/Image/Image.android.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ Image.queryCache = queryCache;
325325
* comment and run Flow. */
326326
Image.resolveAssetSource = resolveAssetSource;
327327

328+
/**
329+
* Switch to `deprecated-react-native-prop-types` for compatibility with future
330+
* releases. This is deprecated and will be removed in the future.
331+
*/
332+
Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes;
333+
328334
const styles = StyleSheet.create({
329335
base: {
330336
overflow: 'hidden',

Libraries/Image/Image.ios.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ Image.queryCache = queryCache;
260260
* delete this comment and run Flow. */
261261
Image.resolveAssetSource = resolveAssetSource;
262262

263+
/**
264+
* Switch to `deprecated-react-native-prop-types` for compatibility with future
265+
* releases. This is deprecated and will be removed in the future.
266+
*/
267+
Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes;
268+
263269
const styles = StyleSheet.create({
264270
base: {
265271
overflow: 'hidden',

Libraries/LogBox/LogBox.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,16 @@ if (__DEV__) {
143143
if (LogBoxData.isLogBoxErrorMessage(String(args[0]))) {
144144
originalConsoleError(...args);
145145
return;
146+
} else {
147+
// Be sure to pass LogBox warnings through.
148+
originalConsoleWarn(...args);
146149
}
147150

148151
try {
149152
if (!isRCTLogAdviceWarning(...args)) {
150153
const {category, message, componentStack} = parseLogBoxLog(args);
151154

152155
if (!LogBoxData.isMessageIgnored(message.content)) {
153-
// Be sure to pass LogBox warnings through.
154-
originalConsoleWarn(...args);
155-
156156
LogBoxData.addLog({
157157
level: 'warn',
158158
category,
@@ -205,12 +205,12 @@ if (__DEV__) {
205205
args[0] = `Warning: ${filterResult.finalFormat}`;
206206
const {category, message, componentStack} = parseLogBoxLog(args);
207207

208-
if (!LogBoxData.isMessageIgnored(message.content)) {
209-
// Interpolate the message so they are formatted for adb and other CLIs.
210-
// This is different than the message.content above because it includes component stacks.
211-
const interpolated = parseInterpolation(args);
212-
originalConsoleError(interpolated.message.content);
208+
// Interpolate the message so they are formatted for adb and other CLIs.
209+
// This is different than the message.content above because it includes component stacks.
210+
const interpolated = parseInterpolation(args);
211+
originalConsoleError(interpolated.message.content);
213212

213+
if (!LogBoxData.isMessageIgnored(message.content)) {
214214
LogBoxData.addLog({
215215
level,
216216
category,

Libraries/Text/Text.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@ const Text: React.AbstractComponent<
270270

271271
Text.displayName = 'Text';
272272

273+
/**
274+
* Switch to `deprecated-react-native-prop-types` for compatibility with future
275+
* releases. This is deprecated and will be removed in the future.
276+
*/
277+
Text.propTypes = require('deprecated-react-native-prop-types').TextPropTypes;
278+
273279
/**
274280
* Returns false until the first time `newValue` is true, after which this will
275281
* always return true. This is necessary to lazily initialize `Pressability` so

Libraries/Utilities/HMRClient.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,23 @@ Error: ${e.message}`;
241241
}
242242
});
243243

244-
client.on('close', data => {
244+
client.on('close', closeEvent => {
245245
LoadingView.hide();
246-
setHMRUnavailableReason('Disconnected from Metro.');
246+
247+
// https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1
248+
// https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.5
249+
const isNormalOrUnsetCloseReason =
250+
closeEvent.code === 1000 ||
251+
closeEvent.code === 1005 ||
252+
closeEvent.code == null;
253+
254+
if (isNormalOrUnsetCloseReason) {
255+
setHMRUnavailableReason('Disconnected from Metro.');
256+
} else {
257+
setHMRUnavailableReason(
258+
`Disconnected from Metro (${closeEvent.code}: "${closeEvent.reason}").`,
259+
);
260+
}
247261
});
248262

249263
if (isEnabled) {

Libraries/WebSocket/WebSocket.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ const CLOSED = 3;
4343

4444
const CLOSE_NORMAL = 1000;
4545

46+
// Abnormal closure where no code is provided in a control frame
47+
// https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.5
48+
const CLOSE_ABNORMAL = 1006;
49+
4650
const WEBSOCKET_EVENTS = ['close', 'error', 'message', 'open'];
4751

4852
let nextWebSocketId = 0;
@@ -260,6 +264,7 @@ class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) {
260264
new WebSocketEvent('close', {
261265
code: ev.code,
262266
reason: ev.reason,
267+
// TODO: missing `wasClean` (exposed on iOS as `clean` but missing on Android)
263268
}),
264269
);
265270
this._unregisterEvents();
@@ -277,7 +282,9 @@ class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) {
277282
);
278283
this.dispatchEvent(
279284
new WebSocketEvent('close', {
280-
message: ev.message,
285+
code: CLOSE_ABNORMAL,
286+
reason: ev.message,
287+
// TODO: Expose `wasClean`
281288
}),
282289
);
283290
this._unregisterEvents();

React/CoreModules/CoreModulesPlugins.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Class RCTWebSocketModuleCls(void) __attribute__((used));
5454
Class RCTDevLoadingViewCls(void) __attribute__((used));
5555
Class RCTDevSplitBundleLoaderCls(void) __attribute__((used));
5656
Class RCTEventDispatcherCls(void) __attribute__((used));
57+
Class RCTBlobManagerCls(void) __attribute__((used));
5758

5859
#ifdef __cplusplus
5960
}

0 commit comments

Comments
 (0)