mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
104
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ba400c35e | ||
|
|
7366fc64d8 | ||
|
|
40c149b0c4 | ||
|
|
641a11fe21 | ||
|
|
84144272ba | ||
|
|
9b97cd95cf | ||
|
|
cddd0e17d1 | ||
|
|
126db5eb65 | ||
|
|
31ce64073f | ||
|
|
7aa46a169e | ||
|
|
29f8f1e196 | ||
|
|
832b423a65 | ||
|
|
f4cf8abc09 | ||
|
|
c8ad23ae1a | ||
|
|
2664b8b117 | ||
|
|
aed4aed9d5 | ||
|
|
abfdf2c7fe | ||
|
|
4ddf7cb025 | ||
|
|
f068f4a903 | ||
|
|
d64c72f629 | ||
|
|
6d41c72a90 | ||
|
|
764ae1a03a | ||
|
|
cb658983c4 | ||
|
|
50a8bd8146 | ||
|
|
a98a781988 | ||
|
|
d6b73c6726 | ||
|
|
d1e2137425 | ||
|
|
a5df17661d | ||
|
|
8cae2e75e7 | ||
|
|
dbef1d90d1 | ||
|
|
34052725e1 | ||
|
|
c72867d0ad | ||
|
|
91a25629bd | ||
|
|
efcc3cf4fd | ||
|
|
bb4801ca0c | ||
|
|
3700d6a8da | ||
|
|
f47635374d | ||
|
|
3542e9083a | ||
|
|
93edc9a31a | ||
|
|
1e72390fbb | ||
|
|
c4c8b4b95a | ||
|
|
ba5895e190 | ||
|
|
efcb84126e | ||
|
|
becb369601 | ||
|
|
20d1466be8 | ||
|
|
034d815cfd | ||
|
|
7193bd720b | ||
|
|
2d163cf496 | ||
|
|
0344de246d | ||
|
|
db45da7101 | ||
|
|
6bc0444acc | ||
|
|
bf0cdfcdd4 | ||
|
|
9b9c07eaf0 | ||
|
|
8d2f41dbbf | ||
|
|
9f6575b6d4 | ||
|
|
a09999911a | ||
|
|
59855fc412 | ||
|
|
31680559b4 | ||
|
|
21e2445d06 | ||
|
|
4a4fb12a47 | ||
|
|
c05b3d385e | ||
|
|
5310a50a66 | ||
|
|
e22a8d1ac5 | ||
|
|
d5ff7e7e74 | ||
|
|
b4bc816fcd | ||
|
|
a52faa6fab | ||
|
|
8e5439f1a7 | ||
|
|
3ba5e4f89c | ||
|
|
ee6ff7a53e | ||
|
|
7f72275567 | ||
|
|
d247b61f78 | ||
|
|
7a4a0c4984 | ||
|
|
82a52a1939 | ||
|
|
e8f41ce48b | ||
|
|
032706790a | ||
|
|
8eec395268 | ||
|
|
725b1c9a7e | ||
|
|
50f242e4d7 | ||
|
|
e5bf39cf85 | ||
|
|
047f645079 | ||
|
|
dd30cd30c9 | ||
|
|
f133dd2efb | ||
|
|
8263b9d237 | ||
|
|
0c040314b5 | ||
|
|
b6c0703ebb | ||
|
|
6b9cf50b30 | ||
|
|
aa58c4c4b7 | ||
|
|
3793a64808 | ||
|
|
e6b24a3146 | ||
|
|
c116c1c268 | ||
|
|
67ebc7c7d5 | ||
|
|
49bd0ed303 | ||
|
|
608b4bac44 | ||
|
|
ea09bcd8cb | ||
|
|
562109fdd3 | ||
|
|
a57a8b7782 | ||
|
|
69e0c2d916 | ||
|
|
04d80478c8 | ||
|
|
73cd7c0e6b | ||
|
|
4c1418a216 | ||
|
|
9f5c77dab7 | ||
|
|
b07859ab1f | ||
|
|
90b8518073 | ||
|
|
d54e20b5f6 |
+16
-4
@@ -35,7 +35,16 @@ jobs:
|
||||
command: |
|
||||
apt update
|
||||
apt install -y wget git curl jq
|
||||
curl -sL https://deb.nodesource.com/setup_18.x | bash -
|
||||
|
||||
apt-get update
|
||||
apt-get install -y ca-certificates curl gnupg
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
|
||||
NODE_MAJOR=18
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
||||
apt-get update
|
||||
|
||||
apt install -y nodejs
|
||||
npm install --global yarn
|
||||
- checkout
|
||||
@@ -69,9 +78,9 @@ jobs:
|
||||
command: |
|
||||
if [[ -z "$CIRCLE_PULL_REQUEST" ]]; then
|
||||
echo "Not in a PR. Can't filter properly outside a PR. Please open a PR so that we can run the proper CI tests."
|
||||
echo "Skipping!"
|
||||
echo "For safety, we run all the tests!"
|
||||
mkdir -p /tmp/circleci/
|
||||
echo '{}' > /tmp/circleci/pipeline_config.json
|
||||
echo '{ "run_all": true }' > /tmp/circleci/pipeline_config.json
|
||||
else
|
||||
PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
|
||||
node ./scripts/circleci/pipeline_selection.js filter-jobs
|
||||
@@ -91,4 +100,7 @@ jobs:
|
||||
workflows:
|
||||
always-run:
|
||||
jobs:
|
||||
- choose_ci_jobs
|
||||
- choose_ci_jobs:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
|
||||
@@ -621,7 +621,7 @@ jobs:
|
||||
- run:
|
||||
name: Install Node JS
|
||||
# Note: Version set separately for non-Windows builds, see above.
|
||||
command: choco install nodejs-lts
|
||||
command: choco install nodejs --version=18.18.0 --allow-downgrade
|
||||
|
||||
# Setup Dependencies
|
||||
- run:
|
||||
@@ -681,7 +681,16 @@ jobs:
|
||||
apt update
|
||||
|
||||
apt install -y wget git curl jq
|
||||
curl -sL https://deb.nodesource.com/setup_18.x | bash -
|
||||
|
||||
apt-get update
|
||||
apt-get install -y ca-certificates curl gnupg
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
|
||||
NODE_MAJOR=18
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
||||
apt-get update
|
||||
|
||||
apt install -y nodejs
|
||||
npm install --global yarn
|
||||
- checkout
|
||||
|
||||
@@ -91,8 +91,8 @@ references:
|
||||
hermes_dsym_release_cache_key: &hermes_dsym_release_cache_key v1-hermes-release-dsym-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
|
||||
# Cocoapods - RNTester
|
||||
pods_cache_key: &pods_cache_key v10-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }}
|
||||
cocoapods_cache_key: &cocoapods_cache_key v8-cocoapods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock" }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}
|
||||
rntester_podfile_lock_cache_key: &rntester_podfile_lock_cache_key v6-podfilelock-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/week_year" }}-{{ checksum "/tmp/hermes/hermesversion" }}
|
||||
cocoapods_cache_key: &cocoapods_cache_key v9-cocoapods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock" }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}
|
||||
rntester_podfile_lock_cache_key: &rntester_podfile_lock_cache_key v7-podfilelock-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/week_year" }}-{{ checksum "/tmp/hermes/hermesversion" }}
|
||||
|
||||
# Cocoapods - Template
|
||||
template_cocoapods_cache_key: &template_cocoapods_cache_key v4-cocoapods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile.lock" }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "packages/rn-tester/Podfile.lock }}
|
||||
|
||||
@@ -43,6 +43,7 @@ workflows:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_apple_slices_hermes:
|
||||
filters: *only_release_tags
|
||||
requires:
|
||||
- build_hermesc_apple
|
||||
matrix:
|
||||
@@ -54,6 +55,7 @@ workflows:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_hermes_macos:
|
||||
filters: *only_release_tags
|
||||
requires:
|
||||
- build_apple_slices_hermes
|
||||
matrix:
|
||||
|
||||
@@ -21,7 +21,6 @@ DerivedData
|
||||
*.xcuserstate
|
||||
project.xcworkspace
|
||||
**/.xcode.env.local
|
||||
/poackages/react-native/sdks/downloads/
|
||||
|
||||
# Gradle
|
||||
/build/
|
||||
|
||||
@@ -4,4 +4,4 @@ source 'https://rubygems.org'
|
||||
ruby ">= 2.6.10"
|
||||
|
||||
gem 'cocoapods', '~> 1.12'
|
||||
gem 'activesupport', '>= 6.1.7.3'
|
||||
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
|
||||
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
declare module 'open' {
|
||||
import type {ChildProcess} from 'child_process';
|
||||
|
||||
declare export type Options = $ReadOnly<{
|
||||
wait?: boolean,
|
||||
background?: boolean,
|
||||
newInstance?: boolean,
|
||||
allowNonzeroExitCode?: boolean,
|
||||
...
|
||||
}>;
|
||||
|
||||
declare type open = (
|
||||
target: string,
|
||||
options?: Options,
|
||||
) => Promise<ChildProcess>;
|
||||
|
||||
declare module.exports: open;
|
||||
}
|
||||
+4
-4
@@ -55,8 +55,8 @@
|
||||
"@definitelytyped/dtslint": "^0.0.127",
|
||||
"@jest/create-cache-key-function": "^29.6.3",
|
||||
"@pkgjs/parseargs": "^0.11.0",
|
||||
"@react-native/metro-babel-transformer": "^0.73.11",
|
||||
"@react-native/metro-config": "^0.73.0",
|
||||
"@react-native/metro-babel-transformer": "^0.73.12",
|
||||
"@react-native/metro-config": "^0.73.2",
|
||||
"@tsconfig/node18": "1.0.1",
|
||||
"@types/react": "^18.0.18",
|
||||
"@typescript-eslint/parser": "^5.57.1",
|
||||
@@ -91,8 +91,8 @@
|
||||
"jest": "^29.6.3",
|
||||
"jest-junit": "^10.0.0",
|
||||
"jscodeshift": "^0.14.0",
|
||||
"metro-babel-register": "0.79.1",
|
||||
"metro-memory-fs": "0.79.1",
|
||||
"metro-babel-register": "^0.80.0",
|
||||
"metro-memory-fs": "^0.80.0",
|
||||
"micromatch": "^4.0.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mock-fs": "^5.1.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/assets-registry",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.1",
|
||||
"description": "Asset support code for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -9,7 +9,12 @@
|
||||
"directory": "packages/assets"
|
||||
},
|
||||
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/assets#readme",
|
||||
"keywords": ["assets", "registry", "react-native", "support"],
|
||||
"keywords": [
|
||||
"assets",
|
||||
"registry",
|
||||
"react-native",
|
||||
"support"
|
||||
],
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/babel-plugin-codegen",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.1",
|
||||
"description": "Babel plugin to generate native module and view manager code for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -9,7 +9,14 @@
|
||||
"directory": "packages/babel-plugin-codegen"
|
||||
},
|
||||
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/babel-plugin-codegen#readme",
|
||||
"keywords": ["babel", "plugin", "codegen", "react-native", "native-modules", "view-manager"],
|
||||
"keywords": [
|
||||
"babel",
|
||||
"plugin",
|
||||
"codegen",
|
||||
"react-native",
|
||||
"native-modules",
|
||||
"view-manager"
|
||||
],
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/community-cli-plugin",
|
||||
"version": "0.73.1",
|
||||
"version": "0.73.8",
|
||||
"description": "Core CLI commands for React Native",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -22,20 +22,20 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/dev-middleware": "^0.73.0",
|
||||
"@react-native-community/cli-server-api": "12.0.0-alpha.15",
|
||||
"@react-native-community/cli-tools": "12.0.0-alpha.15",
|
||||
"@react-native/metro-babel-transformer": "^0.73.11",
|
||||
"@react-native/dev-middleware": "^0.73.4",
|
||||
"@react-native-community/cli-server-api": "12.0.0",
|
||||
"@react-native-community/cli-tools": "12.0.0",
|
||||
"@react-native/metro-babel-transformer": "^0.73.12",
|
||||
"chalk": "^4.0.0",
|
||||
"execa": "^5.1.1",
|
||||
"metro": "0.79.1",
|
||||
"metro-config": "0.79.1",
|
||||
"metro-core": "0.79.1",
|
||||
"metro": "^0.80.0",
|
||||
"metro-config": "^0.80.0",
|
||||
"metro-core": "^0.80.0",
|
||||
"node-fetch": "^2.2.0",
|
||||
"readline": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"metro-resolver": "0.79.1"
|
||||
"metro-resolver": "^0.80.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -15,7 +15,6 @@ import {logger} from '@react-native-community/cli-tools';
|
||||
import chalk from 'chalk';
|
||||
import execa from 'execa';
|
||||
import fetch from 'node-fetch';
|
||||
import readline from 'readline';
|
||||
import {KeyPressHandler} from '../../utils/KeyPressHandler';
|
||||
|
||||
const CTRL_C = '\u0003';
|
||||
@@ -23,27 +22,23 @@ const CTRL_D = '\u0004';
|
||||
|
||||
export default function attachKeyHandlers({
|
||||
cliConfig,
|
||||
serverInstance,
|
||||
devServerUrl,
|
||||
messageSocket,
|
||||
experimentalDebuggerFrontend,
|
||||
}: {
|
||||
cliConfig: Config,
|
||||
devServerUrl: string,
|
||||
serverInstance: http$Server | https$Server,
|
||||
messageSocket: $ReadOnly<{
|
||||
broadcast: (type: string, params?: Record<string, mixed> | null) => void,
|
||||
...
|
||||
}>,
|
||||
experimentalDebuggerFrontend: boolean,
|
||||
}) {
|
||||
if (process.stdin.isTTY !== true) {
|
||||
logger.debug('Interactive mode is not supported in this environment');
|
||||
return;
|
||||
}
|
||||
|
||||
readline.emitKeypressEvents(process.stdin);
|
||||
// $FlowIgnore[prop-missing]
|
||||
process.stdin.setRawMode(true);
|
||||
|
||||
const execaOptions = {
|
||||
env: {FORCE_COLOR: chalk.supportsColor ? 'true' : 'false'},
|
||||
};
|
||||
@@ -83,30 +78,35 @@ export default function attachKeyHandlers({
|
||||
).stdout?.pipe(process.stdout);
|
||||
break;
|
||||
case 'j':
|
||||
if (!experimentalDebuggerFrontend) {
|
||||
return;
|
||||
}
|
||||
await fetch(devServerUrl + '/open-debugger', {method: 'POST'});
|
||||
break;
|
||||
case CTRL_C:
|
||||
case CTRL_D:
|
||||
logger.info('Stopping server');
|
||||
listener?.({pause: true});
|
||||
serverInstance.close(() => {
|
||||
process.emit('SIGINT');
|
||||
process.exit();
|
||||
});
|
||||
keyPressHandler.stopInterceptingKeyStrokes();
|
||||
process.emit('SIGINT');
|
||||
process.exit();
|
||||
}
|
||||
};
|
||||
|
||||
const keyPressHandler = new KeyPressHandler(onPress);
|
||||
const listener = keyPressHandler.createInteractionListener();
|
||||
keyPressHandler.createInteractionListener();
|
||||
keyPressHandler.startInterceptingKeyStrokes();
|
||||
|
||||
logger.log(
|
||||
`
|
||||
${chalk.bold('i')} - run on iOS
|
||||
${chalk.bold('a')} - run on Android
|
||||
${chalk.bold('d')} - open Dev Menu
|
||||
${chalk.bold('j')} - open debugger
|
||||
${chalk.bold('r')} - reload app
|
||||
`,
|
||||
[
|
||||
'',
|
||||
`${chalk.bold('i')} - run on iOS`,
|
||||
`${chalk.bold('a')} - run on Android`,
|
||||
`${chalk.bold('d')} - open Dev Menu`,
|
||||
...(experimentalDebuggerFrontend
|
||||
? [`${chalk.bold('j')} - open debugger (experimental, Hermes only)`]
|
||||
: []),
|
||||
`${chalk.bold('r')} - reload app`,
|
||||
'',
|
||||
].join('\n'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,13 @@ const startCommand: Command = {
|
||||
name: '--no-interactive',
|
||||
description: 'Disables interactive mode',
|
||||
},
|
||||
{
|
||||
name: '--experimental-debugger',
|
||||
description:
|
||||
"[Experimental] Enable the new debugger experience and 'j' to " +
|
||||
'debug. This enables the new frontend experience only: connection ' +
|
||||
'reliability and some basic features are unstable in this release.',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ export type StartCommandArgs = {
|
||||
assetPlugins?: string[],
|
||||
cert?: string,
|
||||
customLogReporterPath?: string,
|
||||
experimentalDebugger: boolean,
|
||||
host?: string,
|
||||
https?: boolean,
|
||||
maxWorkers?: number,
|
||||
@@ -118,7 +119,7 @@ async function runServer(
|
||||
logger,
|
||||
unstable_experiments: {
|
||||
// NOTE: Only affects the /open-debugger endpoint
|
||||
enableCustomDebuggerFrontend: true,
|
||||
enableNewDebugger: args.experimentalDebugger,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -137,8 +138,8 @@ async function runServer(
|
||||
attachKeyHandlers({
|
||||
cliConfig: ctx,
|
||||
devServerUrl,
|
||||
serverInstance,
|
||||
messageSocket: messageSocketEndpoint,
|
||||
experimentalDebuggerFrontend: args.experimentalDebugger,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@generated SignedSource<<8a0bac4cfdcc3cd44a4f7136f2611ebb>>
|
||||
Git revision: 0ffb687b8e049769d2e7162ba8d7205c90e4110c
|
||||
@generated SignedSource<<7fdc9e65be03ba4c6654f14c6f23d645>>
|
||||
Git revision: 18f202a1ae468a01afb44ffd2f71d28023126989
|
||||
Built with --nohooks: false
|
||||
Is local checkout: false
|
||||
Remote URL: https://github.com/motiz88/rn-chrome-devtools-frontend
|
||||
|
||||
@@ -13,6 +13,7 @@ style.setProperty('--image-file-chromeLeft', 'url(\"' + new URL('./chromeLeft.av
|
||||
style.setProperty('--image-file-chromeMiddle', 'url(\"' + new URL('./chromeMiddle.avif', import.meta.url).toString() + '\")');
|
||||
style.setProperty('--image-file-chromeRight', 'url(\"' + new URL('./chromeRight.avif', import.meta.url).toString() + '\")');
|
||||
style.setProperty('--image-file-cssoverview_icons_2x', 'url(\"' + new URL('./cssoverview_icons_2x.avif', import.meta.url).toString() + '\")');
|
||||
style.setProperty('--image-file-favicon', 'url(\"' + new URL('./favicon.ico', import.meta.url).toString() + '\")');
|
||||
style.setProperty('--image-file-navigationControls_2x', 'url(\"' + new URL('./navigationControls_2x.png', import.meta.url).toString() + '\")');
|
||||
style.setProperty('--image-file-navigationControls', 'url(\"' + new URL('./navigationControls.png', import.meta.url).toString() + '\")');
|
||||
style.setProperty('--image-file-nodeIcon', 'url(\"' + new URL('./nodeIcon.avif', import.meta.url).toString() + '\")');
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
+1
-1
File diff suppressed because one or more lines are too long
+2
-1
@@ -6,7 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>DevTools</title>
|
||||
<title>DevTools (React Native)</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@@ -16,5 +16,6 @@
|
||||
</style>
|
||||
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="./Images/favicon.ico">
|
||||
<script type="module" src="./entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.js"></script>
|
||||
<body class="undocked" id="-blink-dev-tools">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>DevTools</title>
|
||||
<title>DevTools (React Native)</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@@ -16,5 +16,6 @@
|
||||
</style>
|
||||
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="./Images/favicon.ico">
|
||||
<script type="module" src="./entrypoints/devtools_app/devtools_app.js"></script>
|
||||
<body class="undocked" id="-blink-dev-tools">
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -6,7 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>DevTools</title>
|
||||
<title>DevTools (React Native)</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@@ -16,5 +16,6 @@
|
||||
</style>
|
||||
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="./Images/favicon.ico">
|
||||
<script type="module" src="./entrypoints/inspector/inspector.js"></script>
|
||||
<body class="undocked" id="-blink-dev-tools">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>DevTools</title>
|
||||
<title>DevTools (React Native)</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@@ -16,5 +16,6 @@
|
||||
</style>
|
||||
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="./Images/favicon.ico">
|
||||
<script type="module" src="./entrypoints/js_app/js_app.js"></script>
|
||||
<body class="undocked" id="-blink-dev-tools">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>DevTools</title>
|
||||
<title>DevTools (React Native)</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@@ -16,5 +16,6 @@
|
||||
</style>
|
||||
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="./Images/favicon.ico">
|
||||
<script type="module" src="./entrypoints/ndb_app/ndb_app.js"></script>
|
||||
<body class="undocked" id="-blink-dev-tools">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>DevTools</title>
|
||||
<title>DevTools (React Native)</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@@ -16,5 +16,6 @@
|
||||
</style>
|
||||
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="./Images/favicon.ico">
|
||||
<script type="module" src="./entrypoints/node_app/node_app.js"></script>
|
||||
<body class="undocked" id="-blink-dev-tools">
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import*as e from"../../core/i18n/i18n.js";import*as t from"../../core/root/root.js";import*as i from"../../ui/legacy/legacy.js";const o={profiler:"Profiler",showProfiler:"Show Profiler",performance:"Performance",showPerformance:"Show Performance",startStopRecording:"Start/stop recording",showRecentTimelineSessions:"Show recent timeline sessions",record:"Record",stop:"Stop",startProfilingAndReloadPage:"Start profiling and reload page"},n=e.i18n.registerUIStrings("panels/js_profiler/js_profiler-meta.ts",o),r=e.i18n.getLazilyComputedLocalizedString.bind(void 0,n);let a,l;async function s(){return l||(l=await import("../profiler/profiler.js")),l}async function c(){return a||(a=await import("../timeline/timeline.js")),a}function g(e){return void 0===a?[]:e(a)}i.ViewManager.registerViewExtension({location:"panel",id:"js_profiler",title:r(o.profiler),commandPrompt:r(o.showProfiler),order:65,persistence:"closeable",experiment:t.Runtime.ExperimentName.JS_PROFILER_TEMP_ENABLE,loadView:async()=>(await s()).ProfilesPanel.JSProfilerPanel.instance()}),i.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:r(o.performance),commandPrompt:r(o.showPerformance),order:66,hasToolbar:!1,isPreviewFeature:!0,loadView:async()=>(await c()).TimelinePanel.TimelinePanel.instance({forceNew:null,isNode:!0})}),i.ActionRegistration.registerActionExtension({actionId:"profiler.js-toggle-recording",category:i.ActionRegistration.ActionCategory.JAVASCRIPT_PROFILER,title:r(o.startStopRecording),iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes(){return e=e=>[e.ProfilesPanel.JSProfilerPanel],void 0===l?[]:e(l);var e},loadActionDelegate:async()=>(await s()).ProfilesPanel.JSProfilerPanel.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>(await c()).TimelinePanel.ActionDelegate.instance(),category:i.ActionRegistration.ActionCategory.PERFORMANCE,title:r(o.showRecentTimelineSessions),contextTypes:()=>g((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:i.ActionRegistration.ActionCategory.PERFORMANCE,iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>g((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>(await c()).TimelinePanel.ActionDelegate.instance(),options:[{value:!0,title:r(o.record)},{value:!1,title:r(o.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>g((e=>[e.TimelinePanel.TimelinePanel])),category:i.ActionRegistration.ActionCategory.PERFORMANCE,title:r(o.startProfilingAndReloadPage),loadActionDelegate:async()=>(await c()).TimelinePanel.ActionDelegate.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]});
|
||||
import*as e from"../../core/i18n/i18n.js";import*as t from"../../core/root/root.js";import*as i from"../../ui/legacy/legacy.js";const o={profiler:"Profiler",showProfiler:"Show Profiler",performance:"Performance",showPerformance:"Show Performance",startStopRecording:"Start/stop recording",showRecentTimelineSessions:"Show recent timeline sessions",record:"Record",stop:"Stop",startProfilingAndReloadPage:"Start profiling and reload page"},n=e.i18n.registerUIStrings("panels/js_profiler/js_profiler-meta.ts",o),r=e.i18n.getLazilyComputedLocalizedString.bind(void 0,n);let a,l;async function s(){return l||(l=await import("../profiler/profiler.js")),l}async function c(){return a||(a=await import("../timeline/timeline.js")),a}function g(e){return void 0===a?[]:e(a)}i.ViewManager.registerViewExtension({location:"panel",id:"js_profiler",title:r(o.profiler),commandPrompt:r(o.showProfiler),order:65,persistence:"permanent",experiment:t.Runtime.ExperimentName.JS_PROFILER_TEMP_ENABLE,loadView:async()=>(await s()).ProfilesPanel.JSProfilerPanel.instance()}),i.ActionRegistration.registerActionExtension({actionId:"profiler.js-toggle-recording",category:i.ActionRegistration.ActionCategory.JAVASCRIPT_PROFILER,title:r(o.startStopRecording),iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes(){return e=e=>[e.ProfilesPanel.JSProfilerPanel],void 0===l?[]:e(l);var e},loadActionDelegate:async()=>(await s()).ProfilesPanel.JSProfilerPanel.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>(await c()).TimelinePanel.ActionDelegate.instance(),category:i.ActionRegistration.ActionCategory.PERFORMANCE,title:r(o.showRecentTimelineSessions),contextTypes:()=>g((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:i.ActionRegistration.ActionCategory.PERFORMANCE,iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>g((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>(await c()).TimelinePanel.ActionDelegate.instance(),options:[{value:!0,title:r(o.record)},{value:!1,title:r(o.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>g((e=>[e.TimelinePanel.TimelinePanel])),category:i.ActionRegistration.ActionCategory.PERFORMANCE,title:r(o.startProfilingAndReloadPage),loadActionDelegate:async()=>(await c()).TimelinePanel.ActionDelegate.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]});
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
||||
import*as e from"../../ui/legacy/legacy.js";import*as t from"../../core/i18n/i18n.js";import*as n from"../../ui/lit-html/lit-html.js";const i=new CSSStyleSheet;i.replaceSync('.rn-welcome-panel{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:16px;text-align:center;background-color:var(--color-background-elevation-0)}.rn-welcome-header{display:flex;align-items:center;margin-bottom:16px}.rn-welcome-icon{width:30px;height:30px;border-radius:4px;margin-right:12px}.rn-welcome-title{font-size:20px;color:var(--color-text-primary)}.rn-welcome-tagline{margin-bottom:24px;font-size:1rem;line-height:1.3;color:var(--color-text-secondary)}.rn-welcome-links{display:flex;align-items:center}.rn-welcome-links > .devtools-link{position:relative;margin:0 16px;font-size:14px}.rn-welcome-links > .devtools-link:not(:last-child)::after{content:"";position:absolute;right:-16px;height:16px;border-right:1px solid var(--color-details-hairline)}\n/*# sourceURL=rnWelcome.css */\n');const o={debuggerBrandName:"React Native JS Inspector",welcomeMessage:"Welcome to debugging in React Native",docsLabel:"Debugging docs",whatsNewLabel:"What's new"},{render:r,html:l}=n,s=t.i18n.registerUIStrings("panels/rn_welcome/RNWelcome.ts",o),c=t.i18n.getLocalizedString.bind(void 0,s);let a;class d extends e.Widget.VBox{static instance(e={forceNew:null}){const{forceNew:t}=e;return a&&!t||(a=new d),a}constructor(){super(!0,!0)}wasShown(){super.wasShown(),this.registerCSSFiles([i]),this.render(),e.InspectorView.InspectorView.instance().showDrawer(!0)}render(){const e=new URL("../../Images/react_native/welcomeIcon.png",import.meta.url).toString();r(l` <div class="rn-welcome-panel"> <div class="rn-welcome-header"> <img class="rn-welcome-icon" src="${e}" role="presentation"> <div class="rn-welcome-title"> ${c(o.debuggerBrandName)} </div> </div> <div class="rn-welcome-tagline"> ${c(o.welcomeMessage)} </div> <div class="rn-welcome-links"> <x-link class="devtools-link" href="https://reactnative.dev/docs/next/debugging"> ${c(o.docsLabel)} </x-link> <x-link class="devtools-link" href="https://reactnative.dev/blog/tags/debugging"> ${c(o.whatsNewLabel)} </x-link> </div> </div> `,this.contentElement,{host:this})}}var g=Object.freeze({__proto__:null,RNWelcomeImpl:d});export{g as RNWelcome};
|
||||
import*as e from"../../ui/legacy/legacy.js";import*as r from"../../core/i18n/i18n.js";import*as t from"../../ui/lit-html/lit-html.js";const o=new CSSStyleSheet;o.replaceSync('.rn-welcome-panel{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:16px;text-align:center;background-color:var(--color-background-elevation-0)}.rn-welcome-header{display:flex;align-items:center;margin-bottom:16px}.rn-welcome-icon{width:30px;height:30px;border-radius:4px;margin-right:12px}.rn-welcome-title{font-size:20px;color:var(--color-text-primary)}.rn-welcome-title-accessory{margin-left:12px;padding:4px 8px;border-radius:4px;background-color:var(--color-purple-bright);font-size:12px;color:var(--color-on-primary)}.rn-welcome-tagline{margin-bottom:24px;font-size:1rem;line-height:1.3;color:var(--color-text-secondary)}.rn-welcome-links{display:flex;align-items:center}.rn-welcome-links > .devtools-link{position:relative;margin:0 16px;font-size:14px}.rn-welcome-links > .devtools-link:not(:last-child)::after{content:"";position:absolute;right:-16px;height:16px;border-right:1px solid var(--color-details-hairline)}\n/*# sourceURL=rnWelcome.css */\n');const n={debuggerBrandName:"React Native JS Inspector",techPreviewLabel:"Technology Preview",welcomeMessage:"Welcome to debugging in React Native",docsLabel:"Debugging docs",whatsNewLabel:"What's new"},{render:i,html:l}=t,s=r.i18n.registerUIStrings("panels/rn_welcome/RNWelcome.ts",n),c=r.i18n.getLocalizedString.bind(void 0,s);let a;class d extends e.Widget.VBox{static instance(e={forceNew:null}){const{forceNew:r}=e;return a&&!r||(a=new d),a}constructor(){super(!0,!0)}wasShown(){super.wasShown(),this.registerCSSFiles([o]),this.render(),e.InspectorView.InspectorView.instance().showDrawer(!0)}render(){const e=new URL("../../Images/react_native/welcomeIcon.png",import.meta.url).toString();i(l` <div class="rn-welcome-panel"> <div class="rn-welcome-header"> <img class="rn-welcome-icon" src="${e}" role="presentation"> <div class="rn-welcome-title"> ${c(n.debuggerBrandName)} </div> <div class="rn-welcome-title-accessory"> ${c(n.techPreviewLabel)} </div> </div> <div class="rn-welcome-tagline"> ${c(n.welcomeMessage)} </div> <div class="rn-welcome-links"> <x-link class="devtools-link" href="https://reactnative.dev/docs/debugging"> ${c(n.docsLabel)} </x-link> <x-link class="devtools-link" href="https://reactnative.dev/blog"> ${c(n.whatsNewLabel)} </x-link> </div> </div> `,this.contentElement,{host:this})}}var m=Object.freeze({__proto__:null,RNWelcomeImpl:d});export{m as RNWelcome};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>DevTools</title>
|
||||
<title>DevTools (React Native)</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@@ -16,5 +16,6 @@
|
||||
</style>
|
||||
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="./Images/favicon.ico">
|
||||
<script type="module" src="./entrypoints/rn_inspector/rn_inspector.js"></script>
|
||||
<body class="undocked" id="-blink-dev-tools">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>DevTools</title>
|
||||
<title>DevTools (React Native)</title>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
@@ -16,5 +16,6 @@
|
||||
</style>
|
||||
<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="./Images/favicon.ico">
|
||||
<script type="module" src="./entrypoints/worker_app/worker_app.js"></script>
|
||||
<body class="undocked" id="-blink-dev-tools">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/debugger-frontend",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.2",
|
||||
"description": "Debugger frontend for React Native based on Chrome DevTools",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/dev-middleware",
|
||||
"version": "0.73.1",
|
||||
"version": "0.73.4",
|
||||
"description": "Dev server middleware for React Native",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -23,12 +23,13 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@isaacs/ttlcache": "^1.4.1",
|
||||
"@react-native/debugger-frontend": "^0.73.0",
|
||||
"@react-native/debugger-frontend": "^0.73.2",
|
||||
"chrome-launcher": "^0.15.2",
|
||||
"chromium-edge-launcher": "^1.0.0",
|
||||
"connect": "^3.6.5",
|
||||
"debug": "^2.2.0",
|
||||
"node-fetch": "^2.2.0",
|
||||
"open": "^7.0.3",
|
||||
"serve-static": "^1.13.1",
|
||||
"temp-dir": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -20,6 +20,7 @@ import connect from 'connect';
|
||||
import path from 'path';
|
||||
// $FlowFixMe[untyped-import] TODO: type serve-static
|
||||
import serveStaticMiddleware from 'serve-static';
|
||||
import deprecated_openFlipperMiddleware from './middleware/deprecated_openFlipperMiddleware';
|
||||
import openDebuggerMiddleware from './middleware/openDebuggerMiddleware';
|
||||
import InspectorProxy from './inspector-proxy/InspectorProxy';
|
||||
import DefaultBrowserLauncher from './utils/DefaultBrowserLauncher';
|
||||
@@ -86,14 +87,18 @@ export default function createDevMiddleware({
|
||||
const middleware = connect()
|
||||
.use(
|
||||
'/open-debugger',
|
||||
openDebuggerMiddleware({
|
||||
serverBaseUrl,
|
||||
inspectorProxy,
|
||||
browserLauncher: unstable_browserLauncher,
|
||||
eventReporter: unstable_eventReporter,
|
||||
experiments,
|
||||
logger,
|
||||
}),
|
||||
experiments.enableNewDebugger
|
||||
? openDebuggerMiddleware({
|
||||
serverBaseUrl,
|
||||
inspectorProxy,
|
||||
browserLauncher: unstable_browserLauncher,
|
||||
eventReporter: unstable_eventReporter,
|
||||
experiments,
|
||||
logger,
|
||||
})
|
||||
: deprecated_openFlipperMiddleware({
|
||||
logger,
|
||||
}),
|
||||
)
|
||||
.use(
|
||||
'/debugger-frontend',
|
||||
@@ -111,7 +116,7 @@ export default function createDevMiddleware({
|
||||
|
||||
function getExperiments(config: ExperimentsConfig): Experiments {
|
||||
return {
|
||||
enableCustomDebuggerFrontend: config.enableCustomDebuggerFrontend ?? false,
|
||||
enableNewDebugger: config.enableNewDebugger ?? false,
|
||||
enableOpenDebuggerRedirect: config.enableOpenDebuggerRedirect ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -94,12 +94,13 @@ export default class InspectorProxy implements InspectorProxyQueries {
|
||||
response: ServerResponse,
|
||||
next: (?Error) => mixed,
|
||||
) {
|
||||
const pathname = url.parse(request.url).pathname;
|
||||
if (
|
||||
request.url === PAGES_LIST_JSON_URL ||
|
||||
request.url === PAGES_LIST_JSON_URL_2
|
||||
pathname === PAGES_LIST_JSON_URL ||
|
||||
pathname === PAGES_LIST_JSON_URL_2
|
||||
) {
|
||||
this._sendJsonResponse(response, this.getPageDescriptions());
|
||||
} else if (request.url === PAGES_LIST_JSON_VERSION_URL) {
|
||||
} else if (pathname === PAGES_LIST_JSON_VERSION_URL) {
|
||||
this._sendJsonResponse(response, {
|
||||
Browser: 'Mobile JavaScript',
|
||||
'Protocol-Version': '1.1',
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import type {NextHandleFunction} from 'connect';
|
||||
import type {IncomingMessage, ServerResponse} from 'http';
|
||||
import type {Logger} from '../types/Logger';
|
||||
|
||||
import open from 'open';
|
||||
|
||||
const FLIPPER_SELF_CONNECT_URL =
|
||||
'flipper://null/Hermesdebuggerrn?device=React%20Native';
|
||||
|
||||
type Options = $ReadOnly<{
|
||||
logger?: Logger,
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Open the legacy Flipper debugger (Hermes).
|
||||
*
|
||||
* @deprecated This replicates the pre-0.73 workflow of opening Flipper via the
|
||||
* `flipper://` URL scheme, failing if Flipper is not installed locally. This
|
||||
* flow will be removed in a future version.
|
||||
*/
|
||||
export default function deprecated_openFlipperMiddleware({
|
||||
logger,
|
||||
}: Options): NextHandleFunction {
|
||||
return async (
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
next: (err?: Error) => void,
|
||||
) => {
|
||||
if (req.method === 'POST') {
|
||||
logger?.info('Launching JS debugger...');
|
||||
|
||||
try {
|
||||
logger?.warn(
|
||||
'Attempting to debug JS in Flipper (deprecated). This requires ' +
|
||||
'Flipper to be installed on your system to handle the ' +
|
||||
"'flipper://' URL scheme.",
|
||||
);
|
||||
await open(FLIPPER_SELF_CONNECT_URL);
|
||||
res.end();
|
||||
} catch (e) {
|
||||
logger?.error(
|
||||
'Error launching Flipper: ' + e.message ?? 'Unknown error',
|
||||
);
|
||||
res.writeHead(500);
|
||||
res.end();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -72,7 +72,7 @@ export default function openDebuggerMiddleware({
|
||||
if (typeof appId === 'string') {
|
||||
logger?.info(
|
||||
(launchType === 'launch' ? 'Launching' : 'Redirecting to') +
|
||||
' JS debugger...',
|
||||
' JS debugger (experimental)...',
|
||||
);
|
||||
target = targets.find(_target => _target.description === appId);
|
||||
} else {
|
||||
@@ -108,7 +108,6 @@ export default function openDebuggerMiddleware({
|
||||
getDevToolsFrontendUrl(
|
||||
target.webSocketDebuggerUrl,
|
||||
serverBaseUrl,
|
||||
experiments,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -120,7 +119,6 @@ export default function openDebuggerMiddleware({
|
||||
target.webSocketDebuggerUrl,
|
||||
// Use a relative URL.
|
||||
'',
|
||||
experiments,
|
||||
),
|
||||
});
|
||||
res.end();
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
|
||||
export type Experiments = $ReadOnly<{
|
||||
/**
|
||||
* Enables the use of the custom debugger frontend (@react-native/debugger-frontend)
|
||||
* in the /open-debugger endpoint.
|
||||
* Enables the new JS debugger launch flow and custom debugger frontend
|
||||
* (@react-native/debugger-frontend). When disabled, /open-debugger will
|
||||
* trigger the legacy Flipper connection flow.
|
||||
*/
|
||||
enableCustomDebuggerFrontend: boolean,
|
||||
enableNewDebugger: boolean,
|
||||
|
||||
/**
|
||||
* Enables the handling of GET requests in the /open-debugger endpoint,
|
||||
|
||||
@@ -9,40 +9,18 @@
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import type {Experiments} from '../types/Experiments';
|
||||
|
||||
/**
|
||||
* The Chrome DevTools frontend revision to use. This should be set to the
|
||||
* latest version known to be compatible with Hermes.
|
||||
*
|
||||
* Revision should be the full identifier from:
|
||||
* https://chromium.googlesource.com/chromium/src.git
|
||||
*/
|
||||
const DEVTOOLS_FRONTEND_REV = 'd9568d04d7dd79269c5a655d7ada69650c5a8336'; // Chrome 100.0.4896.75
|
||||
|
||||
/**
|
||||
* Construct the URL to Chrome DevTools connected to a given debugger target.
|
||||
* Get the DevTools frontend URL to debug a given React Native CDP target.
|
||||
*/
|
||||
export default function getDevToolsFrontendUrl(
|
||||
webSocketDebuggerUrl: string,
|
||||
devServerUrl: string,
|
||||
experiments: Experiments,
|
||||
): string {
|
||||
const scheme = new URL(webSocketDebuggerUrl).protocol.slice(0, -1);
|
||||
const webSocketUrlWithoutProtocol = webSocketDebuggerUrl.replace(
|
||||
/^wss?:\/\//,
|
||||
'',
|
||||
const appUrl = `${devServerUrl}/debugger-frontend/rn_inspector.html`;
|
||||
const webSocketUrlWithoutProtocol = encodeURIComponent(
|
||||
webSocketDebuggerUrl.replace(/^wss?:\/\//, ''),
|
||||
);
|
||||
|
||||
if (experiments.enableCustomDebuggerFrontend) {
|
||||
const urlBase = `${devServerUrl}/debugger-frontend/rn_inspector.html`;
|
||||
return `${urlBase}?${scheme}=${encodeURIComponent(
|
||||
webSocketUrlWithoutProtocol,
|
||||
)}&sources.hide_add_folder=true`;
|
||||
}
|
||||
|
||||
const urlBase = `https://chrome-devtools-frontend.appspot.com/serve_rev/@${DEVTOOLS_FRONTEND_REV}/devtools_app.html`;
|
||||
return `${urlBase}?panel=console&${scheme}=${encodeURIComponent(
|
||||
webSocketUrlWithoutProtocol,
|
||||
)}`;
|
||||
return `${appUrl}?${scheme}=${webSocketUrlWithoutProtocol}&sources.hide_add_folder=true`;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-config",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.1",
|
||||
"description": "ESLint config for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
"@babel/eslint-parser": "^7.20.0",
|
||||
"@react-native/eslint-plugin": "^0.73.0",
|
||||
"@react-native/eslint-plugin": "^0.73.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
||||
"@typescript-eslint/parser": "^5.57.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-plugin",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.1",
|
||||
"description": "ESLint rules for @react-native/eslint-config",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -9,7 +9,12 @@
|
||||
"directory": "packages/eslint-plugin-react-native"
|
||||
},
|
||||
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-plugin-react-native#readme",
|
||||
"keywords": ["eslint", "rules", "eslint-config", "react-native"],
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"rules",
|
||||
"eslint-config",
|
||||
"react-native"
|
||||
],
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-plugin-specs",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.1",
|
||||
"description": "ESLint rules to validate NativeModule and Component Specs",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -9,7 +9,14 @@
|
||||
"directory": "packages/eslint-plugin-specs"
|
||||
},
|
||||
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-plugin-specs#readme",
|
||||
"keywords": ["eslint", "rules", "react-native", "native-modules", "components", "specs"],
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"rules",
|
||||
"react-native",
|
||||
"native-modules",
|
||||
"components",
|
||||
"specs"
|
||||
],
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/metro-config",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.2",
|
||||
"description": "Metro configuration for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -9,16 +9,20 @@
|
||||
"directory": "packages/metro-config"
|
||||
},
|
||||
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/metro-config#readme",
|
||||
"keywords": ["metro", "config", "react-native"],
|
||||
"keywords": [
|
||||
"metro",
|
||||
"config",
|
||||
"react-native"
|
||||
],
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"exports": "./index.js",
|
||||
"dependencies": {
|
||||
"@react-native/metro-babel-transformer": "^0.73.11",
|
||||
"@react-native/js-polyfills": "^0.73.0",
|
||||
"metro-config": "0.79.1",
|
||||
"metro-runtime": "0.79.1"
|
||||
"@react-native/metro-babel-transformer": "^0.73.12",
|
||||
"@react-native/js-polyfills": "^0.73.1",
|
||||
"metro-config": "^0.80.0",
|
||||
"metro-runtime": "^0.80.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/normalize-colors",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.2",
|
||||
"description": "Color normalization for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -9,9 +9,11 @@
|
||||
"directory": "packages/normalize-color"
|
||||
},
|
||||
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/normalize-color#readme",
|
||||
"keywords": ["color", "normalization", "normalize-colors", "react-native"],
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
"keywords": [
|
||||
"color",
|
||||
"normalization",
|
||||
"normalize-colors",
|
||||
"react-native"
|
||||
],
|
||||
"bugs": "https://github.com/facebook/react-native/issues"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/js-polyfills",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.1",
|
||||
"description": "Polyfills for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -9,7 +9,13 @@
|
||||
"directory": "packages/polyfills"
|
||||
},
|
||||
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/polyfills#readme",
|
||||
"keywords": ["polyfill", "polyfills", "js", "js-polyfills", "react-native"],
|
||||
"keywords": [
|
||||
"polyfill",
|
||||
"polyfills",
|
||||
"js",
|
||||
"js-polyfills",
|
||||
"react-native"
|
||||
],
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/babel-preset",
|
||||
"version": "0.73.16",
|
||||
"version": "0.73.18",
|
||||
"description": "Babel preset for React Native applications",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/metro-babel-transformer",
|
||||
"version": "0.73.11",
|
||||
"version": "0.73.12",
|
||||
"description": "Babel transformer for React Native applications.",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/codegen",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.1",
|
||||
"description": "Code generation tools for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -66,6 +66,7 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
apiVersion = "1.5"
|
||||
// See comment above on JDK 11 support
|
||||
jvmTarget = "11"
|
||||
allWarningsAsErrors = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/gradle-plugin",
|
||||
"version": "0.73.0",
|
||||
"version": "0.73.3",
|
||||
"description": "Gradle Plugin for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -9,7 +9,11 @@
|
||||
"directory": "packages/react-native-gradle-plugin"
|
||||
},
|
||||
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-gradle-plugin#readme",
|
||||
"keywords": ["gradle", "plugin", "react-native"],
|
||||
"keywords": [
|
||||
"gradle",
|
||||
"plugin",
|
||||
"react-native"
|
||||
],
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
+7
-5
@@ -12,8 +12,10 @@ import com.android.build.gradle.internal.tasks.factory.dependsOn
|
||||
import com.facebook.react.internal.PrivateReactExtension
|
||||
import com.facebook.react.tasks.GenerateCodegenArtifactsTask
|
||||
import com.facebook.react.tasks.GenerateCodegenSchemaTask
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFields
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForApp
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForLibraries
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureDevPorts
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureNamespaceForLibraries
|
||||
import com.facebook.react.utils.BackwardCompatUtils.configureBackwardCompatibilityReactMap
|
||||
import com.facebook.react.utils.DependencyUtils.configureDependencies
|
||||
import com.facebook.react.utils.DependencyUtils.configureRepositories
|
||||
@@ -64,9 +66,10 @@ class ReactPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
configureReactNativeNdk(project, extension)
|
||||
configureBuildConfigFields(project, extension)
|
||||
configureBuildConfigFieldsForApp(project, extension)
|
||||
configureDevPorts(project)
|
||||
configureBackwardCompatibilityReactMap(project)
|
||||
configureJavaToolChains(project)
|
||||
|
||||
project.extensions.getByType(AndroidComponentsExtension::class.java).apply {
|
||||
onVariants(selector().all()) { variant ->
|
||||
@@ -77,12 +80,11 @@ class ReactPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
// Library Only Configuration
|
||||
configureBuildConfigFieldsForLibraries(project)
|
||||
configureNamespaceForLibraries(project)
|
||||
project.pluginManager.withPlugin("com.android.library") {
|
||||
configureCodegen(project, extension, rootExtension, isLibrary = true)
|
||||
}
|
||||
|
||||
// Library and App Configurations
|
||||
configureJavaToolChains(project)
|
||||
}
|
||||
|
||||
private fun checkJvmVersion(project: Project) {
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio
|
||||
val targetName = variant.name.capitalizeCompat()
|
||||
val targetPath = variant.name
|
||||
|
||||
val buildDir = this.layout.buildDirectory.get().asFile
|
||||
// Resources: generated/assets/react/<variant>/index.android.bundle
|
||||
val resourcesDir = File(buildDir, "generated/res/react/$targetPath")
|
||||
// Bundle: generated/assets/react/<variant>/index.android.bundle
|
||||
|
||||
+53
-1
@@ -8,17 +8,22 @@
|
||||
package com.facebook.react.utils
|
||||
|
||||
import com.android.build.api.variant.AndroidComponentsExtension
|
||||
import com.android.build.gradle.LibraryExtension
|
||||
import com.facebook.react.ReactExtension
|
||||
import com.facebook.react.utils.ProjectUtils.isHermesEnabled
|
||||
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled
|
||||
import java.io.File
|
||||
import javax.xml.parsers.DocumentBuilder
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.AppliedPlugin
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Suppress("UnstableApiUsage")
|
||||
internal object AgpConfiguratorUtils {
|
||||
|
||||
fun configureBuildConfigFields(project: Project, extension: ReactExtension) {
|
||||
fun configureBuildConfigFieldsForApp(project: Project, extension: ReactExtension) {
|
||||
val action =
|
||||
Action<AppliedPlugin> {
|
||||
project.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext ->
|
||||
@@ -35,6 +40,16 @@ internal object AgpConfiguratorUtils {
|
||||
project.pluginManager.withPlugin("com.android.library", action)
|
||||
}
|
||||
|
||||
fun configureBuildConfigFieldsForLibraries(appProject: Project) {
|
||||
appProject.rootProject.allprojects { subproject ->
|
||||
subproject.pluginManager.withPlugin("com.android.library") {
|
||||
subproject.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext ->
|
||||
ext.buildFeatures.buildConfig = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun configureDevPorts(project: Project) {
|
||||
val devServerPort =
|
||||
project.properties["reactNativeDevServerPort"]?.toString() ?: DEFAULT_DEV_SERVER_PORT
|
||||
@@ -53,6 +68,43 @@ internal object AgpConfiguratorUtils {
|
||||
project.pluginManager.withPlugin("com.android.application", action)
|
||||
project.pluginManager.withPlugin("com.android.library", action)
|
||||
}
|
||||
|
||||
fun configureNamespaceForLibraries(appProject: Project) {
|
||||
appProject.rootProject.allprojects { subproject ->
|
||||
subproject.pluginManager.withPlugin("com.android.library") {
|
||||
subproject.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext ->
|
||||
if (ext.namespace == null) {
|
||||
val android = subproject.extensions.getByType(LibraryExtension::class.java)
|
||||
val manifestFile = android.sourceSets.getByName("main").manifest.srcFile
|
||||
|
||||
manifestFile
|
||||
.takeIf { it.exists() }
|
||||
?.let { file ->
|
||||
getPackageNameFromManifest(file)?.let { packageName ->
|
||||
ext.namespace = packageName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const val DEFAULT_DEV_SERVER_PORT = "8081"
|
||||
|
||||
fun getPackageNameFromManifest(manifest: File): String? {
|
||||
val factory: DocumentBuilderFactory = DocumentBuilderFactory.newInstance()
|
||||
val builder: DocumentBuilder = factory.newDocumentBuilder()
|
||||
|
||||
try {
|
||||
val xmlDocument = builder.parse(manifest)
|
||||
|
||||
val manifestElement = xmlDocument.getElementsByTagName("manifest").item(0) as? Element
|
||||
val packageName = manifestElement?.getAttribute("package")
|
||||
|
||||
return if (packageName.isNullOrEmpty()) null else packageName
|
||||
} catch (e: Exception) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.utils
|
||||
|
||||
import java.io.File
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
|
||||
class AgpConfiguratorUtilsTest {
|
||||
|
||||
@get:Rule val tempFolder = TemporaryFolder()
|
||||
|
||||
@Test
|
||||
fun getPackageNameFromManifest_withEmptyFile_returnsNull() {
|
||||
val mainFolder = tempFolder.newFolder("awesome-module/src/main/")
|
||||
val manifest = File(mainFolder, "AndroidManifest.xml").apply { writeText("") }
|
||||
|
||||
val actual = getPackageNameFromManifest(manifest)
|
||||
assertNull(actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPackageNameFromManifest_withMissingPackage_returnsNull() {
|
||||
val mainFolder = tempFolder.newFolder("awesome-module/src/main/")
|
||||
val manifest =
|
||||
File(mainFolder, "AndroidManifest.xml").apply {
|
||||
writeText(
|
||||
// language=xml
|
||||
"""
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
</manifest>
|
||||
"""
|
||||
.trimIndent())
|
||||
}
|
||||
|
||||
val actual = getPackageNameFromManifest(manifest)
|
||||
assertNull(actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPackageNameFromManifest_withPackage_returnsPackage() {
|
||||
val mainFolder = tempFolder.newFolder("awesome-module/src/main/")
|
||||
val manifest =
|
||||
File(mainFolder, "AndroidManifest.xml").apply {
|
||||
writeText(
|
||||
// language=xml
|
||||
"""
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.facebook.react" >
|
||||
</manifest>
|
||||
"""
|
||||
.trimIndent())
|
||||
}
|
||||
|
||||
val actual = getPackageNameFromManifest(manifest)
|
||||
assertNotNull(actual)
|
||||
assertEquals("com.facebook.react", actual)
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ function createAnimatedStyle(
|
||||
const animatedStyles: any = {};
|
||||
for (const key in style) {
|
||||
const value = style[key];
|
||||
if (key === 'transform') {
|
||||
if (value != null && key === 'transform') {
|
||||
animatedStyles[key] =
|
||||
ReactNativeFeatureFlags.shouldUseAnimatedObjectForTransform()
|
||||
? new AnimatedObject(value)
|
||||
|
||||
@@ -87,6 +87,13 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
|
||||
if (enableBridgeless) {
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
// Enable native view config interop only if both bridgeless mode and Fabric is enabled.
|
||||
RCTSetUseNativeViewConfigsInBridgelessMode([self fabricEnabled]);
|
||||
|
||||
// Enable TurboModule interop by default in Bridgeless mode
|
||||
RCTEnableTurboModuleInterop(YES);
|
||||
RCTEnableTurboModuleInteropBridgeProxy(YES);
|
||||
|
||||
[self createReactHost];
|
||||
[self unstable_registerLegacyComponents];
|
||||
[RCTComponentViewFactory currentComponentViewFactory].thirdPartyFabricComponentsProvider = self;
|
||||
@@ -185,7 +192,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
interfaceOrientation:(UIInterfaceOrientation)previousInterfaceOrientation
|
||||
traitCollection:(UITraitCollection *)previousTraitCollection API_AVAILABLE(ios(13.0))
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTRootViewFrameDidChangeNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTWindowFrameDidChangeNotification object:self];
|
||||
}
|
||||
|
||||
#pragma mark - RCTCxxBridgeDelegate
|
||||
|
||||
@@ -117,15 +117,19 @@ Pod::Spec.new do |s|
|
||||
s.dependency "React-debug"
|
||||
s.dependency "React-rendererdebug"
|
||||
|
||||
rel_path_from_pods_root_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(Pod::Config.instance.installation_root)
|
||||
rel_path_from_pods_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(File.join(Pod::Config.instance.installation_root, 'Pods'))
|
||||
|
||||
|
||||
s.script_phases = {
|
||||
:name => "Generate Legacy Components Interop",
|
||||
:script => "
|
||||
WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"
|
||||
source $WITH_ENVIRONMENT
|
||||
${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{ENV['APP_PATH']} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
|
||||
${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{rel_path_from_pods_to_app} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
|
||||
",
|
||||
:execution_position => :before_compile,
|
||||
:input_files => ["#{ENV['APP_PATH']}/react-native.config.js"],
|
||||
:input_files => ["#{rel_path_from_pods_root_to_app}/react-native.config.js"],
|
||||
:output_files => ["${REACT_NATIVE_PATH}/Libraries/AppDelegate/RCTLegacyInteropComponents.mm"],
|
||||
}
|
||||
end
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
*/
|
||||
|
||||
exports.version = {
|
||||
major: 1000,
|
||||
minor: 0,
|
||||
major: 0,
|
||||
minor: 73,
|
||||
patch: 0,
|
||||
prerelease: null,
|
||||
prerelease: 'rc.4',
|
||||
};
|
||||
|
||||
@@ -40,7 +40,9 @@ exports.checkVersions = function checkVersions(): void {
|
||||
};
|
||||
|
||||
function _formatVersion(
|
||||
version: (typeof Platform)['constants']['reactNativeVersion'],
|
||||
version:
|
||||
| (typeof Platform)['constants']['reactNativeVersion']
|
||||
| {major: number, minor: number, patch: number, prerelease: ?string},
|
||||
): string {
|
||||
return (
|
||||
`${version.major}.${version.minor}.${version.patch}` +
|
||||
|
||||
@@ -30,6 +30,7 @@ export type LogData = $ReadOnly<{|
|
||||
message: Message,
|
||||
category: Category,
|
||||
componentStack: ComponentStack,
|
||||
stack?: string,
|
||||
|}>;
|
||||
|
||||
export type Observer = (
|
||||
@@ -198,7 +199,7 @@ export function addLog(log: LogData): void {
|
||||
// otherwise spammy logs would pause rendering.
|
||||
setImmediate(() => {
|
||||
try {
|
||||
const stack = parseErrorStack(errorForStackTrace?.stack);
|
||||
const stack = parseErrorStack(log.stack ?? errorForStackTrace?.stack);
|
||||
|
||||
appendNewLog(
|
||||
new LogBoxLog({
|
||||
|
||||
+10
-4
@@ -55,14 +55,20 @@ export function get<Config>(
|
||||
): HostComponent<Config> {
|
||||
ReactNativeViewConfigRegistry.register(name, () => {
|
||||
const {native, strict, verify} = getRuntimeConfig?.(name) ?? {
|
||||
native: true,
|
||||
native: !global.RN$Bridgeless,
|
||||
strict: false,
|
||||
verify: false,
|
||||
};
|
||||
|
||||
const viewConfig = native
|
||||
? getNativeComponentAttributes(name)
|
||||
: createViewConfig(viewConfigProvider());
|
||||
let viewConfig;
|
||||
if (native) {
|
||||
viewConfig = getNativeComponentAttributes(name);
|
||||
} else {
|
||||
viewConfig = createViewConfig(viewConfigProvider());
|
||||
if (viewConfig == null) {
|
||||
viewConfig = getNativeComponentAttributes(name);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify) {
|
||||
const nativeViewConfig = native
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
import type {RootTag} from '../Types/RootTagTypes';
|
||||
|
||||
import {unstable_hasComponent} from '../NativeComponent/NativeComponentRegistryUnstable';
|
||||
import ReactNativeFeatureFlags from './ReactNativeFeatureFlags';
|
||||
|
||||
let cachedConstants = null;
|
||||
|
||||
@@ -22,6 +21,10 @@ const errorMessageForMethod = (methodName: string): string =>
|
||||
methodName +
|
||||
"' is not available in the new React Native architecture.";
|
||||
|
||||
function nativeViewConfigsInBridgelessModeEnabled(): boolean {
|
||||
return global.RN$LegacyInterop_UIManager_getConstants !== undefined;
|
||||
}
|
||||
|
||||
function getCachedConstants(): Object {
|
||||
if (!cachedConstants) {
|
||||
cachedConstants = global.RN$LegacyInterop_UIManager_getConstants();
|
||||
@@ -31,7 +34,7 @@ function getCachedConstants(): Object {
|
||||
|
||||
const UIManagerJS: {[string]: $FlowFixMe} = {
|
||||
getViewManagerConfig: (viewManagerName: string): mixed => {
|
||||
if (ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode()) {
|
||||
if (nativeViewConfigsInBridgelessModeEnabled()) {
|
||||
return getCachedConstants()[viewManagerName];
|
||||
} else {
|
||||
console.error(
|
||||
@@ -46,7 +49,7 @@ const UIManagerJS: {[string]: $FlowFixMe} = {
|
||||
return unstable_hasComponent(viewManagerName);
|
||||
},
|
||||
getConstants: (): Object => {
|
||||
if (ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode()) {
|
||||
if (nativeViewConfigsInBridgelessModeEnabled()) {
|
||||
return getCachedConstants();
|
||||
} else {
|
||||
console.error(errorMessageForMethod('getConstants'));
|
||||
@@ -179,7 +182,7 @@ const UIManagerJS: {[string]: $FlowFixMe} = {
|
||||
console.error(errorMessageForMethod('dismissPopupMenu')),
|
||||
};
|
||||
|
||||
if (ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode()) {
|
||||
if (nativeViewConfigsInBridgelessModeEnabled()) {
|
||||
Object.keys(getCachedConstants()).forEach(viewConfigName => {
|
||||
UIManagerJS[viewConfigName] = getCachedConstants()[viewConfigName];
|
||||
});
|
||||
|
||||
@@ -54,10 +54,6 @@ export type FeatureFlags = {|
|
||||
* Enables use of setNativeProps in JS driven animations.
|
||||
*/
|
||||
shouldUseSetNativePropsInFabric: () => boolean,
|
||||
/**
|
||||
* Enables native view configs in brdgeless mode.
|
||||
*/
|
||||
enableNativeViewConfigsInBridgelessMode: () => boolean,
|
||||
/**
|
||||
* Enables a hotfix for forcing materialization of views with elevation set.
|
||||
*/
|
||||
@@ -74,7 +70,6 @@ const ReactNativeFeatureFlags: FeatureFlags = {
|
||||
enableAccessToHostTreeInFabric: () => false,
|
||||
shouldUseAnimatedObjectForTransform: () => false,
|
||||
shouldUseSetNativePropsInFabric: () => false,
|
||||
enableNativeViewConfigsInBridgelessMode: () => false,
|
||||
shouldForceUnflattenForElevation: () => false,
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
import typeof {enable} from 'promise/setimmediate/rejection-tracking';
|
||||
|
||||
import LogBox from './LogBox/LogBox';
|
||||
|
||||
let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
|
||||
allRejections: true,
|
||||
onUnhandled: (id, rejection = {}) => {
|
||||
@@ -34,17 +36,29 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
|
||||
}
|
||||
}
|
||||
|
||||
const warning =
|
||||
`Possible Unhandled Promise Rejection (id: ${id}):\n` +
|
||||
`${message ?? ''}\n` +
|
||||
(stack == null ? '' : stack);
|
||||
console.warn(warning);
|
||||
const warning = `Possible unhandled promise rejection (id: ${id}):\n${
|
||||
message ?? ''
|
||||
}`;
|
||||
if (__DEV__) {
|
||||
LogBox.addLog({
|
||||
level: 'warn',
|
||||
message: {
|
||||
content: warning,
|
||||
substitutions: [],
|
||||
},
|
||||
componentStack: [],
|
||||
stack,
|
||||
category: 'possible_unhandled_promise_rejection',
|
||||
});
|
||||
} else {
|
||||
console.warn(warning);
|
||||
}
|
||||
},
|
||||
onHandled: id => {
|
||||
const warning =
|
||||
`Promise Rejection Handled (id: ${id})\n` +
|
||||
`Promise rejection handled (id: ${id})\n` +
|
||||
'This means you can ignore any previous messages of the form ' +
|
||||
`"Possible Unhandled Promise Rejection (id: ${id}):"`;
|
||||
`"Possible unhandled promise rejection (id: ${id}):"`;
|
||||
console.warn(warning);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ end
|
||||
|
||||
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32'
|
||||
folly_version = '2022.05.16.00'
|
||||
socket_rocket_version = '0.6.0'
|
||||
socket_rocket_version = '0.6.1'
|
||||
boost_compiler_flags = '-Wno-documentation'
|
||||
|
||||
use_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1'
|
||||
|
||||
@@ -351,6 +351,11 @@ using namespace facebook;
|
||||
return (RCTUIManager *)_uiManagerProxy;
|
||||
}
|
||||
|
||||
- (RCTBridgeProxy *)object
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* NSProxy setup
|
||||
*/
|
||||
@@ -387,12 +392,14 @@ using namespace facebook;
|
||||
|
||||
@implementation RCTUIManagerProxy {
|
||||
RCTViewRegistry *_viewRegistry;
|
||||
NSMutableDictionary<NSNumber *, UIView *> *_legacyViewRegistry;
|
||||
}
|
||||
- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
|
||||
{
|
||||
self = [super self];
|
||||
if (self) {
|
||||
_viewRegistry = viewRegistry;
|
||||
_legacyViewRegistry = [NSMutableDictionary new];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -404,20 +411,21 @@ using namespace facebook;
|
||||
{
|
||||
[self logWarning:@"Please migrate to RCTViewRegistry: @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED."
|
||||
cmd:_cmd];
|
||||
return [_viewRegistry viewForReactTag:reactTag];
|
||||
return [_viewRegistry viewForReactTag:reactTag] ? [_viewRegistry viewForReactTag:reactTag]
|
||||
: [_legacyViewRegistry objectForKey:reactTag];
|
||||
}
|
||||
|
||||
- (void)addUIBlock:(RCTViewManagerUIBlock)block
|
||||
{
|
||||
[self
|
||||
logWarning:
|
||||
@"This method isn't implemented faithfully: the viewRegistry passed to RCTViewManagerUIBlock is nil. Please migrate to RCTViewRegistry: @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED."
|
||||
@"This method isn't implemented faithfully. Please migrate to RCTViewRegistry if possible: @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED."
|
||||
cmd:_cmd];
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
RCTExecuteOnMainQueue(^{
|
||||
__typeof(self) strongSelf = weakSelf;
|
||||
if (strongSelf) {
|
||||
block((RCTUIManager *)strongSelf, nil);
|
||||
block((RCTUIManager *)strongSelf, strongSelf->_legacyViewRegistry);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ RCT_EXTERN NSString *const RCTPlatformName;
|
||||
RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotification;
|
||||
RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey;
|
||||
|
||||
RCT_EXTERN NSString *const RCTRootViewFrameDidChangeNotification;
|
||||
RCT_EXTERN NSString *const RCTWindowFrameDidChangeNotification;
|
||||
|
||||
/**
|
||||
* This notification fires when the bridge initializes.
|
||||
|
||||
@@ -12,7 +12,7 @@ NSString *const RCTPlatformName = @"ios";
|
||||
NSString *const RCTUserInterfaceStyleDidChangeNotification = @"RCTUserInterfaceStyleDidChangeNotification";
|
||||
NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey = @"traitCollection";
|
||||
|
||||
NSString *const RCTRootViewFrameDidChangeNotification = @"RCTRootViewFrameDidChangeNotification";
|
||||
NSString *const RCTWindowFrameDidChangeNotification = @"RCTWindowFrameDidChangeNotification";
|
||||
|
||||
NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification";
|
||||
NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification";
|
||||
|
||||
@@ -21,10 +21,10 @@ NSDictionary* RCTGetReactNativeVersion(void)
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^(void){
|
||||
__rnVersion = @{
|
||||
RCTVersionMajor: @(1000),
|
||||
RCTVersionMinor: @(0),
|
||||
RCTVersionMajor: @(0),
|
||||
RCTVersionMinor: @(73),
|
||||
RCTVersionPatch: @(0),
|
||||
RCTVersionPrerelease: [NSNull null],
|
||||
RCTVersionPrerelease: @"rc.4",
|
||||
};
|
||||
});
|
||||
return __rnVersion;
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
*/
|
||||
@property (nonatomic, assign) YGDirection baseDirection;
|
||||
|
||||
- (void)layoutWithAffectedShadowViews:(NSHashTable<RCTShadowView *> *)affectedShadowViews;
|
||||
- (void)layoutWithAffectedShadowViews:(NSPointerArray *)affectedShadowViews;
|
||||
|
||||
@end
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)layoutWithAffectedShadowViews:(NSHashTable<RCTShadowView *> *)affectedShadowViews
|
||||
- (void)layoutWithAffectedShadowViews:(NSPointerArray *)affectedShadowViews
|
||||
{
|
||||
NSHashTable<NSString *> *other = [NSHashTable new];
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(interfaceFrameDidChange)
|
||||
name:RCTRootViewFrameDidChangeNotification
|
||||
name:RCTWindowFrameDidChangeNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ end
|
||||
|
||||
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32'
|
||||
folly_version = '2022.05.16.00'
|
||||
socket_rocket_version = '0.6.0'
|
||||
socket_rocket_version = '0.6.1'
|
||||
|
||||
header_search_paths = [
|
||||
"\"$(PODS_TARGET_SRCROOT)/React/CoreModules\"",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import <React/RCTBridgeProxy.h>
|
||||
#import <React/RCTInvalidating.h>
|
||||
#import <React/RCTRootView.h>
|
||||
#import <React/RCTViewManager.h>
|
||||
@@ -173,6 +174,12 @@ RCT_EXTERN NSString *const RCTUIManagerWillUpdateViewsDueToContentSizeMultiplier
|
||||
|
||||
@end
|
||||
|
||||
@interface RCTBridgeProxy (RCTUIManager)
|
||||
|
||||
@property (nonatomic, readonly) RCTUIManager *uiManager;
|
||||
|
||||
@end
|
||||
|
||||
RCT_EXTERN NSMutableDictionary<NSString *, id> *RCTModuleConstantsForDestructuredComponent(
|
||||
NSMutableDictionary<NSString *, NSDictionary *> *directEvents,
|
||||
NSMutableDictionary<NSString *, NSDictionary *> *bubblingEvents,
|
||||
|
||||
@@ -534,7 +534,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
|
||||
{
|
||||
RCTAssertUIManagerQueue();
|
||||
|
||||
NSHashTable<RCTShadowView *> *affectedShadowViews = [NSHashTable weakObjectsHashTable];
|
||||
NSPointerArray *affectedShadowViews = [NSPointerArray weakObjectsPointerArray];
|
||||
[rootShadowView layoutWithAffectedShadowViews:affectedShadowViews];
|
||||
|
||||
if (!affectedShadowViews.count) {
|
||||
@@ -1489,9 +1489,10 @@ NSMutableDictionary<NSString *, id> *RCTModuleConstantsForDestructuredComponent(
|
||||
// lazifyViewManagerConfig function in JS. This fuction uses NativeModules global object that is not available in the
|
||||
// New Architecture. To make native view configs work in the New Architecture we will populate these properties in
|
||||
// native.
|
||||
moduleConstants[@"Commands"] = viewConfig[@"Commands"];
|
||||
moduleConstants[@"Constants"] = viewConfig[@"Constants"];
|
||||
|
||||
if (RCTGetUseNativeViewConfigsInBridgelessMode()) {
|
||||
moduleConstants[@"Commands"] = viewConfig[@"Commands"];
|
||||
moduleConstants[@"Constants"] = viewConfig[@"Constants"];
|
||||
}
|
||||
// Add direct events
|
||||
for (NSString *eventName in viewConfig[@"directEvents"]) {
|
||||
if (!directEvents[eventName]) {
|
||||
|
||||
@@ -25,7 +25,7 @@ extern __attribute__((visibility("default"))) RCTDimensions RCTGetDimensions(CGF
|
||||
|
||||
// Get font size multiplier for font base size (Large) by content size category
|
||||
extern __attribute__((visibility("default"))) CGFloat RCTGetMultiplierForContentSizeCategory(
|
||||
UIContentSizeCategory category);
|
||||
UIContentSizeCategory category) __deprecated;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ static SEL selectorForType(NSString *type)
|
||||
object:nil
|
||||
userInfo:@{@"module" : _bridgelessViewManager}];
|
||||
}
|
||||
return _manager ?: _bridgelessViewManager;
|
||||
return _manager ? _manager : _bridgelessViewManager;
|
||||
}
|
||||
|
||||
RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
||||
@@ -480,11 +480,6 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
}
|
||||
}
|
||||
|
||||
NSDictionary<NSString *, NSNumber *> *commands = [self commandsForViewMangerClass:managerClass
|
||||
methods:methods
|
||||
methodCount:count];
|
||||
free(methods);
|
||||
|
||||
#if RCT_DEBUG
|
||||
for (NSString *event in bubblingEvents) {
|
||||
if ([directEvents containsObject:event]) {
|
||||
@@ -499,15 +494,22 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
|
||||
Class superClass = [managerClass superclass];
|
||||
|
||||
return @{
|
||||
NSMutableDictionary *result = [[NSMutableDictionary alloc] initWithDictionary:@{
|
||||
@"propTypes" : propTypes,
|
||||
@"directEvents" : directEvents,
|
||||
@"bubblingEvents" : bubblingEvents,
|
||||
@"capturingEvents" : capturingEvents,
|
||||
@"baseModuleName" : superClass == [NSObject class] ? (id)kCFNull : RCTViewManagerModuleNameForClass(superClass),
|
||||
@"Commands" : commands,
|
||||
@"Constants" : [self constantsForViewMangerClass:managerClass],
|
||||
};
|
||||
}];
|
||||
|
||||
if (RCTGetUseNativeViewConfigsInBridgelessMode()) {
|
||||
result[@"Commands"] = [self commandsForViewMangerClass:managerClass methods:methods methodCount:count];
|
||||
result[@"Constants"] = [self constantsForViewMangerClass:managerClass];
|
||||
}
|
||||
|
||||
free(methods);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSDictionary<NSString *, id> *)viewConfig
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics;
|
||||
|
||||
struct RCTLayoutContext {
|
||||
CGPoint absolutePosition;
|
||||
__unsafe_unretained NSHashTable<RCTShadowView *> *_Nonnull affectedShadowViews;
|
||||
__unsafe_unretained NSPointerArray *_Nonnull affectedShadowViews;
|
||||
__unsafe_unretained NSHashTable<NSString *> *_Nonnull other;
|
||||
};
|
||||
typedef struct CG_BOXABLE RCTLayoutContext RCTLayoutContext;
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
*/
|
||||
@property (nonatomic, assign) YGDirection baseDirection;
|
||||
|
||||
- (void)layoutWithAffectedShadowViews:(NSHashTable<RCTShadowView *> *)affectedShadowViews;
|
||||
- (void)layoutWithAffectedShadowViews:(NSPointerArray *)affectedShadowViews;
|
||||
|
||||
@end
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutWithAffectedShadowViews:(NSHashTable<RCTShadowView *> *)affectedShadowViews
|
||||
- (void)layoutWithAffectedShadowViews:(NSPointerArray *)affectedShadowViews
|
||||
{
|
||||
NSHashTable<NSString *> *other = [NSHashTable new];
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
|
||||
{
|
||||
if (!RCTLayoutMetricsEqualToLayoutMetrics(self.layoutMetrics, layoutMetrics)) {
|
||||
self.layoutMetrics = layoutMetrics;
|
||||
[layoutContext.affectedShadowViews addObject:self];
|
||||
[layoutContext.affectedShadowViews addPointer:((__bridge void *)self)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1058,7 +1058,7 @@ RCT_SET_AND_PRESERVE_OFFSET(setScrollIndicatorInsets, scrollIndicatorInsets, UIE
|
||||
}
|
||||
|
||||
CGPoint offset = scrollView.contentOffset;
|
||||
if ([UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) {
|
||||
if ([self reactLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft) {
|
||||
offset.x = scrollView.contentSize.width - scrollView.frame.size.width - offset.x;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,10 @@
|
||||
self.center = position;
|
||||
self.bounds = bounds;
|
||||
|
||||
updateTransform(self);
|
||||
id transformOrigin = objc_getAssociatedObject(self, @selector(reactTransformOrigin));
|
||||
if (transformOrigin) {
|
||||
updateTransform(self);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Transforms
|
||||
@@ -242,31 +245,35 @@
|
||||
|
||||
static void updateTransform(UIView *view)
|
||||
{
|
||||
CGSize size = view.bounds.size;
|
||||
RCTTransformOrigin transformOrigin = view.reactTransformOrigin;
|
||||
CATransform3D transform;
|
||||
id rawTansformOrigin = objc_getAssociatedObject(view, @selector(reactTransformOrigin));
|
||||
if (rawTansformOrigin) {
|
||||
CGSize size = view.bounds.size;
|
||||
CGFloat anchorPointX = 0;
|
||||
CGFloat anchorPointY = 0;
|
||||
CGFloat anchorPointZ = 0;
|
||||
RCTTransformOrigin transformOrigin;
|
||||
[rawTansformOrigin getValue:&transformOrigin];
|
||||
if (transformOrigin.x.unit == YGUnitPoint) {
|
||||
anchorPointX = transformOrigin.x.value - size.width * 0.5;
|
||||
} else if (transformOrigin.x.unit == YGUnitPercent) {
|
||||
anchorPointX = (transformOrigin.x.value * 0.01 - 0.5) * size.width;
|
||||
}
|
||||
|
||||
CGFloat anchorPointX = 0;
|
||||
CGFloat anchorPointY = 0;
|
||||
CGFloat anchorPointZ = 0;
|
||||
|
||||
if (transformOrigin.x.unit == YGUnitPoint) {
|
||||
anchorPointX = transformOrigin.x.value - size.width * 0.5;
|
||||
} else if (transformOrigin.x.unit == YGUnitPercent) {
|
||||
anchorPointX = (transformOrigin.x.value * 0.01 - 0.5) * size.width;
|
||||
if (transformOrigin.y.unit == YGUnitPoint) {
|
||||
anchorPointY = transformOrigin.y.value - size.height * 0.5;
|
||||
} else if (transformOrigin.y.unit == YGUnitPercent) {
|
||||
anchorPointY = (transformOrigin.y.value * 0.01 - 0.5) * size.height;
|
||||
}
|
||||
anchorPointZ = transformOrigin.z;
|
||||
transform = CATransform3DConcat(
|
||||
view.reactTransform, CATransform3DMakeTranslation(anchorPointX, anchorPointY, anchorPointZ));
|
||||
transform =
|
||||
CATransform3DConcat(CATransform3DMakeTranslation(-anchorPointX, -anchorPointY, -anchorPointZ), transform);
|
||||
} else {
|
||||
transform = view.reactTransform;
|
||||
}
|
||||
|
||||
if (transformOrigin.y.unit == YGUnitPoint) {
|
||||
anchorPointY = transformOrigin.y.value - size.height * 0.5;
|
||||
} else if (transformOrigin.y.unit == YGUnitPercent) {
|
||||
anchorPointY = (transformOrigin.y.value * 0.01 - 0.5) * size.height;
|
||||
}
|
||||
|
||||
anchorPointZ = transformOrigin.z;
|
||||
|
||||
CATransform3D transform = CATransform3DMakeTranslation(anchorPointX, anchorPointY, anchorPointZ);
|
||||
transform = CATransform3DConcat(view.reactTransform, transform);
|
||||
transform = CATransform3DTranslate(transform, -anchorPointX, -anchorPointY, -anchorPointZ);
|
||||
|
||||
view.layer.transform = transform;
|
||||
// Enable edge antialiasing in rotation, skew, or perspective transforms
|
||||
view.layer.allowsEdgeAntialiasing = transform.m12 != 0.0f || transform.m21 != 0.0f || transform.m34 != 0.0f;
|
||||
|
||||
+4
@@ -21,6 +21,7 @@ import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPl
|
||||
import com.facebook.react.ReactInstanceEventListener
|
||||
import com.facebook.react.ReactInstanceManager
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.config.ReactFeatureFlags
|
||||
import com.facebook.react.modules.network.NetworkingModule
|
||||
|
||||
/**
|
||||
@@ -30,6 +31,9 @@ import com.facebook.react.modules.network.NetworkingModule
|
||||
object ReactNativeFlipper {
|
||||
@JvmStatic
|
||||
fun initializeFlipper(context: Context, reactInstanceManager: ReactInstanceManager) {
|
||||
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
||||
return
|
||||
}
|
||||
if (FlipperUtils.shouldEnableFlipper(context)) {
|
||||
val client = AndroidFlipperClient.getInstance(context)
|
||||
client.addPlugin(InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=1000.0.0
|
||||
VERSION_NAME=0.73.0-rc.4
|
||||
react.internal.publishingGroup=com.facebook.react
|
||||
|
||||
android.useAndroidX=true
|
||||
|
||||
-1
@@ -19,7 +19,6 @@ import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.react.interfaces.ReactHost;
|
||||
import com.facebook.react.modules.core.PermissionListener;
|
||||
|
||||
/**
|
||||
|
||||
-1
@@ -8,7 +8,6 @@
|
||||
package com.facebook.react
|
||||
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
||||
import com.facebook.react.interfaces.ReactHost
|
||||
|
||||
@OptIn(UnstableReactNativeAPI::class)
|
||||
/** Interface that represents an instance of a React Native application */
|
||||
|
||||
@@ -16,7 +16,6 @@ import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.react.devsupport.DoubleTapReloadRecognizer;
|
||||
import com.facebook.react.interfaces.ReactHost;
|
||||
import com.facebook.react.interfaces.fabric.ReactSurface;
|
||||
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
||||
|
||||
|
||||
+2
-3
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.interfaces
|
||||
package com.facebook.react
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
@@ -13,8 +13,8 @@ import android.os.Bundle
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.bridge.queue.ReactQueueConfiguration
|
||||
import com.facebook.react.common.LifecycleState
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
||||
import com.facebook.react.interfaces.TaskInterface
|
||||
import com.facebook.react.interfaces.fabric.ReactSurface
|
||||
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
|
||||
*
|
||||
* The implementation of this interface should be Thread Safe
|
||||
*/
|
||||
@UnstableReactNativeAPI
|
||||
interface ReactHost {
|
||||
|
||||
/** The current [LifecycleState] for React Host */
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class ReactContext extends ContextWrapper {
|
||||
private @Nullable JSExceptionHandler mExceptionHandlerWrapper;
|
||||
private @Nullable WeakReference<Activity> mCurrentActivity;
|
||||
|
||||
private @Nullable InteropModuleRegistry mInteropModuleRegistry;
|
||||
protected @Nullable InteropModuleRegistry mInteropModuleRegistry;
|
||||
private boolean mIsInitialized = false;
|
||||
|
||||
public ReactContext(Context base) {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
package com.facebook.react.common.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@RequiresOptIn(
|
||||
level = RequiresOptIn.Level.ERROR,
|
||||
message = "This API is experimental and is likely to change or to be removed in the future")
|
||||
|
||||
+2
@@ -34,6 +34,8 @@ object DefaultNewArchitectureEntryPoint {
|
||||
ReactFeatureFlags.enableFabricRenderer = fabricEnabled
|
||||
ReactFeatureFlags.unstable_useFabricInterop = fabricEnabled
|
||||
ReactFeatureFlags.enableBridgelessArchitecture = bridgelessEnabled
|
||||
ReactFeatureFlags.useNativeViewConfigsInBridgelessMode = fabricEnabled && bridgelessEnabled
|
||||
ReactFeatureFlags.unstable_useTurboModuleInterop = bridgelessEnabled
|
||||
|
||||
this.privateFabricEnabled = fabricEnabled
|
||||
this.privateTurboModulesEnabled = turboModulesEnabled
|
||||
|
||||
+58
-8
@@ -8,20 +8,41 @@
|
||||
package com.facebook.react.defaults
|
||||
|
||||
import android.content.Context
|
||||
import com.facebook.react.JSEngineResolutionAlgorithm
|
||||
import com.facebook.react.ReactHost
|
||||
import com.facebook.react.ReactNativeHost
|
||||
import com.facebook.react.ReactPackage
|
||||
import com.facebook.react.bridge.JSBundleLoader
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
||||
import com.facebook.react.fabric.ComponentFactory
|
||||
import com.facebook.react.interfaces.ReactHost
|
||||
import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler
|
||||
import com.facebook.react.runtime.JSCInstance
|
||||
import com.facebook.react.runtime.ReactHostImpl
|
||||
import com.facebook.react.runtime.hermes.HermesInstance
|
||||
|
||||
@UnstableReactNativeAPI
|
||||
/**
|
||||
* A utility class that allows you to simplify the setup of a [ReactHost] for new apps in Open
|
||||
* Source.
|
||||
*
|
||||
* [ReactHost] is an interface responsible of handling the lifecycle of a React Native app when
|
||||
* running in bridgeless mode.
|
||||
*/
|
||||
object DefaultReactHost {
|
||||
private var reactHost: ReactHost? = null
|
||||
|
||||
/**
|
||||
* Util function to create a default [ReactHost] to be used in your application. This method is
|
||||
* used by the New App template.
|
||||
*
|
||||
* @param context the Android [Context] to use for creating the [ReactHost]
|
||||
* @param packageList the list of [ReactPackage]s to use for creating the [ReactHost]
|
||||
* @param jsMainModulePath the path to your app's main module on Metro. Usually `index` or
|
||||
* `index.<platform>`
|
||||
* @param jsBundleAssetPath the path to the JS bundle relative to the assets directory. Will be
|
||||
* composed in a `asset://...` URL
|
||||
* @param isHermesEnabled whether to use Hermes as the JS engine, default to true.
|
||||
*/
|
||||
@OptIn(UnstableReactNativeAPI::class)
|
||||
@JvmStatic
|
||||
fun getDefaultReactHost(
|
||||
context: Context,
|
||||
@@ -47,13 +68,42 @@ object DefaultReactHost {
|
||||
// TODO: T164788699 find alternative of accessing ReactHostImpl for initialising reactHost
|
||||
reactHost =
|
||||
ReactHostImpl(
|
||||
context,
|
||||
defaultReactHostDelegate,
|
||||
componentFactory,
|
||||
true,
|
||||
reactJsExceptionHandler,
|
||||
true)
|
||||
context,
|
||||
defaultReactHostDelegate,
|
||||
componentFactory,
|
||||
true,
|
||||
reactJsExceptionHandler,
|
||||
true)
|
||||
.apply {
|
||||
jsEngineResolutionAlgorithm =
|
||||
if (isHermesEnabled) {
|
||||
JSEngineResolutionAlgorithm.HERMES
|
||||
} else {
|
||||
JSEngineResolutionAlgorithm.JSC
|
||||
}
|
||||
}
|
||||
}
|
||||
return reactHost as ReactHost
|
||||
}
|
||||
|
||||
/**
|
||||
* Util function to create a default [ReactHost] to be used in your application. This method is
|
||||
* used by the New App template.
|
||||
*
|
||||
* This method takes in input a [ReactNativeHost] (bridge-mode) and uses its configuration to
|
||||
* create an equivalent [ReactHost] (bridgeless-mode).
|
||||
*
|
||||
* @param context the Android [Context] to use for creating the [ReactHost]
|
||||
* @param reactNativeHost the [ReactNativeHost] to use for creating the [ReactHost]
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getDefaultReactHost(
|
||||
context: Context,
|
||||
reactNativeHost: ReactNativeHost,
|
||||
): ReactHost {
|
||||
require(reactNativeHost is DefaultReactNativeHost) {
|
||||
"You can call getDefaultReactHost only with instances of DefaultReactNativeHost"
|
||||
}
|
||||
return reactNativeHost.toReactHost(context)
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -8,7 +8,9 @@
|
||||
package com.facebook.react.defaults
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import com.facebook.react.JSEngineResolutionAlgorithm
|
||||
import com.facebook.react.ReactHost
|
||||
import com.facebook.react.ReactNativeHost
|
||||
import com.facebook.react.ReactPackageTurboModuleManagerDelegate
|
||||
import com.facebook.react.bridge.JSIModulePackage
|
||||
@@ -68,4 +70,18 @@ protected constructor(
|
||||
*/
|
||||
protected open val isHermesEnabled: Boolean?
|
||||
get() = null
|
||||
|
||||
/**
|
||||
* Converts this [ReactNativeHost] (bridge-mode) to a [ReactHost] (bridgeless-mode).
|
||||
*
|
||||
* @param context the Android [Context] to use for creating the [ReactHost]
|
||||
*/
|
||||
fun toReactHost(context: Context): ReactHost =
|
||||
DefaultReactHost.getDefaultReactHost(
|
||||
context,
|
||||
packages,
|
||||
jsMainModuleName,
|
||||
bundleAssetName ?: "index",
|
||||
isHermesEnabled ?: true,
|
||||
)
|
||||
}
|
||||
|
||||
-11
@@ -86,9 +86,6 @@ public final class BridgeDevSupportManager extends DevSupportManagerBase {
|
||||
surfaceDelegateFactory,
|
||||
devLoadingViewManager);
|
||||
|
||||
mReactInstanceManagerHelper = reactInstanceManagerHelper;
|
||||
mDevLoadingViewManager = devLoadingViewManager;
|
||||
|
||||
if (getDevSettings().isStartSamplingProfilerOnInit()) {
|
||||
// Only start the profiler. If its already running, there is an error
|
||||
if (!mIsSamplingProfilerEnabled) {
|
||||
@@ -112,14 +109,6 @@ public final class BridgeDevSupportManager extends DevSupportManagerBase {
|
||||
});
|
||||
}
|
||||
|
||||
public DevLoadingViewManager getDevLoadingViewManager() {
|
||||
return mDevLoadingViewManager;
|
||||
}
|
||||
|
||||
public ReactInstanceDevHelper getReactInstanceManagerHelper() {
|
||||
return mReactInstanceManagerHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUniqueTag() {
|
||||
return "Bridge";
|
||||
|
||||
+5
-1
@@ -695,7 +695,11 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
||||
return mDevServerHelper;
|
||||
}
|
||||
|
||||
protected ReactInstanceDevHelper getReactInstanceDevHelper() {
|
||||
public DevLoadingViewManager getDevLoadingViewManager() {
|
||||
return mDevLoadingViewManager;
|
||||
}
|
||||
|
||||
public ReactInstanceDevHelper getReactInstanceDevHelper() {
|
||||
return mReactInstanceDevHelper;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -31,6 +31,6 @@ class JSCExecutor internal constructor(jscConfig: ReadableNativeMap) :
|
||||
SoLoader.loadLibrary("jscexecutor")
|
||||
}
|
||||
|
||||
private external fun initHybrid(jscConfig: ReadableNativeMap): HybridData?
|
||||
@JvmStatic private external fun initHybrid(jscConfig: ReadableNativeMap): HybridData?
|
||||
}
|
||||
}
|
||||
|
||||
+6
-10
@@ -13,8 +13,7 @@ import com.facebook.react.bridge.JSExceptionHandler;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.devsupport.BridgeDevSupportManager;
|
||||
import com.facebook.react.devsupport.DefaultDevLoadingViewImplementation;
|
||||
import com.facebook.react.devsupport.DevSupportManagerBase;
|
||||
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
|
||||
@@ -28,14 +27,9 @@ public class DevLoadingModule extends NativeDevLoadingViewSpec {
|
||||
public DevLoadingModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
mJSExceptionHandler = reactContext.getJSExceptionHandler();
|
||||
if (mJSExceptionHandler != null && mJSExceptionHandler instanceof BridgeDevSupportManager) {
|
||||
if (mJSExceptionHandler != null && mJSExceptionHandler instanceof DevSupportManagerBase) {
|
||||
mDevLoadingViewManager =
|
||||
((BridgeDevSupportManager) mJSExceptionHandler).getDevLoadingViewManager();
|
||||
mDevLoadingViewManager =
|
||||
mDevLoadingViewManager != null
|
||||
? mDevLoadingViewManager
|
||||
: new DefaultDevLoadingViewImplementation(
|
||||
((BridgeDevSupportManager) mJSExceptionHandler).getReactInstanceManagerHelper());
|
||||
((DevSupportManagerBase) mJSExceptionHandler).getDevLoadingViewManager();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +40,9 @@ public class DevLoadingModule extends NativeDevLoadingViewSpec {
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDevLoadingViewManager.showMessage(message);
|
||||
if (mDevLoadingViewManager != null) {
|
||||
mDevLoadingViewManager.showMessage(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user