mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
78
Commits
@@ -20,8 +20,6 @@ runs:
|
||||
- name: Set React Native Version
|
||||
shell: bash
|
||||
run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }}
|
||||
# We don't want to re-set the artifacts version if we're on the release branch.
|
||||
if: ${{ !contains(github.ref, '-stable') }}
|
||||
- name: Setup gradle
|
||||
uses: ./.github/actions/setup-gradle
|
||||
with:
|
||||
|
||||
@@ -14,8 +14,12 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y git openssh-client cmake build-essential \
|
||||
sudo apt install -y git openssh-client build-essential \
|
||||
libreadline-dev libicu-dev jq zip python3
|
||||
|
||||
# Install cmake 3.28.3-1build7
|
||||
sudo apt-get install cmake=3.28.3-1build7
|
||||
sudo ln -sf /usr/bin/cmake /usr/local/bin/cmake
|
||||
- name: Restore Hermes workspace
|
||||
uses: ./.github/actions/restore-hermes-workspace
|
||||
- name: Linux cache
|
||||
|
||||
@@ -14,23 +14,23 @@ runs:
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: hermes-workspace
|
||||
path: 'D:\tmp\hermes'
|
||||
path: 'C:\tmp\hermes'
|
||||
- name: Set up workspace
|
||||
shell: powershell
|
||||
run: |
|
||||
mkdir -p D:\tmp\hermes\osx-bin
|
||||
mkdir -p C:\tmp\hermes\osx-bin
|
||||
mkdir -p .\packages\react-native\sdks\hermes
|
||||
cp -r -Force D:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\.
|
||||
cp -r -Force C:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\.
|
||||
cp -r -Force .\packages\react-native\sdks\hermes-engine\utils\* .\packages\react-native\sdks\hermes\.
|
||||
- name: Windows cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: v2-hermes-${{ github.job }}-windows-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
|
||||
key: v3-hermes-${{ github.job }}-windows-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
|
||||
path: |
|
||||
D:\tmp\hermes\win64-bin\
|
||||
D:\tmp\hermes\hermes\icu\
|
||||
D:\tmp\hermes\hermes\deps\
|
||||
D:\tmp\hermes\hermes\build_release\
|
||||
C:\tmp\hermes\win64-bin\
|
||||
C:\tmp\hermes\hermes\icu\
|
||||
C:\tmp\hermes\hermes\deps\
|
||||
C:\tmp\hermes\hermes\build_release\
|
||||
- name: setup-msbuild
|
||||
uses: microsoft/setup-msbuild@v1.3.2
|
||||
- name: Set up workspace
|
||||
@@ -39,6 +39,9 @@ runs:
|
||||
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\icu
|
||||
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\deps
|
||||
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\win64-bin
|
||||
- name: Downgrade CMake
|
||||
shell: powershell
|
||||
run: choco install cmake --version 3.31.6 --force
|
||||
- name: Build HermesC for Windows
|
||||
shell: powershell
|
||||
run: |
|
||||
@@ -60,7 +63,7 @@ runs:
|
||||
$Env:PATH += ";$Env:CMAKE_DIR;$Env:MSBUILD_DIR"
|
||||
$Env:ICU_ROOT = "$Env:HERMES_WS_DIR\icu"
|
||||
|
||||
cmake -S hermes -B build_release -G 'Visual Studio 16 2019' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
|
||||
cmake -S hermes -B build_release -G 'Visual Studio 17 2022' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
|
||||
if (-not $?) { throw "Failed to configure Hermes" }
|
||||
echo "Running windows build..."
|
||||
cd build_release
|
||||
@@ -80,4 +83,4 @@ runs:
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: hermes-win64-bin
|
||||
path: D:\tmp\hermes\win64-bin\
|
||||
path: C:\tmp\hermes\win64-bin\
|
||||
|
||||
@@ -68,6 +68,10 @@ module.exports.verifyPublishedTemplate = async (
|
||||
latest = false,
|
||||
retries = MAX_RETRIES,
|
||||
) => {
|
||||
if (version.startsWith('v')) {
|
||||
version = version.slice(1);
|
||||
}
|
||||
|
||||
log(`🔍 Is ${TEMPLATE_NPM_PKG}@${version} on npm?`);
|
||||
|
||||
let count = retries;
|
||||
@@ -86,7 +90,7 @@ module.exports.verifyPublishedTemplate = async (
|
||||
return;
|
||||
}
|
||||
log(
|
||||
`🐌 ${TEMPLATE_NPM_PKG}@latest → ${pkg.version} on npm and not ${version} as expected, retrying...`,
|
||||
`🐌 ${TEMPLATE_NPM_PKG}@latest → ${json.version} on npm and not ${version} as expected, retrying...`,
|
||||
);
|
||||
} catch (e) {
|
||||
log(`Nope, fetch failed: ${e.message}`);
|
||||
|
||||
@@ -116,12 +116,12 @@ jobs:
|
||||
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
||||
|
||||
build_hermesc_windows:
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2025
|
||||
needs: prepare_hermes_workspace
|
||||
env:
|
||||
HERMES_WS_DIR: 'D:\tmp\hermes'
|
||||
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
|
||||
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
|
||||
HERMES_WS_DIR: 'C:\tmp\hermes'
|
||||
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
|
||||
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
|
||||
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
|
||||
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
|
||||
CMAKE_DIR: 'C:\Program Files\CMake\bin'
|
||||
|
||||
@@ -113,12 +113,12 @@ jobs:
|
||||
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
||||
|
||||
build_hermesc_windows:
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2025
|
||||
needs: prepare_hermes_workspace
|
||||
env:
|
||||
HERMES_WS_DIR: 'D:\tmp\hermes'
|
||||
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
|
||||
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
|
||||
HERMES_WS_DIR: 'C:\tmp\hermes'
|
||||
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
|
||||
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
|
||||
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
|
||||
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
|
||||
CMAKE_DIR: 'C:\Program Files\CMake\bin'
|
||||
@@ -131,26 +131,6 @@ jobs:
|
||||
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
|
||||
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
||||
|
||||
build_android:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs: [set_release_type]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build Android
|
||||
uses: ./.github/actions/build-android
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
|
||||
build_npm_package:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs:
|
||||
@@ -160,7 +140,6 @@ jobs:
|
||||
build_hermes_macos,
|
||||
build_hermesc_linux,
|
||||
build_hermesc_windows,
|
||||
build_android,
|
||||
]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
||||
|
||||
test_ios_rntester:
|
||||
runs-on: macos-13
|
||||
runs-on: macos-13-large
|
||||
needs:
|
||||
[build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos]
|
||||
env:
|
||||
@@ -369,6 +369,11 @@ jobs:
|
||||
sed -i 's/newArchEnabled=true/newArchEnabled=false/' android/gradle.properties
|
||||
fi
|
||||
|
||||
if [[ ${{matrix.jsengine}} == "JSC" ]]; then
|
||||
echo "Using JSC instead of Hermes"
|
||||
sed -i 's/hermesEnabled=true/hermesEnabled=false/' android/gradle.properties
|
||||
fi
|
||||
|
||||
# Build
|
||||
cd android
|
||||
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
|
||||
@@ -403,12 +408,12 @@ jobs:
|
||||
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
||||
|
||||
build_hermesc_windows:
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2025
|
||||
needs: prepare_hermes_workspace
|
||||
env:
|
||||
HERMES_WS_DIR: 'D:\tmp\hermes'
|
||||
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
|
||||
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
|
||||
HERMES_WS_DIR: 'C:\tmp\hermes'
|
||||
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
|
||||
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
|
||||
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
|
||||
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
|
||||
CMAKE_DIR: 'C:\Program Files\CMake\bin'
|
||||
|
||||
@@ -6,3 +6,4 @@ ruby ">= 2.6.10"
|
||||
gem 'cocoapods', '~> 1.13', '!= 1.15.0', '!= 1.15.1'
|
||||
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
|
||||
gem 'xcodeproj', '< 1.26.0'
|
||||
gem 'concurrent-ruby', '< 1.3.4'
|
||||
|
||||
@@ -54,6 +54,8 @@ nexusPublishing {
|
||||
sonatype {
|
||||
username.set(sonatypeUsername)
|
||||
password.set(sonatypePassword)
|
||||
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
|
||||
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -49,8 +49,8 @@
|
||||
"@babel/preset-flow": "^7.24.7",
|
||||
"@definitelytyped/dtslint": "^0.0.127",
|
||||
"@jest/create-cache-key-function": "^29.6.3",
|
||||
"@react-native/metro-babel-transformer": "0.77.0-main",
|
||||
"@react-native/metro-config": "0.77.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.78.3",
|
||||
"@react-native/metro-config": "0.78.3",
|
||||
"@tsconfig/node18": "1.0.1",
|
||||
"@types/react": "^19.0.0",
|
||||
"@typescript-eslint/parser": "^7.1.1",
|
||||
@@ -87,9 +87,9 @@
|
||||
"jest-junit": "^10.0.0",
|
||||
"jest-snapshot": "^29.7.0",
|
||||
"jscodeshift": "^0.14.0",
|
||||
"metro-babel-register": "^0.81.0",
|
||||
"metro-memory-fs": "^0.81.0",
|
||||
"metro-transform-plugins": "^0.81.0",
|
||||
"metro-babel-register": "^0.81.3",
|
||||
"metro-memory-fs": "^0.81.3",
|
||||
"metro-transform-plugins": "^0.81.3",
|
||||
"micromatch": "^4.0.4",
|
||||
"node-fetch": "^2.2.0",
|
||||
"nullthrows": "^1.1.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/assets-registry",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Asset support code for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/babel-plugin-codegen",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Babel plugin to generate native module and view manager code for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,7 +26,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/traverse": "^7.25.3",
|
||||
"@react-native/codegen": "0.77.0-main"
|
||||
"@react-native/codegen": "0.78.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2"
|
||||
|
||||
@@ -15,7 +15,7 @@ Start the React Native development server.
|
||||
#### Usage
|
||||
|
||||
```sh
|
||||
npx react-native start [options]
|
||||
npx @react-native-community/cli start [options]
|
||||
```
|
||||
|
||||
#### Options
|
||||
@@ -37,6 +37,7 @@ npx react-native start [options]
|
||||
| `--cert <path>` | Specify path to a custom SSL cert. |
|
||||
| `--config <string>` | Path to the CLI configuration file. |
|
||||
| `--no-interactive` | Disable interactive mode. |
|
||||
| `--client-logs` | **[Deprecated]** Enable plain text JavaScript log streaming for all connected apps. |
|
||||
|
||||
### `bundle`
|
||||
|
||||
@@ -45,7 +46,7 @@ Build the bundle for the provided JavaScript entry file.
|
||||
#### Usage
|
||||
|
||||
```sh
|
||||
npx react-native bundle --entry-file <path> [options]
|
||||
npx @react-native-community/cli bundle --entry-file <path> [options]
|
||||
```
|
||||
|
||||
#### Options
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/community-cli-plugin",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Core CLI commands for React Native",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -22,25 +22,25 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/dev-middleware": "0.77.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.77.0-main",
|
||||
"@react-native/dev-middleware": "0.78.3",
|
||||
"@react-native/metro-babel-transformer": "0.78.3",
|
||||
"chalk": "^4.0.0",
|
||||
"debug": "^2.2.0",
|
||||
"invariant": "^2.2.4",
|
||||
"metro": "^0.81.0",
|
||||
"metro-config": "^0.81.0",
|
||||
"metro-core": "^0.81.0",
|
||||
"metro": "^0.81.3",
|
||||
"metro-config": "^0.81.3",
|
||||
"metro-core": "^0.81.3",
|
||||
"readline": "^1.3.0",
|
||||
"semver": "^7.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"metro-resolver": "^0.81.0"
|
||||
"metro-resolver": "^0.81.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-native-community/cli-server-api": "*"
|
||||
"@react-native-community/cli": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@react-native-community/cli-server-api": {
|
||||
"@react-native-community/cli": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -95,6 +95,14 @@ const startCommand: Command = {
|
||||
name: '--no-interactive',
|
||||
description: 'Disables interactive mode',
|
||||
},
|
||||
{
|
||||
name: '--client-logs',
|
||||
description:
|
||||
'[Deprecated] Enable plain text JavaScript log streaming for all ' +
|
||||
'connected apps. This feature is deprecated and will be removed in ' +
|
||||
'future.',
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import type {NextHandleFunction, Server} from 'connect';
|
||||
import typeof * as CLIServerAPI from '@react-native-community/cli-server-api';
|
||||
import type {Server} from 'connect';
|
||||
import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
|
||||
|
||||
const debug = require('debug')('ReactNative:CommunityCliPlugin');
|
||||
@@ -30,10 +31,6 @@ type MiddlewareReturn = {
|
||||
...
|
||||
};
|
||||
|
||||
const noopNextHandle: NextHandleFunction = (req, res, next) => {
|
||||
next();
|
||||
};
|
||||
|
||||
// $FlowFixMe
|
||||
const unusedStubWSServer: ws$WebSocketServer = {};
|
||||
// $FlowFixMe
|
||||
@@ -45,6 +42,12 @@ const communityMiddlewareFallback = {
|
||||
port: number,
|
||||
watchFolders: $ReadOnlyArray<string>,
|
||||
}): MiddlewareReturn => ({
|
||||
// FIXME: Several features will break without community middleware and
|
||||
// should be migrated into core.
|
||||
// e.g. used by Libraries/Core/Devtools:
|
||||
// - /open-stack-frame
|
||||
// - /open-url
|
||||
// - /symbolicate
|
||||
middleware: unusedMiddlewareStub,
|
||||
websocketEndpoints: {},
|
||||
messageSocketEndpoint: {
|
||||
@@ -59,17 +62,30 @@ const communityMiddlewareFallback = {
|
||||
reportEvent: (event: TerminalReportableEvent) => {},
|
||||
},
|
||||
}),
|
||||
indexPageMiddleware: noopNextHandle,
|
||||
};
|
||||
|
||||
// Attempt to use the community middleware if it exists, but fallback to
|
||||
// the stubs if it doesn't.
|
||||
try {
|
||||
const community = require('@react-native-community/cli-server-api');
|
||||
communityMiddlewareFallback.indexPageMiddleware =
|
||||
community.indexPageMiddleware;
|
||||
// `@react-native-community/cli` is an optional peer dependency of this
|
||||
// package, and should be a dev dependency of the host project (via the
|
||||
// community template's package.json).
|
||||
const communityCliPath = require.resolve('@react-native-community/cli');
|
||||
|
||||
// `@react-native-community/cli-server-api` is a dependency of
|
||||
// `@react-native-community/cli`, but is not re-exported by it, so we need
|
||||
// to resolve the former through the latter.
|
||||
const communityCliServerApiPath = require.resolve(
|
||||
'@react-native-community/cli-server-api',
|
||||
{paths: [communityCliPath]},
|
||||
);
|
||||
// $FlowIgnore[unsupported-syntax] dynamic import
|
||||
const communityCliServerApi: CLIServerAPI = require(
|
||||
communityCliServerApiPath,
|
||||
);
|
||||
// $FlowIgnore[unsupported-syntax] dynamic import
|
||||
communityMiddlewareFallback.createDevServerMiddleware =
|
||||
community.createDevServerMiddleware;
|
||||
communityCliServerApi.createDevServerMiddleware;
|
||||
} catch {
|
||||
debug(`⚠️ Unable to find @react-native-community/cli-server-api
|
||||
Starting the server without the community middleware.`);
|
||||
@@ -77,5 +93,3 @@ Starting the server without the community middleware.`);
|
||||
|
||||
export const createDevServerMiddleware =
|
||||
communityMiddlewareFallback.createDevServerMiddleware;
|
||||
export const indexPageMiddleware =
|
||||
communityMiddlewareFallback.indexPageMiddleware;
|
||||
|
||||
@@ -19,7 +19,7 @@ import isDevServerRunning from '../../utils/isDevServerRunning';
|
||||
import loadMetroConfig from '../../utils/loadMetroConfig';
|
||||
import * as version from '../../utils/version';
|
||||
import attachKeyHandlers from './attachKeyHandlers';
|
||||
import {createDevServerMiddleware, indexPageMiddleware} from './middleware';
|
||||
import {createDevServerMiddleware} from './middleware';
|
||||
import {createDevMiddleware} from '@react-native/dev-middleware';
|
||||
import chalk from 'chalk';
|
||||
import Metro from 'metro';
|
||||
@@ -44,6 +44,7 @@ export type StartCommandArgs = {
|
||||
config?: string,
|
||||
projectRoot?: string,
|
||||
interactive: boolean,
|
||||
clientLogs: boolean,
|
||||
};
|
||||
|
||||
async function runServer(
|
||||
@@ -96,6 +97,11 @@ async function runServer(
|
||||
require.resolve(plugin),
|
||||
);
|
||||
}
|
||||
// TODO(T214991636): Remove legacy Metro log forwarding
|
||||
if (!args.clientLogs) {
|
||||
// $FlowIgnore[cannot-write] Assigning to readonly property
|
||||
metroConfig.server.forwardClientLogs = false;
|
||||
}
|
||||
|
||||
let reportEvent: (event: TerminalReportableEvent) => void;
|
||||
const terminal = new Terminal(process.stdout);
|
||||
@@ -146,11 +152,7 @@ async function runServer(
|
||||
secure: args.https,
|
||||
secureCert: args.cert,
|
||||
secureKey: args.key,
|
||||
unstable_extraMiddleware: [
|
||||
communityMiddleware,
|
||||
indexPageMiddleware,
|
||||
middleware,
|
||||
],
|
||||
unstable_extraMiddleware: [communityMiddleware, middleware],
|
||||
websocketEndpoints: {
|
||||
...communityWebsocketEndpoints,
|
||||
...websocketEndpoints,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/core-cli-utils",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "React Native CLI library for Frameworks to build on",
|
||||
"license": "MIT",
|
||||
"main": "./src/index.flow.js",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@generated SignedSource<<890c168c017f387915457465e90400e9>>
|
||||
Git revision: 7727db85ac767cf41cce3e9ee54d27e97b2637f9
|
||||
@generated SignedSource<<7379c02d269a700f429c1c1e33cb6419>>
|
||||
Git revision: 911a4d983fc2609abc59e73230b7a8684e3a7ac9
|
||||
Built with --nohooks: false
|
||||
Is local checkout: false
|
||||
Remote URL: https://github.com/facebookexperimental/rn-chrome-devtools-frontend
|
||||
Remote branch: main
|
||||
Remote branch: 0.78-stable
|
||||
GN build args (overrides only):
|
||||
is_official_build = true
|
||||
Git status in checkout:
|
||||
|
||||
+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
+2
-2
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/debugger-frontend",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Debugger frontend for React Native based on Chrome DevTools",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/dev-middleware",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Dev server middleware for React Native",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -23,11 +23,12 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@isaacs/ttlcache": "^1.4.1",
|
||||
"@react-native/debugger-frontend": "0.77.0-main",
|
||||
"@react-native/debugger-frontend": "0.78.3",
|
||||
"chrome-launcher": "^0.15.2",
|
||||
"chromium-edge-launcher": "^0.2.0",
|
||||
"connect": "^3.6.5",
|
||||
"debug": "^2.2.0",
|
||||
"invariant": "^2.2.4",
|
||||
"nullthrows": "^1.1.1",
|
||||
"open": "^7.0.3",
|
||||
"selfsigned": "^2.4.1",
|
||||
|
||||
@@ -150,6 +150,17 @@ function createWrappedEventReporter(
|
||||
`Profiling build target "${event.appId}" registered for debugging`,
|
||||
);
|
||||
break;
|
||||
case 'fusebox_console_notice':
|
||||
logger?.info(
|
||||
'\n' +
|
||||
'\u001B[7m' +
|
||||
' \u001B[1m💡 JavaScript logs have moved!\u001B[22m They can now be ' +
|
||||
'viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in ' +
|
||||
'the terminal to open (requires Google Chrome or Microsoft Edge).' +
|
||||
'\u001B[27m' +
|
||||
'\n',
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
reporter?.logEvent(event);
|
||||
|
||||
@@ -41,6 +41,8 @@ const PAGES_POLLING_INTERVAL = 1000;
|
||||
// more details.
|
||||
const FILE_PREFIX = 'file://';
|
||||
|
||||
let fuseboxConsoleNoticeLogged = false;
|
||||
|
||||
type DebuggerConnection = {
|
||||
// Debugger web socket connection
|
||||
socket: WS,
|
||||
@@ -519,6 +521,7 @@ export default class Device {
|
||||
// created instead of manually checking this on every getPages result.
|
||||
for (const page of this.#pages.values()) {
|
||||
if (this.#pageHasCapability(page, 'nativePageReloads')) {
|
||||
this.#logFuseboxConsoleNotice();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1073,4 +1076,14 @@ export default class Device {
|
||||
dangerouslyGetSocket(): WS {
|
||||
return this.#deviceSocket;
|
||||
}
|
||||
|
||||
// TODO(T214991636): Remove notice
|
||||
#logFuseboxConsoleNotice() {
|
||||
if (fuseboxConsoleNoticeLogged) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.#deviceEventReporter?.logFuseboxConsoleNotice();
|
||||
fuseboxConsoleNoticeLogged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +223,12 @@ class DeviceEventReporter {
|
||||
});
|
||||
}
|
||||
|
||||
logFuseboxConsoleNotice(): void {
|
||||
this.#eventReporter.logEvent({
|
||||
type: 'fusebox_console_notice',
|
||||
});
|
||||
}
|
||||
|
||||
#logExpiredCommand(pendingCommand: PendingCommand): void {
|
||||
this.#eventReporter.logEvent({
|
||||
type: 'debugger_command',
|
||||
|
||||
@@ -39,7 +39,7 @@ const WS_DEBUGGER_URL = '/inspector/debug';
|
||||
const PAGES_LIST_JSON_URL = '/json';
|
||||
const PAGES_LIST_JSON_URL_2 = '/json/list';
|
||||
const PAGES_LIST_JSON_VERSION_URL = '/json/version';
|
||||
const MAX_PONG_LATENCY_MS = 5000;
|
||||
const MAX_PONG_LATENCY_MS = 60000;
|
||||
const DEBUGGER_HEARTBEAT_INTERVAL_MS = 10000;
|
||||
|
||||
const INTERNAL_ERROR_CODE = 1011;
|
||||
|
||||
@@ -82,6 +82,9 @@ export type ReportableEvent =
|
||||
status: 'success',
|
||||
...DebuggerSessionIDs,
|
||||
}
|
||||
| {
|
||||
type: 'fusebox_console_notice',
|
||||
}
|
||||
| {
|
||||
type: 'proxy_error',
|
||||
status: 'error',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-config",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "ESLint config for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/eslint-parser": "^7.25.1",
|
||||
"@react-native/eslint-plugin": "0.77.0-main",
|
||||
"@react-native/eslint-plugin": "0.78.3",
|
||||
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
||||
"@typescript-eslint/parser": "^7.1.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-plugin",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "ESLint rules for @react-native/eslint-config",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-plugin-specs",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "ESLint rules to validate NativeModule and Component Specs",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,7 +26,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
|
||||
"@react-native/codegen": "0.77.0-main",
|
||||
"@react-native/codegen": "0.78.3",
|
||||
"make-dir": "^2.1.0",
|
||||
"pirates": "^4.0.1",
|
||||
"source-map-support": "0.5.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/gradle-plugin",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Gradle Plugin for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
+28
-1
@@ -8,12 +8,14 @@
|
||||
package com.facebook.react.utils
|
||||
|
||||
import com.facebook.react.utils.PropertyUtils.DEFAULT_INTERNAL_PUBLISHING_GROUP
|
||||
import com.facebook.react.utils.PropertyUtils.EXCLUSIVE_ENTEPRISE_REPOSITORY
|
||||
import com.facebook.react.utils.PropertyUtils.INCLUDE_JITPACK_REPOSITORY
|
||||
import com.facebook.react.utils.PropertyUtils.INCLUDE_JITPACK_REPOSITORY_DEFAULT
|
||||
import com.facebook.react.utils.PropertyUtils.INTERNAL_PUBLISHING_GROUP
|
||||
import com.facebook.react.utils.PropertyUtils.INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO
|
||||
import com.facebook.react.utils.PropertyUtils.INTERNAL_USE_HERMES_NIGHTLY
|
||||
import com.facebook.react.utils.PropertyUtils.INTERNAL_VERSION_NAME
|
||||
import com.facebook.react.utils.PropertyUtils.SCOPED_EXCLUSIVE_ENTEPRISE_REPOSITORY
|
||||
import com.facebook.react.utils.PropertyUtils.SCOPED_INCLUDE_JITPACK_REPOSITORY
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
@@ -28,6 +30,12 @@ internal object DependencyUtils {
|
||||
* party libraries which are auto-linked.
|
||||
*/
|
||||
fun configureRepositories(project: Project) {
|
||||
val exclusiveEnterpriseRepository = project.rootProject.exclusiveEnterpriseRepository()
|
||||
if (exclusiveEnterpriseRepository != null) {
|
||||
project.logger.lifecycle(
|
||||
"Replacing ALL Maven Repositories with: $exclusiveEnterpriseRepository")
|
||||
}
|
||||
|
||||
project.rootProject.allprojects { eachProject ->
|
||||
with(eachProject) {
|
||||
if (hasProperty(INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO)) {
|
||||
@@ -36,8 +44,18 @@ internal object DependencyUtils {
|
||||
repo.content { it.excludeGroup("org.webkit") }
|
||||
}
|
||||
}
|
||||
|
||||
if (exclusiveEnterpriseRepository != null) {
|
||||
// We remove all previously set repositories and only configure the proxy provided by the
|
||||
// user.
|
||||
rootProject.repositories.clear()
|
||||
mavenRepoFromUrl(exclusiveEnterpriseRepository)
|
||||
// We return here as we don't want to configure other repositories as well.
|
||||
return@allprojects
|
||||
}
|
||||
|
||||
// We add the snapshot for users on nightlies.
|
||||
mavenRepoFromUrl("https://oss.sonatype.org/content/repositories/snapshots/") { repo ->
|
||||
mavenRepoFromUrl("https://central.sonatype.com/repository/maven-snapshots/") { repo ->
|
||||
repo.content { it.excludeGroup("org.webkit") }
|
||||
}
|
||||
repositories.mavenCentral { repo ->
|
||||
@@ -181,4 +199,13 @@ internal object DependencyUtils {
|
||||
property(INCLUDE_JITPACK_REPOSITORY).toString().toBoolean()
|
||||
else -> INCLUDE_JITPACK_REPOSITORY_DEFAULT
|
||||
}
|
||||
|
||||
internal fun Project.exclusiveEnterpriseRepository() =
|
||||
when {
|
||||
hasProperty(SCOPED_EXCLUSIVE_ENTEPRISE_REPOSITORY) ->
|
||||
property(SCOPED_EXCLUSIVE_ENTEPRISE_REPOSITORY).toString()
|
||||
hasProperty(EXCLUSIVE_ENTEPRISE_REPOSITORY) ->
|
||||
property(EXCLUSIVE_ENTEPRISE_REPOSITORY).toString()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -26,7 +26,13 @@ object PropertyUtils {
|
||||
const val INCLUDE_JITPACK_REPOSITORY = "includeJitpackRepository"
|
||||
const val SCOPED_INCLUDE_JITPACK_REPOSITORY = "react.includeJitpackRepository"
|
||||
|
||||
/** By default we include JitPack till React Native 0.80 where this is going to become false */
|
||||
/**
|
||||
* Public property that allows to configure an enterprise repository proxy as exclusive repository
|
||||
*/
|
||||
const val EXCLUSIVE_ENTEPRISE_REPOSITORY = "exclusiveEnterpriseRepository"
|
||||
const val SCOPED_EXCLUSIVE_ENTEPRISE_REPOSITORY = "react.exclusiveEnterpriseRepository"
|
||||
|
||||
/** By default we include JitPack to avoid breaking user builds */
|
||||
internal const val INCLUDE_JITPACK_REPOSITORY_DEFAULT = true
|
||||
|
||||
/**
|
||||
|
||||
+46
-3
@@ -10,6 +10,7 @@ package com.facebook.react.utils
|
||||
import com.facebook.react.tests.createProject
|
||||
import com.facebook.react.utils.DependencyUtils.configureDependencies
|
||||
import com.facebook.react.utils.DependencyUtils.configureRepositories
|
||||
import com.facebook.react.utils.DependencyUtils.exclusiveEnterpriseRepository
|
||||
import com.facebook.react.utils.DependencyUtils.getDependencySubstitutions
|
||||
import com.facebook.react.utils.DependencyUtils.mavenRepoFromURI
|
||||
import com.facebook.react.utils.DependencyUtils.mavenRepoFromUrl
|
||||
@@ -45,7 +46,7 @@ class DependencyUtilsTest {
|
||||
|
||||
@Test
|
||||
fun configureRepositories_containsSnapshotRepo() {
|
||||
val repositoryURI = URI.create("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
val repositoryURI = URI.create("https://central.sonatype.com/repository/maven-snapshots/")
|
||||
val project = createProject()
|
||||
|
||||
configureRepositories(project)
|
||||
@@ -99,6 +100,24 @@ class DependencyUtilsTest {
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun configureRepositories_withExclusiveEnterpriseRepository_replacesAllRepositories() {
|
||||
val repositoryURI = URI.create("https://maven.myfabolousorganization.it")
|
||||
|
||||
val project = createProject()
|
||||
project.rootProject.extensions.extraProperties.set(
|
||||
"exclusiveEnterpriseRepository", repositoryURI.toString())
|
||||
|
||||
configureRepositories(project)
|
||||
|
||||
assertThat(project.repositories).hasSize(1)
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun configureRepositories_withIncludeJitpackRepositoryFalse_doesNotContainJitPack() {
|
||||
val repositoryURI = URI.create("https://www.jitpack.io")
|
||||
@@ -176,7 +195,7 @@ class DependencyUtilsTest {
|
||||
|
||||
@Test
|
||||
fun configureRepositories_snapshotRepoHasHigherPriorityThanMavenCentral() {
|
||||
val repositoryURI = URI.create("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
val repositoryURI = URI.create("https://central.sonatype.com/repository/maven-snapshots/")
|
||||
val mavenCentralURI = URI.create("https://repo.maven.apache.org/maven2/")
|
||||
val project = createProject()
|
||||
|
||||
@@ -470,7 +489,7 @@ class DependencyUtilsTest {
|
||||
@Test
|
||||
fun shouldAddJitPack_withUnscopedProperty() {
|
||||
val project = createProject(tempFolder.root)
|
||||
project.extensions.extraProperties.set("react.includeJitpackRepository", "false")
|
||||
project.extensions.extraProperties.set("includeJitpackRepository", "false")
|
||||
assertThat(project.shouldAddJitPack()).isFalse()
|
||||
}
|
||||
|
||||
@@ -479,4 +498,28 @@ class DependencyUtilsTest {
|
||||
val project = createProject(tempFolder.root)
|
||||
assertThat(project.shouldAddJitPack()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun exclusiveEnterpriseRepository_withScopedProperty() {
|
||||
val project = createProject(tempFolder.root)
|
||||
project.extensions.extraProperties.set(
|
||||
"react.exclusiveEnterpriseRepository", "https://maven.myfabolousorganization.it")
|
||||
assertThat(project.exclusiveEnterpriseRepository())
|
||||
.isEqualTo("https://maven.myfabolousorganization.it")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun exclusiveEnterpriseRepository_withUnscopedProperty() {
|
||||
val project = createProject(tempFolder.root)
|
||||
project.extensions.extraProperties.set(
|
||||
"exclusiveEnterpriseRepository", "https://maven.myfabolousorganization.it")
|
||||
assertThat(project.exclusiveEnterpriseRepository())
|
||||
.isEqualTo("https://maven.myfabolousorganization.it")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun exclusiveEnterpriseRepository_defaultIsTrue() {
|
||||
val project = createProject(tempFolder.root)
|
||||
assertThat(project.exclusiveEnterpriseRepository()).isNull()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,3 +5,4 @@ ruby ">= 2.6.10"
|
||||
gem 'cocoapods', '~> 1.13', '!= 1.15.0', '!= 1.15.1'
|
||||
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
|
||||
gem 'xcodeproj', '< 1.26.0'
|
||||
gem 'concurrent-ruby', '< 1.3.4'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "helloworld",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"bootstrap": "node ./cli.js bootstrap",
|
||||
@@ -13,16 +13,16 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "19.0.0",
|
||||
"react-native": "1000.0.0"
|
||||
"react-native": "0.78.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/preset-env": "^7.25.3",
|
||||
"@babel/runtime": "^7.25.0",
|
||||
"@react-native/babel-preset": "0.77.0-main",
|
||||
"@react-native/core-cli-utils": "0.77.0-main",
|
||||
"@react-native/eslint-config": "0.77.0-main",
|
||||
"@react-native/metro-config": "0.77.0-main",
|
||||
"@react-native/babel-preset": "0.78.3",
|
||||
"@react-native/core-cli-utils": "0.78.3",
|
||||
"@react-native/eslint-config": "0.78.3",
|
||||
"@react-native/metro-config": "0.78.3",
|
||||
"chalk": "^4.1.2",
|
||||
"commander": "^12.0.0",
|
||||
"eslint": "^8.19.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/metro-config",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Metro configuration for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,9 +26,9 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/js-polyfills": "0.77.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.77.0-main",
|
||||
"metro-config": "^0.81.0",
|
||||
"metro-runtime": "^0.81.0"
|
||||
"@react-native/js-polyfills": "0.78.3",
|
||||
"@react-native/metro-babel-transformer": "0.78.3",
|
||||
"metro-config": "^0.81.3",
|
||||
"metro-runtime": "^0.81.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT {
|
||||
resolver: {
|
||||
resolverMainFields: ['react-native', 'browser', 'main'],
|
||||
platforms: ['android', 'ios'],
|
||||
unstable_conditionNames: ['require', 'import', 'react-native'],
|
||||
unstable_conditionNames: ['react-native'],
|
||||
},
|
||||
serializer: {
|
||||
// Note: This option is overridden in cli-plugin-metro (getOverrideConfig)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/normalize-colors",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Color normalization for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/js-polyfills",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Polyfills for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/babel-preset",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Babel preset for React Native applications",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
@@ -55,7 +55,7 @@
|
||||
"@babel/plugin-transform-typescript": "^7.25.2",
|
||||
"@babel/plugin-transform-unicode-regex": "^7.24.7",
|
||||
"@babel/template": "^7.25.0",
|
||||
"@react-native/babel-plugin-codegen": "0.77.0-main",
|
||||
"@react-native/babel-plugin-codegen": "0.78.3",
|
||||
"babel-plugin-syntax-hermes-parser": "0.25.1",
|
||||
"babel-plugin-transform-flow-enums": "^0.0.2",
|
||||
"react-refresh": "^0.14.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/metro-babel-transformer",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Babel transformer for React Native applications.",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
@@ -16,7 +16,7 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@react-native/babel-preset": "0.77.0-main",
|
||||
"@react-native/babel-preset": "0.78.3",
|
||||
"hermes-parser": "0.25.1",
|
||||
"nullthrows": "^1.1.1"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-native/bots",
|
||||
"description": "React Native Bots",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/codegen-typescript-test",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"private": true,
|
||||
"description": "TypeScript related unit test for @react-native/codegen",
|
||||
"license": "MIT",
|
||||
@@ -19,7 +19,7 @@
|
||||
"prepare": "yarn run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native/codegen": "0.77.0-main"
|
||||
"@react-native/codegen": "0.78.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/codegen",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "Code generation tools for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@react-native/fantom",
|
||||
"private": true,
|
||||
"version": "0.77.0-main",
|
||||
"main": "src/index.js",
|
||||
"description": "Internal integration testing and benchmarking tool for React Native",
|
||||
"peerDependencies":{
|
||||
"jest":"^29.7.0",
|
||||
"jest-snapshot": "^29.7.0"
|
||||
}
|
||||
"name": "@react-native/fantom",
|
||||
"private": true,
|
||||
"version": "0.78.3",
|
||||
"main": "src/index.js",
|
||||
"description": "Internal integration testing and benchmarking tool for React Native",
|
||||
"peerDependencies": {
|
||||
"jest": "^29.7.0",
|
||||
"jest-snapshot": "^29.7.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-info",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"main": "build/index.js",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/popup-menu-android",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"description": "PopupMenu for the Android platform",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
@@ -17,7 +17,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@react-native/codegen": "0.77.0-main"
|
||||
"@react-native/codegen": "0.78.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/oss-library-example",
|
||||
"version": "0.77.0-main",
|
||||
"version": "0.78.3",
|
||||
"private": true,
|
||||
"description": "Package that includes native module exapmle, native component example, targets both the old and the new architecture. It should serve as an example of a real-world OSS library.",
|
||||
"license": "MIT",
|
||||
@@ -26,8 +26,8 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@react-native/babel-preset": "0.77.0-main",
|
||||
"react-native": "1000.0.0"
|
||||
"@react-native/babel-preset": "0.78.3",
|
||||
"react-native": "0.78.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type Animation, {EndCallback} from '../animations/Animation';
|
||||
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
||||
import type AnimatedNode from './AnimatedNode';
|
||||
@@ -84,6 +85,7 @@ function _executeAsAnimatedBatch(id: string, operation: () => void) {
|
||||
* See https://reactnative.dev/docs/animatedvalue
|
||||
*/
|
||||
export default class AnimatedValue extends AnimatedWithChildren {
|
||||
#attached: boolean = false;
|
||||
#updateSubscription: ?EventSubscription = null;
|
||||
|
||||
_value: number;
|
||||
@@ -106,14 +108,8 @@ export default class AnimatedValue extends AnimatedWithChildren {
|
||||
}
|
||||
|
||||
__attach(): void {
|
||||
if (this.__isNative) {
|
||||
// NOTE: In theory, we should only need to call this when any listeners
|
||||
// are added. However, there is a global `onUserDrivenAnimationEnded`
|
||||
// listener that relies on `onAnimatedValueUpdate` having fired to update
|
||||
// the values in JavaScript. If that listener is removed, this could be
|
||||
// re-optimized.
|
||||
this.#ensureUpdateSubscriptionExists();
|
||||
}
|
||||
this.#attached = true;
|
||||
this.#ensureUpdateSubscriptionExists();
|
||||
}
|
||||
|
||||
__detach(): void {
|
||||
@@ -125,16 +121,34 @@ export default class AnimatedValue extends AnimatedWithChildren {
|
||||
}
|
||||
this.stopAnimation();
|
||||
super.__detach();
|
||||
this.#attached = false;
|
||||
}
|
||||
|
||||
__getValue(): number {
|
||||
return this._value + this._offset;
|
||||
}
|
||||
|
||||
__makeNative(platformConfig: ?PlatformConfig): void {
|
||||
super.__makeNative(platformConfig);
|
||||
this.#ensureUpdateSubscriptionExists();
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: In theory, we should only need to call this when any listeners
|
||||
* are added. However, there is a global `onUserDrivenAnimationEnded`
|
||||
* listener that relies on `onAnimatedValueUpdate` having fired to update
|
||||
* the values in JavaScript. If that listener is removed, this could be
|
||||
* re-optimized.
|
||||
*/
|
||||
#ensureUpdateSubscriptionExists(): void {
|
||||
if (this.#updateSubscription != null) {
|
||||
return;
|
||||
}
|
||||
// The order in which `__attach` and `__makeNative` are called is not
|
||||
// deterministic, and we only want to do this when both have occurred.
|
||||
if (!this.#attached || !this.__isNative) {
|
||||
return;
|
||||
}
|
||||
const nativeTag = this.__getNativeTag();
|
||||
NativeAnimatedAPI.startListeningToAnimatedNodeValue(nativeTag);
|
||||
const subscription: EventSubscription =
|
||||
|
||||
+14
-13
@@ -276,6 +276,20 @@ function useAnimatedPropsLifecycle_insertionEffects(node: AnimatedProps): void {
|
||||
// if the queue is empty. When multiple animated components are mounted at
|
||||
// the same time. Only first component flushes the queue and the others will noop.
|
||||
NativeAnimatedHelper.API.flushQueue();
|
||||
let drivenAnimationEndedListener: ?EventSubscription = null;
|
||||
if (node.__isNative) {
|
||||
drivenAnimationEndedListener =
|
||||
NativeAnimatedHelper.nativeEventEmitter.addListener(
|
||||
'onUserDrivenAnimationEnded',
|
||||
data => {
|
||||
node.update();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return () => {
|
||||
drivenAnimationEndedListener?.remove();
|
||||
};
|
||||
});
|
||||
|
||||
useInsertionEffect(() => {
|
||||
@@ -287,17 +301,6 @@ function useAnimatedPropsLifecycle_insertionEffects(node: AnimatedProps): void {
|
||||
|
||||
useInsertionEffect(() => {
|
||||
node.__attach();
|
||||
let drivenAnimationEndedListener: ?EventSubscription = null;
|
||||
|
||||
if (node.__isNative) {
|
||||
drivenAnimationEndedListener =
|
||||
NativeAnimatedHelper.nativeEventEmitter.addListener(
|
||||
'onUserDrivenAnimationEnded',
|
||||
data => {
|
||||
node.update();
|
||||
},
|
||||
);
|
||||
}
|
||||
if (prevNodeRef.current != null) {
|
||||
const prevNode = prevNodeRef.current;
|
||||
// TODO: Stop restoring default values (unless `reset` is called).
|
||||
@@ -312,8 +315,6 @@ function useAnimatedPropsLifecycle_insertionEffects(node: AnimatedProps): void {
|
||||
} else {
|
||||
prevNodeRef.current = node;
|
||||
}
|
||||
|
||||
drivenAnimationEndedListener?.remove();
|
||||
};
|
||||
}, [node]);
|
||||
}
|
||||
|
||||
@@ -118,4 +118,11 @@
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
- (void)loadSourceForBridge:(RCTBridge *)bridge
|
||||
onProgress:(RCTSourceLoadProgressBlock)onProgress
|
||||
onComplete:(RCTSourceLoadBlock)loadCallback
|
||||
{
|
||||
[RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -156,6 +156,15 @@ using namespace facebook::react;
|
||||
return RCTAppSetupDefaultModuleFromClass(moduleClass, self.delegate.dependencyProvider);
|
||||
}
|
||||
|
||||
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
|
||||
return [_delegate extraModulesForBridge:bridge];
|
||||
}
|
||||
|
||||
return @[];
|
||||
}
|
||||
|
||||
#pragma mark - RCTComponentViewFactoryComponentProvider
|
||||
|
||||
- (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
||||
@@ -228,6 +237,21 @@ using namespace facebook::react;
|
||||
};
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:onProgress:onComplete:)]) {
|
||||
configuration.loadSourceForBridgeWithProgress =
|
||||
^(RCTBridge *_Nonnull bridge,
|
||||
RCTSourceLoadProgressBlock _Nonnull onProgress,
|
||||
RCTSourceLoadBlock _Nonnull loadCallback) {
|
||||
[weakSelf.delegate loadSourceForBridge:bridge onProgress:onProgress onComplete:loadCallback];
|
||||
};
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:withBlock:)]) {
|
||||
configuration.loadSourceForBridge = ^(RCTBridge *_Nonnull bridge, RCTSourceLoadBlock _Nonnull loadCallback) {
|
||||
[weakSelf.delegate loadSourceForBridge:bridge withBlock:loadCallback];
|
||||
};
|
||||
}
|
||||
|
||||
return [[RCTRootViewFactory alloc] initWithTurboModuleDelegate:self hostDelegate:self configuration:configuration];
|
||||
}
|
||||
|
||||
@@ -251,13 +275,20 @@ class RCTAppDelegateBridgelessFeatureFlags : public ReactNativeFeatureFlagsDefau
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool enableFixForViewCommandRace() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
- (void)_setUpFeatureFlags
|
||||
{
|
||||
if ([self bridgelessEnabled]) {
|
||||
ReactNativeFeatureFlags::override(std::make_unique<RCTAppDelegateBridgelessFeatureFlags>());
|
||||
}
|
||||
static dispatch_once_t setupFeatureFlagsToken;
|
||||
dispatch_once(&setupFeatureFlagsToken, ^{
|
||||
if ([self bridgelessEnabled]) {
|
||||
ReactNativeFeatureFlags::override(std::make_unique<RCTAppDelegateBridgelessFeatureFlags>());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -31,6 +31,11 @@ typedef NSURL *_Nullable (^RCTBundleURLBlock)(void);
|
||||
typedef NSArray<id<RCTBridgeModule>> *_Nonnull (^RCTExtraModulesForBridgeBlock)(RCTBridge *bridge);
|
||||
typedef NSDictionary<NSString *, Class> *_Nonnull (^RCTExtraLazyModuleClassesForBridge)(RCTBridge *bridge);
|
||||
typedef BOOL (^RCTBridgeDidNotFindModuleBlock)(RCTBridge *bridge, NSString *moduleName);
|
||||
typedef void (^RCTLoadSourceForBridgeWithProgressBlock)(
|
||||
RCTBridge *bridge,
|
||||
RCTSourceLoadProgressBlock onProgress,
|
||||
RCTSourceLoadBlock loadCallback);
|
||||
typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBlock loadCallback);
|
||||
|
||||
#pragma mark - RCTRootViewFactory Configuration
|
||||
@interface RCTRootViewFactoryConfiguration : NSObject
|
||||
@@ -145,6 +150,19 @@ typedef BOOL (^RCTBridgeDidNotFindModuleBlock)(RCTBridge *bridge, NSString *modu
|
||||
*/
|
||||
@property (nonatomic, nullable) RCTBridgeDidNotFindModuleBlock bridgeDidNotFindModule;
|
||||
|
||||
/**
|
||||
* The bridge will automatically attempt to load the JS source code from the
|
||||
* location specified by the `sourceURLForBridge:` method, however, if you want
|
||||
* to handle loading the JS yourself, you can do so by setting this property.
|
||||
*/
|
||||
@property (nonatomic, nullable) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
|
||||
|
||||
/**
|
||||
* Similar to loadSourceForBridgeWithProgress but without progress
|
||||
* reporting.
|
||||
*/
|
||||
@property (nonatomic, nullable) RCTLoadSourceForBridgeBlock loadSourceForBridge;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - RCTRootViewFactory
|
||||
|
||||
@@ -302,6 +302,22 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)loadSourceForBridge:(RCTBridge *)bridge withBlock:(RCTSourceLoadBlock)loadCallback
|
||||
{
|
||||
if (_configuration.loadSourceForBridge != nil) {
|
||||
_configuration.loadSourceForBridge(bridge, loadCallback);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadSourceForBridge:(RCTBridge *)bridge
|
||||
onProgress:(RCTSourceLoadProgressBlock)onProgress
|
||||
onComplete:(RCTSourceLoadBlock)loadCallback
|
||||
{
|
||||
if (_configuration.loadSourceForBridgeWithProgress != nil) {
|
||||
_configuration.loadSourceForBridgeWithProgress(bridge, onProgress, loadCallback);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSURL *)bundleURL
|
||||
{
|
||||
return self->_configuration.bundleURLBlock();
|
||||
|
||||
@@ -1019,7 +1019,7 @@ function useTextInputStateSynchronization_STATE({
|
||||
mostRecentEventCount: number,
|
||||
selection: ?Selection,
|
||||
inputRef: React.RefObject<null | HostInstance>,
|
||||
text: string,
|
||||
text?: string,
|
||||
viewCommands: ViewCommands,
|
||||
}): {
|
||||
setLastNativeText: string => void,
|
||||
@@ -1100,7 +1100,7 @@ function useTextInputStateSynchronization_REFS({
|
||||
mostRecentEventCount: number,
|
||||
selection: ?Selection,
|
||||
inputRef: React.RefObject<null | HostInstance>,
|
||||
text: string,
|
||||
text?: string,
|
||||
viewCommands: ViewCommands,
|
||||
}): {
|
||||
setLastNativeText: string => void,
|
||||
@@ -1314,7 +1314,7 @@ function InternalTextInput(props: Props): React.Node {
|
||||
? props.value
|
||||
: typeof props.defaultValue === 'string'
|
||||
? props.defaultValue
|
||||
: '';
|
||||
: undefined;
|
||||
|
||||
const viewCommands =
|
||||
AndroidTextInputCommands ||
|
||||
|
||||
+72
-16
@@ -7,7 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {create} = require('../../../../jest/renderer');
|
||||
const {create, update} = require('../../../../jest/renderer');
|
||||
const ReactNativeFeatureFlags = require('../../../../src/private/featureflags/ReactNativeFeatureFlags');
|
||||
const ReactNative = require('../../../ReactNative/RendererProxy');
|
||||
const {
|
||||
@@ -20,8 +20,14 @@ const ReactTestRenderer = require('react-test-renderer');
|
||||
|
||||
jest.unmock('../TextInput');
|
||||
|
||||
[true, false].forEach(useRefsForTextInputState => {
|
||||
describe(`TextInput tests (useRefsForTextInputState = ${useRefsForTextInputState}`, () => {
|
||||
[
|
||||
{useRefsForTextInputState: true, useTextChildren: true},
|
||||
{useRefsForTextInputState: false, useTextChildren: true},
|
||||
{useRefsForTextInputState: true, useTextChildren: false},
|
||||
{useRefsForTextInputState: false, useTextChildren: false},
|
||||
].forEach(testCase => {
|
||||
const {useRefsForTextInputState, useTextChildren} = testCase;
|
||||
describe(`TextInput tests (useRefsForTextInputState = ${useRefsForTextInputState}) useTextChildren = ${useTextChildren}`, () => {
|
||||
let input;
|
||||
let inputRef;
|
||||
let onChangeListener;
|
||||
@@ -43,15 +49,16 @@ jest.unmock('../TextInput');
|
||||
return (
|
||||
<TextInput
|
||||
ref={inputRef}
|
||||
value={state.text}
|
||||
value={useTextChildren ? undefined : state.text}
|
||||
onChangeText={text => {
|
||||
onChangeTextListener(text);
|
||||
setState({text});
|
||||
}}
|
||||
onChange={event => {
|
||||
onChangeListener(event);
|
||||
}}
|
||||
/>
|
||||
}}>
|
||||
{useTextChildren ? state.text : undefined}
|
||||
</TextInput>
|
||||
);
|
||||
}
|
||||
const renderTree = await create(<TextInputWrapper />);
|
||||
@@ -75,12 +82,20 @@ jest.unmock('../TextInput');
|
||||
);
|
||||
});
|
||||
it('calls onChange callbacks', () => {
|
||||
expect(input.props.value).toBe(initialValue);
|
||||
if (!useTextChildren) {
|
||||
expect(input.props.value).toBe(initialValue);
|
||||
} else {
|
||||
expect(input.props.children).toBe(initialValue);
|
||||
}
|
||||
const message = 'This is a test message';
|
||||
ReactTestRenderer.act(() => {
|
||||
enter(input, message);
|
||||
});
|
||||
expect(input.props.value).toBe(message);
|
||||
if (!useTextChildren) {
|
||||
expect(input.props.value).toBe(message);
|
||||
} else {
|
||||
expect(input.props.children).toBe(message);
|
||||
}
|
||||
expect(onChangeTextListener).toHaveBeenCalledWith(message);
|
||||
expect(onChangeListener).toHaveBeenCalledWith({
|
||||
nativeEvent: {text: message},
|
||||
@@ -90,7 +105,12 @@ jest.unmock('../TextInput');
|
||||
async function createTextInput(extraProps) {
|
||||
const textInputRef = React.createRef(null);
|
||||
await create(
|
||||
<TextInput ref={textInputRef} value="value1" {...extraProps} />,
|
||||
<TextInput
|
||||
ref={textInputRef}
|
||||
value={useTextChildren ? undefined : 'value1'}
|
||||
{...extraProps}>
|
||||
{useTextChildren ? 'value1' : undefined}
|
||||
</TextInput>,
|
||||
);
|
||||
return textInputRef;
|
||||
}
|
||||
@@ -134,14 +154,55 @@ jest.unmock('../TextInput');
|
||||
expect(TextInput.State.currentlyFocusedInput()).toBe(null);
|
||||
});
|
||||
|
||||
it('change selection keeps content', async () => {
|
||||
const defaultValue = 'value1';
|
||||
// create content
|
||||
let renderTree = await create(
|
||||
<TextInput
|
||||
value={useTextChildren ? undefined : defaultValue}
|
||||
position={{start: 1, end: 1}}>
|
||||
{useTextChildren ? defaultValue : undefined}
|
||||
</TextInput>,
|
||||
);
|
||||
input = renderTree.root.findByType(TextInput);
|
||||
expect(
|
||||
useTextChildren ? input.children[0].props.children : input.props.value,
|
||||
).toBe(defaultValue);
|
||||
expect(input.props.position.start).toBe(1);
|
||||
expect(input.props.position.end).toBe(1);
|
||||
|
||||
// update position
|
||||
renderTree = await update(
|
||||
renderTree,
|
||||
<TextInput
|
||||
value={useTextChildren ? undefined : defaultValue}
|
||||
position={{start: 2, end: 2}}>
|
||||
{useTextChildren ? defaultValue : undefined}
|
||||
</TextInput>,
|
||||
);
|
||||
expect(
|
||||
useTextChildren ? input.children[0].props.children : input.props.value,
|
||||
).toBe(defaultValue);
|
||||
expect(input.props.position.start).toBe(2);
|
||||
expect(input.props.position.end).toBe(2);
|
||||
});
|
||||
|
||||
it('should unfocus when other TextInput is focused', async () => {
|
||||
const textInputRe1 = React.createRef(null);
|
||||
const textInputRe2 = React.createRef(null);
|
||||
|
||||
await create(
|
||||
<>
|
||||
<TextInput ref={textInputRe1} value="value1" />
|
||||
<TextInput ref={textInputRe2} value="value2" />
|
||||
<TextInput
|
||||
ref={textInputRe1}
|
||||
value={useTextChildren ? undefined : 'value1'}>
|
||||
{useTextChildren ? 'value1' : undefined}
|
||||
</TextInput>
|
||||
<TextInput
|
||||
ref={textInputRe2}
|
||||
value={useTextChildren ? undefined : 'value2'}>
|
||||
{useTextChildren ? 'value2' : undefined}
|
||||
</TextInput>
|
||||
</>,
|
||||
);
|
||||
ReactNative.findNodeHandle = jest.fn().mockImplementation(ref => {
|
||||
@@ -210,7 +271,6 @@ jest.unmock('../TextInput');
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
text=""
|
||||
textContentType="emailAddress"
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
@@ -255,7 +315,6 @@ jest.unmock('../TextInput');
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`);
|
||||
@@ -301,7 +360,6 @@ jest.unmock('../TextInput');
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
testID="testID"
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`);
|
||||
@@ -432,7 +490,6 @@ jest.unmock('../TextInput');
|
||||
role="main"
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`);
|
||||
@@ -489,7 +546,6 @@ jest.unmock('../TextInput');
|
||||
]
|
||||
}
|
||||
submitBehavior="blurAndSubmit"
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`);
|
||||
|
||||
+112
-8
@@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`TextInput tests (useRefsForTextInputState = false should render as expected: should deep render when mocked (please verify output manually) 1`] = `
|
||||
exports[`TextInput tests (useRefsForTextInputState = false) useTextChildren = false should render as expected: should deep render when mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
@@ -23,12 +23,11 @@ exports[`TextInput tests (useRefsForTextInputState = false should render as expe
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests (useRefsForTextInputState = false should render as expected: should deep render when not mocked (please verify output manually) 1`] = `
|
||||
exports[`TextInput tests (useRefsForTextInputState = false) useTextChildren = false should render as expected: should deep render when not mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
@@ -51,12 +50,11 @@ exports[`TextInput tests (useRefsForTextInputState = false should render as expe
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests (useRefsForTextInputState = true should render as expected: should deep render when mocked (please verify output manually) 1`] = `
|
||||
exports[`TextInput tests (useRefsForTextInputState = false) useTextChildren = true should render as expected: should deep render when mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
@@ -79,12 +77,119 @@ exports[`TextInput tests (useRefsForTextInputState = true should render as expec
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests (useRefsForTextInputState = true should render as expected: should deep render when not mocked (please verify output manually) 1`] = `
|
||||
exports[`TextInput tests (useRefsForTextInputState = false) useTextChildren = true should render as expected: should deep render when not mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
focusable={true}
|
||||
forwardedRef={null}
|
||||
mostRecentEventCount={0}
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
onFocus={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminate={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onScroll={[Function]}
|
||||
onSelectionChange={[Function]}
|
||||
onSelectionChangeShouldSetResponder={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests (useRefsForTextInputState = true) useTextChildren = false should render as expected: should deep render when mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
focusable={true}
|
||||
forwardedRef={null}
|
||||
mostRecentEventCount={0}
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
onFocus={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminate={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onScroll={[Function]}
|
||||
onSelectionChange={[Function]}
|
||||
onSelectionChangeShouldSetResponder={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests (useRefsForTextInputState = true) useTextChildren = false should render as expected: should deep render when not mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
focusable={true}
|
||||
forwardedRef={null}
|
||||
mostRecentEventCount={0}
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
onFocus={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminate={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onScroll={[Function]}
|
||||
onSelectionChange={[Function]}
|
||||
onSelectionChangeShouldSetResponder={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests (useRefsForTextInputState = true) useTextChildren = true should render as expected: should deep render when mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
focusable={true}
|
||||
forwardedRef={null}
|
||||
mostRecentEventCount={0}
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
onFocus={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminate={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onScroll={[Function]}
|
||||
onSelectionChange={[Function]}
|
||||
onSelectionChangeShouldSetResponder={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests (useRefsForTextInputState = true) useTextChildren = true should render as expected: should deep render when not mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
@@ -107,7 +212,6 @@ exports[`TextInput tests (useRefsForTextInputState = true should render as expec
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
submitBehavior="blurAndSubmit"
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
@@ -14,9 +14,9 @@ const version: $ReadOnly<{
|
||||
patch: number,
|
||||
prerelease: string | null,
|
||||
}> = {
|
||||
major: 1000,
|
||||
minor: 0,
|
||||
patch: 0,
|
||||
major: 0,
|
||||
minor: 78,
|
||||
patch: 3,
|
||||
prerelease: null,
|
||||
};
|
||||
|
||||
|
||||
@@ -42,9 +42,8 @@ if (__DEV__) {
|
||||
if (!Platform.isTesting) {
|
||||
const HMRClient = require('../Utilities/HMRClient');
|
||||
|
||||
if (global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) {
|
||||
HMRClient.unstable_notifyFuseboxConsoleEnabled();
|
||||
} else if (console._isPolyfilled) {
|
||||
// TODO(T214991636): Remove legacy Metro log forwarding
|
||||
if (console._isPolyfilled) {
|
||||
// We assume full control over the console and send JavaScript logs to Metro.
|
||||
[
|
||||
'trace',
|
||||
|
||||
@@ -133,6 +133,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
|
||||
width: undefined,
|
||||
height: undefined,
|
||||
};
|
||||
const defaultSource = resolveAssetSource(props.defaultSource);
|
||||
const loadingIndicatorSource = resolveAssetSource(
|
||||
props.loadingIndicatorSource,
|
||||
);
|
||||
@@ -178,6 +179,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
||||
* when making Flow check .android.js files. */
|
||||
headers: (source?.[0]?.headers || source?.headers: ?{[string]: string}),
|
||||
defaultSource: defaultSource ? defaultSource.uri : null,
|
||||
loadingIndicatorSrc: loadingIndicatorSource
|
||||
? loadingIndicatorSource.uri
|
||||
: null,
|
||||
|
||||
@@ -21,6 +21,7 @@ import type {
|
||||
} from '../StyleSheet/StyleSheet';
|
||||
import type {ResolvedAssetSource} from './AssetSourceResolver';
|
||||
import type {ImageProps} from './ImageProps';
|
||||
import type {ImageSource} from './ImageSource';
|
||||
|
||||
import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
|
||||
import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore';
|
||||
@@ -42,7 +43,7 @@ type Props = $ReadOnly<{
|
||||
| ?ResolvedAssetSource
|
||||
| ?$ReadOnlyArray<?$ReadOnly<{uri?: ?string, ...}>>,
|
||||
headers?: ?{[string]: string},
|
||||
defaultSrc?: ?string,
|
||||
defaultSource?: ?ImageSource | ?string,
|
||||
loadingIndicatorSrc?: ?string,
|
||||
}>;
|
||||
|
||||
@@ -82,9 +83,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
|
||||
},
|
||||
validAttributes: {
|
||||
blurRadius: true,
|
||||
defaultSource: {
|
||||
process: require('./resolveAssetSource'),
|
||||
},
|
||||
defaultSource: true,
|
||||
internal_analyticTag: true,
|
||||
resizeMethod: true,
|
||||
resizeMode: true,
|
||||
|
||||
@@ -477,7 +477,15 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image, CGSize size, CGFloat scal
|
||||
|
||||
// Add missing png extension
|
||||
if (request.URL.fileURL && request.URL.pathExtension.length == 0) {
|
||||
mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
|
||||
// Check if there exists a file with that url on disk already
|
||||
// This should fix issue https://github.com/facebook/react-native/issues/46870
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:request.URL.path]) {
|
||||
mutableRequest.URL = request.URL;
|
||||
} else {
|
||||
// This is the default behavior in case there is no file on disk with no extension.
|
||||
// We assume that the extension is `png`.
|
||||
mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
|
||||
}
|
||||
}
|
||||
if (_redirectDelegate != nil) {
|
||||
mutableRequest.URL = [_redirectDelegate redirectAssetsURL:mutableRequest.URL];
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#import <React/RCTDataRequestHandler.h>
|
||||
#import <ReactCommon/RCTTurboModule.h>
|
||||
|
||||
#import <mutex>
|
||||
|
||||
#import "RCTNetworkPlugins.h"
|
||||
|
||||
@interface RCTDataRequestHandler () <RCTTurboModule>
|
||||
@@ -15,14 +17,22 @@
|
||||
|
||||
@implementation RCTDataRequestHandler {
|
||||
NSOperationQueue *_queue;
|
||||
std::mutex _operationHandlerMutexLock;
|
||||
}
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
[_queue cancelAllOperations];
|
||||
_queue = nil;
|
||||
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
||||
if (_queue) {
|
||||
for (NSOperation *operation in _queue.operations) {
|
||||
if (!operation.isCancelled && !operation.isFinished) {
|
||||
[operation cancel];
|
||||
}
|
||||
}
|
||||
_queue = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canHandleRequest:(NSURLRequest *)request
|
||||
@@ -32,6 +42,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
||||
// Lazy setup
|
||||
if (!_queue) {
|
||||
_queue = [NSOperationQueue new];
|
||||
@@ -69,7 +80,10 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)cancelRequest:(NSOperation *)op
|
||||
{
|
||||
[op cancel];
|
||||
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
||||
if (!op.isCancelled && !op.isFinished) {
|
||||
[op cancel];
|
||||
}
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#import <React/RCTFileRequestHandler.h>
|
||||
|
||||
#import <mutex>
|
||||
|
||||
#import <MobileCoreServices/MobileCoreServices.h>
|
||||
|
||||
#import <React/RCTUtils.h>
|
||||
@@ -19,14 +21,22 @@
|
||||
|
||||
@implementation RCTFileRequestHandler {
|
||||
NSOperationQueue *_fileQueue;
|
||||
std::mutex _operationHandlerMutexLock;
|
||||
}
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
[_fileQueue cancelAllOperations];
|
||||
_fileQueue = nil;
|
||||
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
||||
if (_fileQueue) {
|
||||
for (NSOperation *operation in _fileQueue.operations) {
|
||||
if (!operation.isCancelled && !operation.isFinished) {
|
||||
[operation cancel];
|
||||
}
|
||||
}
|
||||
_fileQueue = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canHandleRequest:(NSURLRequest *)request
|
||||
@@ -36,6 +46,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
||||
// Lazy setup
|
||||
if (!_fileQueue) {
|
||||
_fileQueue = [NSOperationQueue new];
|
||||
@@ -83,7 +94,10 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)cancelRequest:(NSOperation *)op
|
||||
{
|
||||
[op cancel];
|
||||
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
||||
if (!op.isCancelled && !op.isFinished) {
|
||||
[op cancel];
|
||||
}
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
||||
|
||||
@@ -26,7 +26,6 @@ let hmrUnavailableReason: string | null = null;
|
||||
let currentCompileErrorMessage: string | null = null;
|
||||
let didConnect: boolean = false;
|
||||
let pendingLogs: Array<[LogLevel, $ReadOnlyArray<mixed>]> = [];
|
||||
let pendingFuseboxConsoleNotification = false;
|
||||
|
||||
type LogLevel =
|
||||
| 'trace'
|
||||
@@ -52,7 +51,6 @@ export type HMRClientNativeInterface = {|
|
||||
isEnabled: boolean,
|
||||
scheme?: string,
|
||||
): void,
|
||||
unstable_notifyFuseboxConsoleEnabled(): void,
|
||||
|};
|
||||
|
||||
/**
|
||||
@@ -142,29 +140,6 @@ const HMRClient: HMRClientNativeInterface = {
|
||||
}
|
||||
},
|
||||
|
||||
unstable_notifyFuseboxConsoleEnabled() {
|
||||
if (!hmrClient) {
|
||||
pendingFuseboxConsoleNotification = true;
|
||||
return;
|
||||
}
|
||||
hmrClient.send(
|
||||
JSON.stringify({
|
||||
type: 'log',
|
||||
level: 'info',
|
||||
data: [
|
||||
'\n' +
|
||||
'\u001B[7m' +
|
||||
' \u001B[1m💡 JavaScript logs have moved!\u001B[22m They can now be ' +
|
||||
'viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in ' +
|
||||
'the terminal to open (requires Google Chrome or Microsoft Edge).' +
|
||||
'\u001B[27m' +
|
||||
'\n',
|
||||
],
|
||||
}),
|
||||
);
|
||||
pendingFuseboxConsoleNotification = false;
|
||||
},
|
||||
|
||||
// Called once by the bridge on startup, even if Fast Refresh is off.
|
||||
// It creates the HMR client but doesn't actually set up the socket yet.
|
||||
setup(
|
||||
@@ -341,9 +316,6 @@ function flushEarlyLogs(client: MetroHMRClient) {
|
||||
pendingLogs.forEach(([level, data]) => {
|
||||
HMRClient.log(level, data);
|
||||
});
|
||||
if (pendingFuseboxConsoleNotification) {
|
||||
HMRClient.unstable_notifyFuseboxConsoleEnabled();
|
||||
}
|
||||
} finally {
|
||||
pendingLogs.length = 0;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ const HMRClientProdShim: HMRClientNativeInterface = {
|
||||
disable() {},
|
||||
registerBundle() {},
|
||||
log() {},
|
||||
unstable_notifyFuseboxConsoleEnabled() {},
|
||||
};
|
||||
|
||||
module.exports = HMRClientProdShim;
|
||||
|
||||
@@ -1169,6 +1169,7 @@ declare export default class AnimatedValue extends AnimatedWithChildren {
|
||||
__attach(): void;
|
||||
__detach(): void;
|
||||
__getValue(): number;
|
||||
__makeNative(platformConfig: ?PlatformConfig): void;
|
||||
setValue(value: number): void;
|
||||
setOffset(offset: number): void;
|
||||
flattenOffset(): void;
|
||||
@@ -5064,7 +5065,7 @@ exports[`public API should not change unintentionally Libraries/Image/ImageViewN
|
||||
| ?ResolvedAssetSource
|
||||
| ?$ReadOnlyArray<?$ReadOnly<{ uri?: ?string, ... }>>,
|
||||
headers?: ?{ [string]: string },
|
||||
defaultSrc?: ?string,
|
||||
defaultSource?: ?ImageSource | ?string,
|
||||
loadingIndicatorSrc?: ?string,
|
||||
}>;
|
||||
interface NativeCommands {
|
||||
@@ -9000,7 +9001,6 @@ export type HMRClientNativeInterface = {|
|
||||
isEnabled: boolean,
|
||||
scheme?: string
|
||||
): void,
|
||||
unstable_notifyFuseboxConsoleEnabled(): void,
|
||||
|};
|
||||
declare const HMRClient: HMRClientNativeInterface;
|
||||
declare module.exports: HMRClient;
|
||||
|
||||
@@ -21,9 +21,9 @@ NSDictionary* RCTGetReactNativeVersion(void)
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^(void){
|
||||
__rnVersion = @{
|
||||
RCTVersionMajor: @(1000),
|
||||
RCTVersionMinor: @(0),
|
||||
RCTVersionPatch: @(0),
|
||||
RCTVersionMajor: @(0),
|
||||
RCTVersionMinor: @(78),
|
||||
RCTVersionPatch: @(3),
|
||||
RCTVersionPrerelease: [NSNull null],
|
||||
};
|
||||
});
|
||||
|
||||
@@ -54,13 +54,11 @@
|
||||
]];
|
||||
|
||||
UIButton *resumeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[resumeButton setImage:[UIImage systemImageNamed:@"forward.frame.fill"] forState:UIControlStateNormal];
|
||||
UIImage *image = [UIImage systemImageNamed:@"forward.frame.fill"];
|
||||
[resumeButton setImage:image forState:UIControlStateNormal];
|
||||
[resumeButton setImage:image forState:UIControlStateDisabled];
|
||||
resumeButton.tintColor = [UIColor colorWithRed:0.37 green:0.37 blue:0.37 alpha:1];
|
||||
|
||||
resumeButton.configurationUpdateHandler = ^(UIButton *button) {
|
||||
button.imageView.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
|
||||
};
|
||||
|
||||
resumeButton.enabled = NO;
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[resumeButton.widthAnchor constraintEqualToConstant:48],
|
||||
|
||||
+18
-4
@@ -170,10 +170,24 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
|
||||
|
||||
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
||||
{
|
||||
[_viewsToBeMounted addObject:@{
|
||||
kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
|
||||
kRCTLegacyInteropChildComponentKey : childComponentView
|
||||
}];
|
||||
if (_adapter && index == _adapter.paperView.reactSubviews.count) {
|
||||
// This is a new child view that is being added to the end of the children array.
|
||||
// After the children is added, we need to call didUpdateReactSubviews to make sure that it is rendered.
|
||||
// Without this change, the new child will not be rendered right away because the didUpdateReactSubviews is not
|
||||
// called and the `finalizeUpdate` is not invoked.
|
||||
if ([childComponentView isKindOfClass:[RCTLegacyViewManagerInteropComponentView class]]) {
|
||||
UIView *target = ((RCTLegacyViewManagerInteropComponentView *)childComponentView).contentView;
|
||||
[_adapter.paperView insertReactSubview:target atIndex:index];
|
||||
} else {
|
||||
[_adapter.paperView insertReactSubview:childComponentView atIndex:index];
|
||||
}
|
||||
[_adapter.paperView didUpdateReactSubviews];
|
||||
} else {
|
||||
[_viewsToBeMounted addObject:@{
|
||||
kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
|
||||
kRCTLegacyInteropChildComponentKey : childComponentView
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ using namespace facebook::react;
|
||||
const auto &newSwitchProps = static_cast<const SwitchProps &>(*props);
|
||||
|
||||
// `value`
|
||||
if (oldSwitchProps.value != newSwitchProps.value) {
|
||||
if (!_isInitialValueSet || oldSwitchProps.value != newSwitchProps.value) {
|
||||
BOOL shouldAnimate = _isInitialValueSet == YES;
|
||||
[_switchView setOn:newSwitchProps.value animated:shouldAnimate];
|
||||
}
|
||||
|
||||
+1
-7
@@ -101,11 +101,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
|
||||
[_backedTextInputView.defaultTextAttributes mutableCopy];
|
||||
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new];
|
||||
eventEmitterWrapper.eventEmitter = _eventEmitter;
|
||||
defaultAttributes[RCTAttributedStringEventEmitterKey] = eventEmitterWrapper;
|
||||
#endif
|
||||
defaultAttributes[RCTAttributedStringEventEmitterKey] = RCTWrapEventEmitter(_eventEmitter);
|
||||
|
||||
_backedTextInputView.defaultTextAttributes = defaultAttributes;
|
||||
}
|
||||
@@ -266,10 +262,8 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
if (newTextInputProps.textAttributes != oldTextInputProps.textAttributes) {
|
||||
NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
|
||||
RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier()));
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
defaultAttributes[RCTAttributedStringEventEmitterKey] =
|
||||
_backedTextInputView.defaultTextAttributes[RCTAttributedStringEventEmitterKey];
|
||||
#endif
|
||||
_backedTextInputView.defaultTextAttributes = defaultAttributes;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@ using namespace facebook::react;
|
||||
|
||||
if (!_view) {
|
||||
_view = [[RCTSurfaceView alloc] initWithSurface:(RCTSurface *)self];
|
||||
[self _updateLayoutContext];
|
||||
_touchHandler = [RCTSurfaceTouchHandler new];
|
||||
[_touchHandler attachToView:_view];
|
||||
}
|
||||
|
||||
@@ -2215,7 +2215,7 @@ public abstract interface class com/facebook/react/devsupport/HMRClient : com/fa
|
||||
public abstract fun disable ()V
|
||||
public abstract fun enable ()V
|
||||
public abstract fun registerBundle (Ljava/lang/String;)V
|
||||
public abstract fun setup (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ)V
|
||||
public abstract fun setup (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZLjava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/devsupport/InspectorFlags {
|
||||
@@ -3482,6 +3482,14 @@ public class com/facebook/react/modules/network/ResponseUtil {
|
||||
public static fun onResponseReceived (Lcom/facebook/react/bridge/ReactApplicationContext;IILcom/facebook/react/bridge/WritableMap;Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/modules/network/ReactCookieJarContainer : com/facebook/react/modules/network/CookieJarContainer {
|
||||
public fun <init> ()V
|
||||
public fun loadForRequest (Lokhttp3/HttpUrl;)Ljava/util/List;
|
||||
public fun removeCookieJar ()V
|
||||
public fun saveFromResponse (Lokhttp3/HttpUrl;Ljava/util/List;)V
|
||||
public fun setCookieJar (Lokhttp3/CookieJar;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/modules/network/TLSSocketFactory : javax/net/ssl/SSLSocketFactory {
|
||||
public fun <init> ()V
|
||||
public fun createSocket (Ljava/lang/String;I)Ljava/net/Socket;
|
||||
@@ -7342,6 +7350,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
|
||||
public static final field TA_KEY_LETTER_SPACING S
|
||||
public static final field TA_KEY_LINE_BREAK_STRATEGY S
|
||||
public static final field TA_KEY_LINE_HEIGHT S
|
||||
public static final field TA_KEY_MAX_FONT_SIZE_MULTIPLIER S
|
||||
public static final field TA_KEY_OPACITY S
|
||||
public static final field TA_KEY_ROLE S
|
||||
public static final field TA_KEY_TEXT_DECORATION_COLOR S
|
||||
@@ -7374,6 +7383,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
|
||||
protected field mLetterSpacingInput F
|
||||
protected field mLineHeight F
|
||||
protected field mLineHeightInput F
|
||||
protected field mMaxFontSizeMultiplier F
|
||||
protected field mNumberOfLines I
|
||||
protected field mOpacity F
|
||||
protected field mRole Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$Role;
|
||||
@@ -7823,4 +7833,3 @@ public final class com/facebook/react/views/view/WindowUtilKt {
|
||||
public static final fun setStatusBarVisibility (Landroid/view/Window;Z)V
|
||||
public static final fun setSystemBarsTranslucency (Landroid/view/Window;Z)V
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=1000.0.0
|
||||
VERSION_NAME=0.78.3
|
||||
react.internal.publishingGroup=com.facebook.react
|
||||
|
||||
android.useAndroidX=true
|
||||
|
||||
+3
-1
@@ -685,10 +685,12 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
||||
URL sourceUrl = new URL(getSourceUrl());
|
||||
String path = sourceUrl.getPath().substring(1); // strip initial slash in path
|
||||
String host = sourceUrl.getHost();
|
||||
String scheme = sourceUrl.getProtocol();
|
||||
int port = sourceUrl.getPort() != -1 ? sourceUrl.getPort() : sourceUrl.getDefaultPort();
|
||||
mCurrentReactContext
|
||||
.getJSModule(HMRClient.class)
|
||||
.setup("android", path, host, port, mDevSettings.isHotModuleReplacementEnabled());
|
||||
.setup(
|
||||
"android", path, host, port, mDevSettings.isHotModuleReplacementEnabled(), scheme);
|
||||
} catch (MalformedURLException e) {
|
||||
showNewJavaError(e.getMessage(), e);
|
||||
}
|
||||
|
||||
+4
-1
@@ -26,8 +26,11 @@ public interface HMRClient extends JavaScriptModule {
|
||||
* @param host The host that the HMRClient should communicate with.
|
||||
* @param port The port that the HMRClient should communicate with on the host.
|
||||
* @param isEnabled Whether HMR is enabled initially.
|
||||
* @param scheme The protocol that the HMRClient should communicate with on the host (defaults to
|
||||
* http).
|
||||
*/
|
||||
void setup(String platform, String bundleEntry, String host, int port, boolean isEnabled);
|
||||
void setup(
|
||||
String platform, String bundleEntry, String host, int port, boolean isEnabled, String scheme);
|
||||
|
||||
/** Registers an additional JS bundle with HMRClient. */
|
||||
void registerBundle(String bundleUrl);
|
||||
|
||||
+13
-8
@@ -173,7 +173,7 @@ public class FabricUIManager
|
||||
private final CopyOnWriteArrayList<UIManagerListener> mListeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
private boolean mMountNotificationScheduled = false;
|
||||
private final List<Integer> mMountedSurfaceIds = new ArrayList<>();
|
||||
private List<Integer> mSurfaceIdsWithPendingMountNotification = new ArrayList<>();
|
||||
|
||||
@ThreadConfined(UI)
|
||||
@NonNull
|
||||
@@ -1250,12 +1250,15 @@ public class FabricUIManager
|
||||
|
||||
// Collect surface IDs for all the mount items
|
||||
for (MountItem mountItem : mountItems) {
|
||||
if (mountItem != null && !mMountedSurfaceIds.contains(mountItem.getSurfaceId())) {
|
||||
mMountedSurfaceIds.add(mountItem.getSurfaceId());
|
||||
if (mountItem != null
|
||||
&& !mSurfaceIdsWithPendingMountNotification.contains(mountItem.getSurfaceId())) {
|
||||
mSurfaceIdsWithPendingMountNotification.add(mountItem.getSurfaceId());
|
||||
}
|
||||
}
|
||||
|
||||
if (!mMountNotificationScheduled && !mMountedSurfaceIds.isEmpty()) {
|
||||
if (!mMountNotificationScheduled && !mSurfaceIdsWithPendingMountNotification.isEmpty()) {
|
||||
mMountNotificationScheduled = true;
|
||||
|
||||
// Notify mount when the effects are visible and prevent mount hooks to
|
||||
// delay paint.
|
||||
UiThreadUtil.getUiThreadHandler()
|
||||
@@ -1265,17 +1268,19 @@ public class FabricUIManager
|
||||
public void run() {
|
||||
mMountNotificationScheduled = false;
|
||||
|
||||
// Create a copy in case mount hooks trigger more mutations
|
||||
final List<Integer> surfaceIdsToReportMount =
|
||||
mSurfaceIdsWithPendingMountNotification;
|
||||
mSurfaceIdsWithPendingMountNotification = new ArrayList<>();
|
||||
|
||||
final @Nullable FabricUIManagerBinding binding = mBinding;
|
||||
if (binding == null || mDestroyed) {
|
||||
mMountedSurfaceIds.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int surfaceId : mMountedSurfaceIds) {
|
||||
for (int surfaceId : surfaceIdsToReportMount) {
|
||||
binding.reportMount(surfaceId);
|
||||
}
|
||||
|
||||
mMountedSurfaceIds.clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+15
-8
@@ -331,14 +331,11 @@ public class MountingManager {
|
||||
@AnyThread
|
||||
@ThreadConfined(ANY)
|
||||
public @Nullable EventEmitterWrapper getEventEmitter(int surfaceId, int reactTag) {
|
||||
SurfaceMountingManager surfaceMountingManager =
|
||||
(surfaceId == ViewUtil.NO_SURFACE_ID
|
||||
? getSurfaceManagerForView(reactTag)
|
||||
: getSurfaceManager(surfaceId));
|
||||
if (surfaceMountingManager == null) {
|
||||
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
|
||||
if (smm == null) {
|
||||
return null;
|
||||
}
|
||||
return surfaceMountingManager.getEventEmitter(reactTag);
|
||||
return smm.getEventEmitter(reactTag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -458,11 +455,21 @@ public class MountingManager {
|
||||
boolean canCoalesceEvent,
|
||||
@Nullable WritableMap params,
|
||||
@EventCategoryDef int eventCategory) {
|
||||
@Nullable SurfaceMountingManager smm = getSurfaceManager(surfaceId);
|
||||
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
|
||||
if (smm == null) {
|
||||
// Cannot queue event without valid surface mountng manager. Do nothing here.
|
||||
FLog.d(
|
||||
TAG,
|
||||
"Cannot queue event without valid surface mounting manager for tag: %d, surfaceId: %d",
|
||||
reactTag,
|
||||
surfaceId);
|
||||
return;
|
||||
}
|
||||
smm.enqueuePendingEvent(reactTag, eventName, canCoalesceEvent, params, eventCategory);
|
||||
}
|
||||
|
||||
private @Nullable SurfaceMountingManager getSurfaceMountingManager(int surfaceId, int reactTag) {
|
||||
return (surfaceId == ViewUtil.NO_SURFACE_ID
|
||||
? getSurfaceManagerForView(reactTag)
|
||||
: getSurfaceManager(surfaceId));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import okhttp3.Headers
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
/** Basic okhttp3 CookieJar container */
|
||||
internal class ReactCookieJarContainer : CookieJarContainer {
|
||||
public class ReactCookieJarContainer : CookieJarContainer {
|
||||
|
||||
private var cookieJar: CookieJar? = null
|
||||
|
||||
|
||||
+3
-3
@@ -15,8 +15,8 @@ import java.util.Map;
|
||||
|
||||
public class ReactNativeVersion {
|
||||
public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
|
||||
"major", 1000,
|
||||
"minor", 0,
|
||||
"patch", 0,
|
||||
"major", 0,
|
||||
"minor", 78,
|
||||
"patch", 3,
|
||||
"prerelease", null);
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,5 +17,5 @@ public interface ReactOverflowView {
|
||||
* Gets the overflow state of a view. If set, this should be one of [ViewProps#HIDDEN],
|
||||
* [ViewProps#VISIBLE] or [ViewProps#SCROLL].
|
||||
*/
|
||||
public fun getOverflow(): String?
|
||||
public val overflow: String?
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,6 +13,6 @@ package com.facebook.react.uimanager
|
||||
*/
|
||||
public interface ReactPointerEventsView {
|
||||
|
||||
/** Return the PointerEvents of the View. */
|
||||
public fun getPointerEvents(): PointerEvents
|
||||
/** The PointerEvents of the View. */
|
||||
public val pointerEvents: PointerEvents
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ package com.facebook.react.uimanager
|
||||
|
||||
/** A task to execute on the UI View for third party libraries. */
|
||||
public fun interface UIBlock {
|
||||
public fun execute(nativeViewHierarchyManager: NativeViewHierarchyManager?): Unit
|
||||
public fun execute(nativeViewHierarchyManager: NativeViewHierarchyManager): Unit
|
||||
}
|
||||
|
||||
+12
-11
@@ -16,6 +16,7 @@ import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Build
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
|
||||
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
||||
import com.facebook.react.uimanager.style.BorderInsets
|
||||
import com.facebook.react.uimanager.style.BorderRadiusStyle
|
||||
|
||||
@@ -198,17 +199,17 @@ internal class CompositeBackgroundDrawable(
|
||||
|
||||
computedBorderRadius?.let {
|
||||
pathForOutline.addRoundRect(
|
||||
RectF(bounds),
|
||||
floatArrayOf(
|
||||
it.topLeft.horizontal + (computedBorderInsets?.left ?: 0f),
|
||||
it.topLeft.vertical + (computedBorderInsets?.top ?: 0f),
|
||||
it.topRight.horizontal + (computedBorderInsets?.right ?: 0f),
|
||||
it.topRight.vertical + (computedBorderInsets?.top ?: 0f),
|
||||
it.bottomRight.horizontal + (computedBorderInsets?.right ?: 0f),
|
||||
it.bottomRight.vertical + (computedBorderInsets?.bottom ?: 0f),
|
||||
it.bottomLeft.horizontal + (computedBorderInsets?.left ?: 0f),
|
||||
it.bottomLeft.vertical) + (computedBorderInsets?.bottom ?: 0f),
|
||||
Path.Direction.CW)
|
||||
RectF(bounds),
|
||||
floatArrayOf(
|
||||
(it.topLeft.horizontal + (computedBorderInsets?.left ?: 0f)).dpToPx(),
|
||||
(it.topLeft.vertical + (computedBorderInsets?.top ?: 0f)).dpToPx(),
|
||||
(it.topRight.horizontal + (computedBorderInsets?.right ?: 0f)).dpToPx(),
|
||||
(it.topRight.vertical + (computedBorderInsets?.top ?: 0f)).dpToPx(),
|
||||
(it.bottomRight.horizontal + (computedBorderInsets?.right ?: 0f)).dpToPx(),
|
||||
(it.bottomRight.vertical + (computedBorderInsets?.bottom ?: 0f)).dpToPx(),
|
||||
(it.bottomLeft.horizontal + (computedBorderInsets?.left ?: 0f)).dpToPx(),
|
||||
(it.bottomLeft.vertical + (computedBorderInsets?.bottom ?: 0f)).dpToPx()),
|
||||
Path.Direction.CW)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
|
||||
+2
-2
@@ -136,10 +136,10 @@ public data class BorderRadiusStyle(
|
||||
(startStart ?: topStart ?: topLeft ?: uniform)?.resolve(width, height)
|
||||
?: zeroRadii,
|
||||
bottomLeft =
|
||||
(endEnd ?: bottomStart ?: bottomRight ?: uniform)?.resolve(width, height)
|
||||
(endEnd ?: bottomEnd ?: bottomRight ?: uniform)?.resolve(width, height)
|
||||
?: zeroRadii,
|
||||
bottomRight =
|
||||
(startEnd ?: bottomEnd ?: bottomLeft ?: uniform)?.resolve(width, height)
|
||||
(startEnd ?: bottomStart ?: bottomLeft ?: uniform)?.resolve(width, height)
|
||||
?: zeroRadii,
|
||||
width = width,
|
||||
height = height,
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public constructor(
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "defaultSource", customType = "ImageSource")
|
||||
@ReactProp(name = "defaultSource")
|
||||
public fun setDefaultSource(view: ReactImageView, source: String?) {
|
||||
view.setDefaultSource(source)
|
||||
}
|
||||
|
||||
+16
-2
@@ -61,6 +61,7 @@ public class TextAttributeProps {
|
||||
public static final short TA_KEY_LINE_BREAK_STRATEGY = 25;
|
||||
public static final short TA_KEY_ROLE = 26;
|
||||
public static final short TA_KEY_TEXT_TRANSFORM = 27;
|
||||
public static final short TA_KEY_MAX_FONT_SIZE_MULTIPLIER = 29;
|
||||
|
||||
public static final int UNSET = -1;
|
||||
|
||||
@@ -81,6 +82,7 @@ public class TextAttributeProps {
|
||||
protected float mLineHeight = Float.NaN;
|
||||
protected boolean mIsColorSet = false;
|
||||
protected boolean mAllowFontScaling = true;
|
||||
protected float mMaxFontSizeMultiplier = Float.NaN;
|
||||
protected int mColor;
|
||||
protected boolean mIsBackgroundColorSet = false;
|
||||
protected int mBackgroundColor;
|
||||
@@ -227,6 +229,9 @@ public class TextAttributeProps {
|
||||
case TA_KEY_TEXT_TRANSFORM:
|
||||
result.setTextTransform(entry.getStringValue());
|
||||
break;
|
||||
case TA_KEY_MAX_FONT_SIZE_MULTIPLIER:
|
||||
result.setMaxFontSizeMultiplier((float) entry.getDoubleValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +248,8 @@ public class TextAttributeProps {
|
||||
result.setLineHeight(getFloatProp(props, ViewProps.LINE_HEIGHT, ReactConstants.UNSET));
|
||||
result.setLetterSpacing(getFloatProp(props, ViewProps.LETTER_SPACING, Float.NaN));
|
||||
result.setAllowFontScaling(getBooleanProp(props, ViewProps.ALLOW_FONT_SCALING, true));
|
||||
result.setMaxFontSizeMultiplier(
|
||||
getFloatProp(props, ViewProps.MAX_FONT_SIZE_MULTIPLIER, Float.NaN));
|
||||
result.setFontSize(getFloatProp(props, ViewProps.FONT_SIZE, ReactConstants.UNSET));
|
||||
result.setColor(props.hasKey(ViewProps.COLOR) ? props.getInt(ViewProps.COLOR, 0) : null);
|
||||
result.setColor(
|
||||
@@ -411,7 +418,14 @@ public class TextAttributeProps {
|
||||
mAllowFontScaling = allowFontScaling;
|
||||
setFontSize(mFontSizeInput);
|
||||
setLineHeight(mLineHeightInput);
|
||||
setLetterSpacing(mLetterSpacingInput);
|
||||
}
|
||||
}
|
||||
|
||||
private void setMaxFontSizeMultiplier(float maxFontSizeMultiplier) {
|
||||
if (maxFontSizeMultiplier != mMaxFontSizeMultiplier) {
|
||||
mMaxFontSizeMultiplier = maxFontSizeMultiplier;
|
||||
setFontSize(mFontSizeInput);
|
||||
setLineHeight(mLineHeightInput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,7 +434,7 @@ public class TextAttributeProps {
|
||||
if (fontSize != ReactConstants.UNSET) {
|
||||
fontSize =
|
||||
mAllowFontScaling
|
||||
? (float) Math.ceil(PixelUtil.toPixelFromSP(fontSize))
|
||||
? (float) Math.ceil(PixelUtil.toPixelFromSP(fontSize, mMaxFontSizeMultiplier))
|
||||
: (float) Math.ceil(PixelUtil.toPixelFromDIP(fontSize));
|
||||
}
|
||||
mFontSize = (int) fontSize;
|
||||
|
||||
-3
@@ -588,9 +588,6 @@ public class ReactViewGroup extends ViewGroup
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
checkViewClippingTag(child, Boolean.TRUE);
|
||||
if (!customDrawOrderDisabled()) {
|
||||
if (indexOfChild(child) == -1) {
|
||||
return;
|
||||
}
|
||||
getDrawingOrderHelper().handleRemoveView(child);
|
||||
setChildrenDrawingOrderEnabled(getDrawingOrderHelper().shouldEnableCustomDrawingOrder());
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -88,13 +88,13 @@ class BorderRadiusStyleTest {
|
||||
arrayOf(
|
||||
BorderRadiusProp.BORDER_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_START_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_END_END_RADIUS),
|
||||
ComputedBorderRadiusProp.COMPUTED_BORDER_BOTTOM_RIGHT_RADIUS to
|
||||
arrayOf(
|
||||
BorderRadiusProp.BORDER_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_LEFT_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_END_RADIUS,
|
||||
BorderRadiusProp.BORDER_BOTTOM_START_RADIUS,
|
||||
BorderRadiusProp.BORDER_START_END_RADIUS),
|
||||
)
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
namespace facebook::react {
|
||||
|
||||
constexpr struct {
|
||||
int32_t Major = 1000;
|
||||
int32_t Minor = 0;
|
||||
int32_t Patch = 0;
|
||||
int32_t Major = 0;
|
||||
int32_t Minor = 78;
|
||||
int32_t Patch = 3;
|
||||
std::string_view Prerelease = "";
|
||||
} ReactNativeVersion;
|
||||
|
||||
|
||||
+22
-4
@@ -123,6 +123,15 @@ std::vector<ExportedMethod> parseExportedMethods(std::string moduleName, Class m
|
||||
NSArray<RCTMethodArgument *> *arguments;
|
||||
SEL objCMethodSelector = NSSelectorFromString(RCTParseMethodSignature(methodInfo->objcName, &arguments));
|
||||
NSMethodSignature *objCMethodSignature = [moduleClass instanceMethodSignatureForSelector:objCMethodSelector];
|
||||
if (objCMethodSignature == nullptr) {
|
||||
RCTLogWarn(
|
||||
@"The objective-c `%s` method signature for the JS method `%@` can not be found in the ObjecitveC definition of the %s module.\nThe `%@` JS method will not be available.",
|
||||
methodInfo->objcName,
|
||||
jsMethodName,
|
||||
moduleName.c_str(),
|
||||
jsMethodName);
|
||||
continue;
|
||||
}
|
||||
std::string objCMethodReturnType = [objCMethodSignature methodReturnType];
|
||||
|
||||
if (objCMethodSignature.numberOfArguments - 2 != [arguments count]) {
|
||||
@@ -337,7 +346,7 @@ void ObjCInteropTurboModule::setInvocationArg(
|
||||
SEL selector = selectorForType(argumentType);
|
||||
|
||||
if ([RCTConvert respondsToSelector:selector]) {
|
||||
id objCArg = TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_);
|
||||
id objCArg = TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_, YES);
|
||||
|
||||
if (objCArgType == @encode(char)) {
|
||||
char arg = RCTConvertTo<char>(selector, objCArg);
|
||||
@@ -437,6 +446,15 @@ void ObjCInteropTurboModule::setInvocationArg(
|
||||
|
||||
if (objCArgType == @encode(id)) {
|
||||
id arg = RCTConvertTo<id>(selector, objCArg);
|
||||
|
||||
// Handle the special case where there is an argument and it must be nil
|
||||
// Without this check, the JS side will receive an object.
|
||||
// See: discussion at
|
||||
// https://github.com/facebook/react-native/pull/49250#issuecomment-2668465893
|
||||
if (arg == [NSNull null]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (arg) {
|
||||
[retainedObjectsForInvocation addObject:arg];
|
||||
}
|
||||
@@ -491,7 +509,7 @@ void ObjCInteropTurboModule::setInvocationArg(
|
||||
}
|
||||
|
||||
RCTResponseSenderBlock arg =
|
||||
(RCTResponseSenderBlock)TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_);
|
||||
(RCTResponseSenderBlock)TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_, YES);
|
||||
if (arg) {
|
||||
[retainedObjectsForInvocation addObject:arg];
|
||||
}
|
||||
@@ -506,7 +524,7 @@ void ObjCInteropTurboModule::setInvocationArg(
|
||||
}
|
||||
|
||||
RCTResponseSenderBlock senderBlock =
|
||||
(RCTResponseSenderBlock)TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_);
|
||||
(RCTResponseSenderBlock)TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_, YES);
|
||||
RCTResponseErrorBlock arg = ^(NSError *error) {
|
||||
senderBlock(@[ RCTJSErrorFromNSError(error) ]);
|
||||
};
|
||||
@@ -536,7 +554,7 @@ void ObjCInteropTurboModule::setInvocationArg(
|
||||
runtime, errorPrefix + "JavaScript argument must be a plain object. Got " + getType(runtime, jsiArg));
|
||||
}
|
||||
|
||||
id arg = TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_);
|
||||
id arg = TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_, YES);
|
||||
|
||||
RCTManagedPointer *(*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend;
|
||||
RCTManagedPointer *box = convert([RCTCxxConvert class], selector, arg);
|
||||
|
||||
+1
@@ -32,6 +32,7 @@ using EventEmitterCallback = std::function<void(const std::string &, id)>;
|
||||
namespace TurboModuleConvertUtils {
|
||||
jsi::Value convertObjCObjectToJSIValue(jsi::Runtime &runtime, id value);
|
||||
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker);
|
||||
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker, BOOL useNSNull);
|
||||
} // namespace TurboModuleConvertUtils
|
||||
|
||||
template <>
|
||||
|
||||
+40
-21
@@ -57,7 +57,7 @@ static jsi::Value convertNSNumberToJSINumber(jsi::Runtime &runtime, NSNumber *va
|
||||
|
||||
static jsi::String convertNSStringToJSIString(jsi::Runtime &runtime, NSString *value)
|
||||
{
|
||||
return jsi::String::createFromUtf8(runtime, [value UTF8String] ?: "");
|
||||
return jsi::String::createFromUtf8(runtime, [value UTF8String] ? [value UTF8String] : "");
|
||||
}
|
||||
|
||||
static jsi::Object convertNSDictionaryToJSIObject(jsi::Runtime &runtime, NSDictionary *value)
|
||||
@@ -112,20 +112,20 @@ static NSString *convertJSIStringToNSString(jsi::Runtime &runtime, const jsi::St
|
||||
}
|
||||
|
||||
static NSArray *
|
||||
convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value, std::shared_ptr<CallInvoker> jsInvoker)
|
||||
convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value, std::shared_ptr<CallInvoker> jsInvoker, BOOL useNSNull)
|
||||
{
|
||||
size_t size = value.size(runtime);
|
||||
NSMutableArray *result = [NSMutableArray new];
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
// Insert kCFNull when it's `undefined` value to preserve the indices.
|
||||
id convertedObject = convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i), jsInvoker);
|
||||
id convertedObject = convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i), jsInvoker, useNSNull);
|
||||
[result addObject:convertedObject ? convertedObject : (id)kCFNull];
|
||||
}
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
static NSDictionary *
|
||||
convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value, std::shared_ptr<CallInvoker> jsInvoker)
|
||||
convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value, std::shared_ptr<CallInvoker> jsInvoker, BOOL useNSNull)
|
||||
{
|
||||
jsi::Array propertyNames = value.getPropertyNames(runtime);
|
||||
size_t size = propertyNames.size(runtime);
|
||||
@@ -133,7 +133,7 @@ convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value,
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
jsi::String name = propertyNames.getValueAtIndex(runtime, i).getString(runtime);
|
||||
NSString *k = convertJSIStringToNSString(runtime, name);
|
||||
id v = convertJSIValueToObjCObject(runtime, value.getProperty(runtime, name), jsInvoker);
|
||||
id v = convertJSIValueToObjCObject(runtime, value.getProperty(runtime, name), jsInvoker, useNSNull);
|
||||
if (v) {
|
||||
result[k] = v;
|
||||
}
|
||||
@@ -159,11 +159,14 @@ convertJSIFunctionToCallback(jsi::Runtime &rt, jsi::Function &&function, std::sh
|
||||
};
|
||||
}
|
||||
|
||||
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker)
|
||||
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker, BOOL useNSNull)
|
||||
{
|
||||
if (value.isUndefined() || value.isNull()) {
|
||||
if (value.isUndefined() || (value.isNull() && !useNSNull)) {
|
||||
return nil;
|
||||
}
|
||||
if (value.isNull() && useNSNull) {
|
||||
return [NSNull null];
|
||||
}
|
||||
if (value.isBool()) {
|
||||
return @(value.getBool());
|
||||
}
|
||||
@@ -176,17 +179,22 @@ id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, s
|
||||
if (value.isObject()) {
|
||||
jsi::Object o = value.getObject(runtime);
|
||||
if (o.isArray(runtime)) {
|
||||
return convertJSIArrayToNSArray(runtime, o.getArray(runtime), jsInvoker);
|
||||
return convertJSIArrayToNSArray(runtime, o.getArray(runtime), jsInvoker, useNSNull);
|
||||
}
|
||||
if (o.isFunction(runtime)) {
|
||||
return convertJSIFunctionToCallback(runtime, o.getFunction(runtime), jsInvoker);
|
||||
}
|
||||
return convertJSIObjectToNSDictionary(runtime, o, jsInvoker);
|
||||
return convertJSIObjectToNSDictionary(runtime, o, jsInvoker, useNSNull);
|
||||
}
|
||||
|
||||
throw std::runtime_error("Unsupported jsi::Value kind");
|
||||
}
|
||||
|
||||
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker)
|
||||
{
|
||||
return convertJSIValueToObjCObject(runtime, value, jsInvoker, NO);
|
||||
}
|
||||
|
||||
static jsi::Value createJSRuntimeError(jsi::Runtime &runtime, const std::string &message)
|
||||
{
|
||||
return runtime.global().getPropertyAsFunction(runtime, "Error").call(runtime, message);
|
||||
@@ -195,7 +203,11 @@ static jsi::Value createJSRuntimeError(jsi::Runtime &runtime, const std::string
|
||||
/**
|
||||
* Creates JSError with current JS runtime and NSException stack trace.
|
||||
*/
|
||||
static jsi::JSError convertNSExceptionToJSError(jsi::Runtime &runtime, NSException *exception)
|
||||
static jsi::JSError convertNSExceptionToJSError(
|
||||
jsi::Runtime &runtime,
|
||||
NSException *exception,
|
||||
const std::string &moduleName,
|
||||
const std::string &methodName)
|
||||
{
|
||||
std::string reason = [exception.reason UTF8String];
|
||||
|
||||
@@ -206,7 +218,8 @@ static jsi::JSError convertNSExceptionToJSError(jsi::Runtime &runtime, NSExcepti
|
||||
cause.setProperty(
|
||||
runtime, "stackReturnAddresses", convertNSArrayToJSIArray(runtime, exception.callStackReturnAddresses));
|
||||
|
||||
jsi::Value error = createJSRuntimeError(runtime, "Exception in HostFunction: " + reason);
|
||||
std::string message = moduleName + "." + methodName + " raised an exception: " + reason;
|
||||
jsi::Value error = createJSRuntimeError(runtime, message);
|
||||
error.asObject(runtime).setProperty(runtime, "cause", std::move(cause));
|
||||
return {runtime, std::move(error)};
|
||||
}
|
||||
@@ -338,28 +351,34 @@ id ObjCTurboModule::performMethodInvocation(
|
||||
}
|
||||
|
||||
if (isSync) {
|
||||
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodNameStr.c_str());
|
||||
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodName);
|
||||
} else {
|
||||
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodNameStr.c_str(), asyncCallCounter);
|
||||
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodName, asyncCallCounter);
|
||||
}
|
||||
|
||||
@try {
|
||||
[inv invokeWithTarget:strongModule];
|
||||
} @catch (NSException *exception) {
|
||||
throw convertNSExceptionToJSError(runtime, exception);
|
||||
if (isSync) {
|
||||
// We can only convert NSException to JSError in sync method calls.
|
||||
// See https://github.com/reactwg/react-native-new-architecture/discussions/276#discussioncomment-12567155
|
||||
throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
|
||||
} else {
|
||||
@throw exception;
|
||||
}
|
||||
} @finally {
|
||||
[retainedObjectsForInvocation removeAllObjects];
|
||||
}
|
||||
|
||||
if (!isSync) {
|
||||
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodNameStr.c_str(), asyncCallCounter);
|
||||
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodName, asyncCallCounter);
|
||||
return;
|
||||
}
|
||||
|
||||
void *rawResult;
|
||||
[inv getReturnValue:&rawResult];
|
||||
result = (__bridge id)rawResult;
|
||||
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodNameStr.c_str());
|
||||
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodName);
|
||||
};
|
||||
|
||||
if (isSync) {
|
||||
@@ -401,23 +420,23 @@ void ObjCTurboModule::performVoidMethodInvocation(
|
||||
}
|
||||
|
||||
if (shouldVoidMethodsExecuteSync_) {
|
||||
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodNameStr.c_str());
|
||||
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodName);
|
||||
} else {
|
||||
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodNameStr.c_str(), asyncCallCounter);
|
||||
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodName, asyncCallCounter);
|
||||
}
|
||||
|
||||
@try {
|
||||
[inv invokeWithTarget:strongModule];
|
||||
} @catch (NSException *exception) {
|
||||
throw convertNSExceptionToJSError(runtime, exception);
|
||||
throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
|
||||
} @finally {
|
||||
[retainedObjectsForInvocation removeAllObjects];
|
||||
}
|
||||
|
||||
if (shouldVoidMethodsExecuteSync_) {
|
||||
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodNameStr.c_str());
|
||||
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodName);
|
||||
} else {
|
||||
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodNameStr.c_str(), asyncCallCounter);
|
||||
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodName, asyncCallCounter);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -46,6 +46,9 @@ void TextAttributes::apply(TextAttributes textAttributes) {
|
||||
allowFontScaling = textAttributes.allowFontScaling.has_value()
|
||||
? textAttributes.allowFontScaling
|
||||
: allowFontScaling;
|
||||
maxFontSizeMultiplier = !std::isnan(textAttributes.maxFontSizeMultiplier)
|
||||
? textAttributes.maxFontSizeMultiplier
|
||||
: maxFontSizeMultiplier;
|
||||
dynamicTypeRamp = textAttributes.dynamicTypeRamp.has_value()
|
||||
? textAttributes.dynamicTypeRamp
|
||||
: dynamicTypeRamp;
|
||||
@@ -168,6 +171,7 @@ bool TextAttributes::operator==(const TextAttributes& rhs) const {
|
||||
rhs.accessibilityRole,
|
||||
rhs.role,
|
||||
rhs.textTransform) &&
|
||||
floatEquality(maxFontSizeMultiplier, rhs.maxFontSizeMultiplier) &&
|
||||
floatEquality(opacity, rhs.opacity) &&
|
||||
floatEquality(fontSize, rhs.fontSize) &&
|
||||
floatEquality(fontSizeMultiplier, rhs.fontSizeMultiplier) &&
|
||||
@@ -224,6 +228,10 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const {
|
||||
"allowFontScaling",
|
||||
allowFontScaling,
|
||||
textAttributes.allowFontScaling),
|
||||
debugStringConvertibleItem(
|
||||
"maxFontSizeMultiplier",
|
||||
maxFontSizeMultiplier,
|
||||
textAttributes.maxFontSizeMultiplier),
|
||||
debugStringConvertibleItem(
|
||||
"dynamicTypeRamp", dynamicTypeRamp, textAttributes.dynamicTypeRamp),
|
||||
debugStringConvertibleItem(
|
||||
|
||||
@@ -51,6 +51,7 @@ class TextAttributes : public DebugStringConvertible {
|
||||
std::optional<FontStyle> fontStyle{};
|
||||
std::optional<FontVariant> fontVariant{};
|
||||
std::optional<bool> allowFontScaling{};
|
||||
Float maxFontSizeMultiplier{std::numeric_limits<Float>::quiet_NaN()};
|
||||
std::optional<DynamicTypeRamp> dynamicTypeRamp{};
|
||||
Float letterSpacing{std::numeric_limits<Float>::quiet_NaN()};
|
||||
std::optional<TextTransform> textTransform{};
|
||||
@@ -117,6 +118,7 @@ struct hash<facebook::react::TextAttributes> {
|
||||
textAttributes.opacity,
|
||||
textAttributes.fontFamily,
|
||||
textAttributes.fontSize,
|
||||
textAttributes.maxFontSizeMultiplier,
|
||||
textAttributes.fontSizeMultiplier,
|
||||
textAttributes.fontWeight,
|
||||
textAttributes.fontStyle,
|
||||
|
||||
@@ -910,6 +910,7 @@ constexpr static MapBuffer::Key TA_KEY_LINE_BREAK_STRATEGY = 25;
|
||||
constexpr static MapBuffer::Key TA_KEY_ROLE = 26;
|
||||
constexpr static MapBuffer::Key TA_KEY_TEXT_TRANSFORM = 27;
|
||||
constexpr static MapBuffer::Key TA_KEY_ALIGNMENT_VERTICAL = 28;
|
||||
constexpr static MapBuffer::Key TA_KEY_MAX_FONT_SIZE_MULTIPLIER = 29;
|
||||
|
||||
// constants for ParagraphAttributes serialization
|
||||
constexpr static MapBuffer::Key PA_KEY_MAX_NUMBER_OF_LINES = 0;
|
||||
@@ -1004,6 +1005,10 @@ inline MapBuffer toMapBuffer(const TextAttributes& textAttributes) {
|
||||
builder.putBool(
|
||||
TA_KEY_ALLOW_FONT_SCALING, *textAttributes.allowFontScaling);
|
||||
}
|
||||
if (!std::isnan(textAttributes.maxFontSizeMultiplier)) {
|
||||
builder.putDouble(
|
||||
TA_KEY_MAX_FONT_SIZE_MULTIPLIER, textAttributes.maxFontSizeMultiplier);
|
||||
}
|
||||
if (!std::isnan(textAttributes.letterSpacing)) {
|
||||
builder.putDouble(TA_KEY_LETTER_SPACING, textAttributes.letterSpacing);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user