mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da65b27f92 |
Vendored
-40
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
declare module 'jest-diff' {
|
||||
import type {CompareKeys} from 'pretty-format';
|
||||
|
||||
declare export type DiffOptionsColor = (arg: string) => string; // subset of Chalk type
|
||||
|
||||
declare export type DiffOptions = {
|
||||
aAnnotation?: string,
|
||||
aColor?: DiffOptionsColor,
|
||||
aIndicator?: string,
|
||||
bAnnotation?: string,
|
||||
bColor?: DiffOptionsColor,
|
||||
bIndicator?: string,
|
||||
changeColor?: DiffOptionsColor,
|
||||
changeLineTrailingSpaceColor?: DiffOptionsColor,
|
||||
commonColor?: DiffOptionsColor,
|
||||
commonIndicator?: string,
|
||||
commonLineTrailingSpaceColor?: DiffOptionsColor,
|
||||
contextLines?: number,
|
||||
emptyFirstOrLastLinePlaceholder?: string,
|
||||
expand?: boolean,
|
||||
includeChangeCounts?: boolean,
|
||||
omitAnnotationLines?: boolean,
|
||||
patchColor?: DiffOptionsColor,
|
||||
compareKeys?: CompareKeys,
|
||||
};
|
||||
|
||||
declare export function diff(
|
||||
a: mixed,
|
||||
b: mixed,
|
||||
options?: DiffOptions,
|
||||
): string | null;
|
||||
}
|
||||
+1
-4
@@ -19,6 +19,7 @@ declare type Colors = {
|
||||
tag: {close: string, open: string},
|
||||
value: {close: string, open: string},
|
||||
};
|
||||
declare type CompareKeys = ((a: string, b: string) => number) | null | void;
|
||||
|
||||
declare type PrettyFormatPlugin =
|
||||
| {
|
||||
@@ -37,10 +38,6 @@ declare type PrettyFormatPlugin =
|
||||
};
|
||||
|
||||
declare module 'pretty-format' {
|
||||
declare export type CompareKeys =
|
||||
| ((a: string, b: string) => number)
|
||||
| null
|
||||
| void;
|
||||
declare export function format(
|
||||
value: mixed,
|
||||
options?: ?{
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -25,5 +25,4 @@ module.exports = {
|
||||
transformIgnorePatterns: ['.*'],
|
||||
testRunner: './jest/integration/runner/index.js',
|
||||
watchPathIgnorePatterns: ['<rootDir>/jest/integration/build/'],
|
||||
globalSetup: './jest/integration/runner/warmup/index.js',
|
||||
};
|
||||
|
||||
@@ -12,29 +12,25 @@
|
||||
import type {TestSuiteResult} from '../runtime/setup';
|
||||
|
||||
import entrypointTemplate from './entrypoint-template';
|
||||
import {
|
||||
getBuckModeForPlatform,
|
||||
getDebugInfoFromCommandResult,
|
||||
getFantomTestConfig,
|
||||
getShortHash,
|
||||
runBuck2,
|
||||
symbolicateStackTrace,
|
||||
} from './utils';
|
||||
import {spawnSync} from 'child_process';
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
// $FlowExpectedError[untyped-import]
|
||||
import {formatResultsErrors} from 'jest-message-util';
|
||||
import Metro from 'metro';
|
||||
import nullthrows from 'nullthrows';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
const BUILD_OUTPUT_PATH = path.resolve(__dirname, '..', 'build');
|
||||
|
||||
const ENABLE_OPTIMIZED_MODE: false = false;
|
||||
const PRINT_FANTOM_OUTPUT: false = false;
|
||||
|
||||
function parseRNTesterCommandResult(result: ReturnType<typeof runBuck2>): {
|
||||
logs: string,
|
||||
testResult: TestSuiteResult,
|
||||
} {
|
||||
function parseRNTesterCommandResult(
|
||||
commandArgs: $ReadOnlyArray<string>,
|
||||
result: ReturnType<typeof spawnSync>,
|
||||
): {logs: string, testResult: TestSuiteResult} {
|
||||
const stdout = result.stdout.toString();
|
||||
|
||||
const outputArray = stdout
|
||||
@@ -50,26 +46,51 @@ function parseRNTesterCommandResult(result: ReturnType<typeof runBuck2>): {
|
||||
testResult = JSON.parse(nullthrows(testResultJSON));
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
'Failed to parse test results from RN tester binary result.\n' +
|
||||
getDebugInfoFromCommandResult(result),
|
||||
[
|
||||
'Failed to parse test results from RN tester binary result. Full output:',
|
||||
'buck2 ' + commandArgs.join(' '),
|
||||
'stdout:',
|
||||
stdout,
|
||||
'stderr:',
|
||||
result.stderr.toString(),
|
||||
].join('\n'),
|
||||
);
|
||||
}
|
||||
|
||||
return {logs: outputArray.join('\n'), testResult};
|
||||
}
|
||||
|
||||
function getBuckModeForPlatform() {
|
||||
const mode = ENABLE_OPTIMIZED_MODE ? 'opt' : 'dev';
|
||||
|
||||
switch (os.platform()) {
|
||||
case 'linux':
|
||||
return `@//arvr/mode/linux/${mode}`;
|
||||
case 'darwin':
|
||||
return os.arch() === 'arm64'
|
||||
? `@//arvr/mode/mac-arm/${mode}`
|
||||
: `@//arvr/mode/mac/${mode}`;
|
||||
case 'win32':
|
||||
return `@//arvr/mode/win/${mode}`;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${os.platform()}`);
|
||||
}
|
||||
}
|
||||
|
||||
function getShortHash(contents: string): string {
|
||||
return crypto.createHash('md5').update(contents).digest('hex').slice(0, 8);
|
||||
}
|
||||
|
||||
function generateBytecodeBundle({
|
||||
sourcePath,
|
||||
bytecodePath,
|
||||
isOptimizedMode,
|
||||
}: {
|
||||
sourcePath: string,
|
||||
bytecodePath: string,
|
||||
isOptimizedMode: boolean,
|
||||
}): void {
|
||||
const hermesCompilerCommandResult = runBuck2([
|
||||
const hermesCompilerCommandArgs = [
|
||||
'run',
|
||||
getBuckModeForPlatform(isOptimizedMode),
|
||||
getBuckModeForPlatform(),
|
||||
'//xplat/hermes/tools/hermesc:hermesc',
|
||||
'--',
|
||||
'-emit-binary',
|
||||
@@ -79,10 +100,33 @@ function generateBytecodeBundle({
|
||||
'-out',
|
||||
bytecodePath,
|
||||
sourcePath,
|
||||
]);
|
||||
];
|
||||
|
||||
const hermesCompilerCommandResult = spawnSync(
|
||||
'buck2',
|
||||
hermesCompilerCommandArgs,
|
||||
{
|
||||
encoding: 'utf8',
|
||||
env: {
|
||||
...process.env,
|
||||
PATH: `/usr/local/bin:${process.env.PATH ?? ''}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (hermesCompilerCommandResult.status !== 0) {
|
||||
throw new Error(getDebugInfoFromCommandResult(hermesCompilerCommandResult));
|
||||
throw new Error(
|
||||
[
|
||||
'Failed to run Hermes compiler. Full output:',
|
||||
'buck2 ' + hermesCompilerCommandArgs.join(' '),
|
||||
'stdout:',
|
||||
hermesCompilerCommandResult.stdout,
|
||||
'stderr:',
|
||||
hermesCompilerCommandResult.stderr,
|
||||
'error:',
|
||||
hermesCompilerCommandResult.error,
|
||||
].join('\n'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +139,7 @@ module.exports = async function runTest(
|
||||
): mixed {
|
||||
const startTime = Date.now();
|
||||
|
||||
const testConfig = getFantomTestConfig(testPath);
|
||||
|
||||
const isOptimizedMode = testConfig.mode === 'opt';
|
||||
const isOptimizedMode = ENABLE_OPTIMIZED_MODE;
|
||||
|
||||
const metroConfig = await Metro.loadConfig({
|
||||
config: path.resolve(__dirname, '..', 'config', 'metro.config.js'),
|
||||
@@ -121,54 +163,76 @@ module.exports = async function runTest(
|
||||
fs.mkdirSync(path.dirname(entrypointPath), {recursive: true});
|
||||
fs.writeFileSync(entrypointPath, entrypointContents, 'utf8');
|
||||
|
||||
const sourceMapPath = path.join(
|
||||
path.dirname(testJSBundlePath),
|
||||
path.basename(testJSBundlePath, '.js') + '.map',
|
||||
);
|
||||
|
||||
await Metro.runBuild(metroConfig, {
|
||||
entry: entrypointPath,
|
||||
out: testJSBundlePath,
|
||||
platform: 'android',
|
||||
minify: isOptimizedMode,
|
||||
dev: !isOptimizedMode,
|
||||
sourceMap: true,
|
||||
sourceMapUrl: sourceMapPath,
|
||||
});
|
||||
|
||||
if (isOptimizedMode) {
|
||||
generateBytecodeBundle({
|
||||
sourcePath: testJSBundlePath,
|
||||
bytecodePath: testBytecodeBundlePath,
|
||||
isOptimizedMode,
|
||||
});
|
||||
}
|
||||
|
||||
const rnTesterCommandResult = runBuck2([
|
||||
const rnTesterCommandArgs = [
|
||||
'run',
|
||||
getBuckModeForPlatform(isOptimizedMode),
|
||||
getBuckModeForPlatform(),
|
||||
'//xplat/ReactNative/react-native-cxx/samples/tester:tester',
|
||||
'--',
|
||||
'--bundlePath',
|
||||
testBundlePath,
|
||||
]);
|
||||
];
|
||||
const rnTesterCommandResult = spawnSync('buck2', rnTesterCommandArgs, {
|
||||
encoding: 'utf8',
|
||||
env: {
|
||||
...process.env,
|
||||
PATH: `/usr/local/bin:${process.env.PATH ?? ''}`,
|
||||
},
|
||||
});
|
||||
|
||||
if (rnTesterCommandResult.status !== 0) {
|
||||
throw new Error(getDebugInfoFromCommandResult(rnTesterCommandResult));
|
||||
throw new Error(
|
||||
[
|
||||
'Failed to run test in RN tester binary. Full output:',
|
||||
'buck2 ' + rnTesterCommandArgs.join(' '),
|
||||
'stdout:',
|
||||
rnTesterCommandResult.stdout,
|
||||
'stderr:',
|
||||
rnTesterCommandResult.stderr,
|
||||
'error:',
|
||||
rnTesterCommandResult.error,
|
||||
].join('\n'),
|
||||
);
|
||||
}
|
||||
|
||||
if (PRINT_FANTOM_OUTPUT) {
|
||||
console.log(getDebugInfoFromCommandResult(rnTesterCommandResult));
|
||||
console.log(
|
||||
[
|
||||
'RN tester binary. Full output:',
|
||||
'buck2 ' + rnTesterCommandArgs.join(' '),
|
||||
'stdout:',
|
||||
rnTesterCommandResult.stdout,
|
||||
'stderr:',
|
||||
rnTesterCommandResult.stderr,
|
||||
'error:',
|
||||
rnTesterCommandResult.error,
|
||||
].join('\n'),
|
||||
);
|
||||
}
|
||||
|
||||
const rnTesterParsedOutput = parseRNTesterCommandResult(
|
||||
rnTesterCommandArgs,
|
||||
rnTesterCommandResult,
|
||||
);
|
||||
|
||||
const testResultError = rnTesterParsedOutput.testResult.error;
|
||||
if (testResultError) {
|
||||
const error = new Error(testResultError.message);
|
||||
error.stack = symbolicateStackTrace(sourceMapPath, testResultError.stack);
|
||||
error.stack = testResultError.stack;
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -184,9 +248,6 @@ module.exports = async function runTest(
|
||||
failureDetails: [] as Array<string>,
|
||||
testFilePath: testPath,
|
||||
...testResult,
|
||||
failureMessages: testResult.failureMessages.map(maybeStackTrace =>
|
||||
symbolicateStackTrace(sourceMapPath, maybeStackTrace),
|
||||
),
|
||||
})) ?? [];
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import {spawnSync} from 'child_process';
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
// $FlowExpectedError[untyped-import]
|
||||
import {extract, parse} from 'jest-docblock';
|
||||
import os from 'os';
|
||||
// $FlowExpectedError[untyped-import]
|
||||
import {SourceMapConsumer} from 'source-map';
|
||||
|
||||
type DocblockPragmas = {[key: string]: string | string[]};
|
||||
type FantomTestMode = 'dev' | 'opt';
|
||||
type FantomTestConfig = {
|
||||
mode: FantomTestMode,
|
||||
};
|
||||
|
||||
const DEFAULT_MODE: FantomTestMode = 'dev';
|
||||
|
||||
/**
|
||||
* Extracts the Fantom configuration from the test file, specified as part of
|
||||
* the docblock comment. E.g.:
|
||||
*
|
||||
* ```
|
||||
* /**
|
||||
* * @flow strict-local
|
||||
* * @fantom mode:opt
|
||||
* *
|
||||
* ```
|
||||
*
|
||||
* So far the only supported option is `mode`, which can be 'dev' or 'opt'.
|
||||
*/
|
||||
export function getFantomTestConfig(testPath: string): FantomTestConfig {
|
||||
const docblock = extract(fs.readFileSync(testPath, 'utf8'));
|
||||
const pragmas = parse(docblock) as DocblockPragmas;
|
||||
|
||||
const config = {
|
||||
mode: DEFAULT_MODE,
|
||||
};
|
||||
|
||||
const maybeMode = pragmas.fantom_mode;
|
||||
|
||||
if (maybeMode != null) {
|
||||
if (Array.isArray(maybeMode)) {
|
||||
throw new Error('Expected a single value for @fantom_mode');
|
||||
}
|
||||
|
||||
const mode = maybeMode;
|
||||
|
||||
if (mode === 'dev' || mode === 'opt') {
|
||||
config.mode = mode;
|
||||
} else {
|
||||
throw new Error(`Invalid Fantom mode: ${mode}`);
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
export function getBuckModeForPlatform(enableRelease: boolean = false): string {
|
||||
const mode = enableRelease ? 'opt' : 'dev';
|
||||
|
||||
switch (os.platform()) {
|
||||
case 'linux':
|
||||
return `@//arvr/mode/linux/${mode}`;
|
||||
case 'darwin':
|
||||
return os.arch() === 'arm64'
|
||||
? `@//arvr/mode/mac-arm/${mode}`
|
||||
: `@//arvr/mode/mac/${mode}`;
|
||||
case 'win32':
|
||||
return `@//arvr/mode/win/${mode}`;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${os.platform()}`);
|
||||
}
|
||||
}
|
||||
|
||||
type SpawnResultWithOriginalCommand = {
|
||||
...ReturnType<typeof spawnSync>,
|
||||
originalCommand: string,
|
||||
...
|
||||
};
|
||||
|
||||
export function runBuck2(args: Array<string>): SpawnResultWithOriginalCommand {
|
||||
const result = spawnSync('buck2', args, {
|
||||
encoding: 'utf8',
|
||||
env: {
|
||||
...process.env,
|
||||
PATH: `/usr/local/bin:${process.env.PATH ?? ''}`,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
...result,
|
||||
originalCommand: `buck2 ${args.join(' ')}`,
|
||||
};
|
||||
}
|
||||
|
||||
export function getDebugInfoFromCommandResult(
|
||||
commandResult: SpawnResultWithOriginalCommand,
|
||||
): string {
|
||||
const logLines = [
|
||||
`Command ${commandResult.status === 0 ? 'succeeded' : 'failed'}: ${commandResult.originalCommand}`,
|
||||
'',
|
||||
'stdout:',
|
||||
commandResult.stdout,
|
||||
'',
|
||||
'stderr:',
|
||||
commandResult.stderr,
|
||||
];
|
||||
|
||||
if (commandResult.error) {
|
||||
logLines.push('', 'error:', String(commandResult.error));
|
||||
}
|
||||
|
||||
return logLines.join('\n');
|
||||
}
|
||||
|
||||
export function getShortHash(contents: string): string {
|
||||
return crypto.createHash('md5').update(contents).digest('hex').slice(0, 8);
|
||||
}
|
||||
|
||||
export function symbolicateStackTrace(
|
||||
sourceMapPath: string,
|
||||
stackTrace: string,
|
||||
): string {
|
||||
const sourceMapData = JSON.parse(fs.readFileSync(sourceMapPath, 'utf8'));
|
||||
const consumer = new SourceMapConsumer(sourceMapData);
|
||||
|
||||
return stackTrace
|
||||
.split('\n')
|
||||
.map(line => {
|
||||
const match = line.match(/at (.*) \((.*):(\d+):(\d+)\)/);
|
||||
if (match) {
|
||||
const functionName = match[1];
|
||||
// const fileName = match[2];
|
||||
const lineNumber = parseInt(match[3], 10);
|
||||
const columnNumber = parseInt(match[4], 10);
|
||||
// Get the original position
|
||||
const originalPosition = consumer.originalPositionFor({
|
||||
line: lineNumber,
|
||||
column: columnNumber,
|
||||
});
|
||||
return `at ${originalPosition.name ?? functionName} (${originalPosition.source}:${originalPosition.line}:${originalPosition.column})`;
|
||||
} else {
|
||||
return line;
|
||||
}
|
||||
})
|
||||
.join('\n');
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
require('../../../../scripts/build/babel-register').registerForMonorepo();
|
||||
|
||||
module.exports = require('./warmup');
|
||||
@@ -1,97 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import {
|
||||
getBuckModeForPlatform,
|
||||
getDebugInfoFromCommandResult,
|
||||
runBuck2,
|
||||
} from '../utils';
|
||||
// $FlowExpectedError[untyped-import]
|
||||
import fs from 'fs';
|
||||
import Metro from 'metro';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
export default async function warmUp(
|
||||
globalConfig: {...},
|
||||
projectConfig: {...},
|
||||
): Promise<void> {
|
||||
try {
|
||||
warmUpHermesCompiler();
|
||||
warmUpRNTesterCLI();
|
||||
await warmUpMetro();
|
||||
} catch (e) {
|
||||
// Sandcastle fails to parse the test output if we log stuff to stdout/stderr.
|
||||
if ((process.env.SANDCASTLE ?? '') !== '') {
|
||||
console.error(
|
||||
'Global warmup failed. Tests will continue to run but will likely fail. Details:\n',
|
||||
e,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function warmUpMetro(): Promise<void> {
|
||||
const metroConfig = await Metro.loadConfig({
|
||||
config: path.resolve(__dirname, '..', '..', 'config', 'metro.config.js'),
|
||||
});
|
||||
|
||||
const entrypointPath = path.resolve(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'runtime',
|
||||
'WarmUpEntryPoint.js',
|
||||
);
|
||||
|
||||
const bundlePath = path.join(
|
||||
os.tmpdir(),
|
||||
`fantom-warmup-bundle-${Date.now()}.js`,
|
||||
);
|
||||
|
||||
await Metro.runBuild(metroConfig, {
|
||||
entry: entrypointPath,
|
||||
out: bundlePath,
|
||||
platform: 'android',
|
||||
minify: false,
|
||||
dev: true,
|
||||
});
|
||||
|
||||
try {
|
||||
fs.unlinkSync(bundlePath);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
function warmUpHermesCompiler(): void {
|
||||
const buildHermesCompilerCommandResult = runBuck2([
|
||||
'build',
|
||||
getBuckModeForPlatform(),
|
||||
'//xplat/hermes/tools/hermesc:hermesc',
|
||||
]);
|
||||
|
||||
if (buildHermesCompilerCommandResult.status !== 0) {
|
||||
throw new Error(
|
||||
getDebugInfoFromCommandResult(buildHermesCompilerCommandResult),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function warmUpRNTesterCLI(): void {
|
||||
const buildRNTesterCommandResult = runBuck2([
|
||||
'build',
|
||||
getBuckModeForPlatform(),
|
||||
'//xplat/ReactNative/react-native-cxx/samples/tester:tester',
|
||||
]);
|
||||
|
||||
if (buildRNTesterCommandResult.status !== 0) {
|
||||
throw new Error(getDebugInfoFromCommandResult(buildRNTesterCommandResult));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is just an entrypoint to warm up the Metro cache before the tests run.
|
||||
*/
|
||||
|
||||
import 'react-native/Libraries/Core/InitializeCore.js';
|
||||
import 'react-native/src/private/__tests__/ReactNativeTester';
|
||||
import './setup';
|
||||
@@ -194,10 +194,7 @@ class ErrorWithCustomBlame extends Error {
|
||||
this.#cachedProcessedStack = originalStack;
|
||||
} else {
|
||||
const lines = originalStack.split('\n');
|
||||
const index = lines.findIndex(line =>
|
||||
/at (.*) \((.*):(\d+):(\d+)\)/.test(line),
|
||||
);
|
||||
lines.splice(index > -1 ? index : 1, this.#ignoredFrameCount);
|
||||
lines.splice(1, this.#ignoredFrameCount);
|
||||
this.#cachedProcessedStack = lines.join('\n');
|
||||
}
|
||||
}
|
||||
@@ -310,48 +307,6 @@ class Expect {
|
||||
}
|
||||
}
|
||||
|
||||
toBeGreaterThanOrEqual(expected: number): void {
|
||||
if (typeof this.#received !== 'number') {
|
||||
throw new ErrorWithCustomBlame(
|
||||
`Expected ${String(this.#received)} to be a number but it was a ${typeof this.#received}`,
|
||||
).blameToPreviousFrame();
|
||||
}
|
||||
|
||||
if (typeof expected !== 'number') {
|
||||
throw new ErrorWithCustomBlame(
|
||||
`Expected ${String(expected)} to be a number but it was a ${typeof expected}`,
|
||||
).blameToPreviousFrame();
|
||||
}
|
||||
|
||||
const pass = this.#received >= expected;
|
||||
if (!this.#isExpectedResult(pass)) {
|
||||
throw new ErrorWithCustomBlame(
|
||||
`Expected ${String(this.#received)}${this.#maybeNotLabel()} to be greater than or equal to ${expected}`,
|
||||
).blameToPreviousFrame();
|
||||
}
|
||||
}
|
||||
|
||||
toBeLessThanOrEqual(expected: number): void {
|
||||
if (typeof this.#received !== 'number') {
|
||||
throw new ErrorWithCustomBlame(
|
||||
`Expected ${String(this.#received)} to be a number but it was a ${typeof this.#received}`,
|
||||
).blameToPreviousFrame();
|
||||
}
|
||||
|
||||
if (typeof expected !== 'number') {
|
||||
throw new ErrorWithCustomBlame(
|
||||
`Expected ${String(expected)} to be a number but it was a ${typeof expected}`,
|
||||
).blameToPreviousFrame();
|
||||
}
|
||||
|
||||
const pass = this.#received <= expected;
|
||||
if (!this.#isExpectedResult(pass)) {
|
||||
throw new ErrorWithCustomBlame(
|
||||
`Expected ${String(this.#received)}${this.#maybeNotLabel()} to be less than or equal to ${expected}`,
|
||||
).blameToPreviousFrame();
|
||||
}
|
||||
}
|
||||
|
||||
#isExpectedResult(pass: boolean): boolean {
|
||||
return this.#isNot ? !pass : pass;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
"hermes-transform": "0.25.1",
|
||||
"inquirer": "^7.1.0",
|
||||
"jest": "^29.6.3",
|
||||
"jest-diff": "^29.7.0",
|
||||
"jest-junit": "^10.0.0",
|
||||
"jscodeshift": "^0.14.0",
|
||||
"metro-babel-register": "^0.81.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@generated SignedSource<<cecad43da3fd917e15322ee3efbed875>>
|
||||
Git revision: 486803f6bf272e0629297265dee8048a2f1269dd
|
||||
@generated SignedSource<<6b92b66e59525cef52902139f863f175>>
|
||||
Git revision: b61aae3ccc6e2684dfbf1e2a06b0f985b459f11f
|
||||
Built with --nohooks: false
|
||||
Is local checkout: false
|
||||
Remote URL: https://github.com/facebookexperimental/rn-chrome-devtools-frontend
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -42,7 +42,7 @@ import*as e from"../../ui/legacy/legacy.js";import*as t from"../../core/host/hos
|
||||
<p>${d(a.docsDebuggingBasicsDetail)}</p>
|
||||
</div>
|
||||
</button>
|
||||
<button class="rn-welcome-docsfeed-item" type="button" role="link" @click=${this.#o.bind(this,"https://reactnative.dev/docs/react-native-devtools")} title=${d(a.docsReactNativeDevTools)}>
|
||||
<button class="rn-welcome-docsfeed-item" type="button" role="link" @click=${this.#o.bind(this,"https://reactnative.dev/docs/react-devtools")} title=${d(a.docsReactNativeDevTools)}>
|
||||
<div class="rn-welcome-image" style="background-image: url('${c}')"></div>
|
||||
<div>
|
||||
<p class="devtools-link">${d(a.docsReactNativeDevTools)}</p>
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+3
-7
@@ -12,7 +12,6 @@ import com.facebook.react.utils.detectOSAwareHermesCommand
|
||||
import com.facebook.react.utils.moveTo
|
||||
import com.facebook.react.utils.windowsAwareCommandLine
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileTree
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
@@ -20,7 +19,6 @@ import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.process.ExecOperations
|
||||
|
||||
abstract class BundleHermesCTask : DefaultTask() {
|
||||
|
||||
@@ -28,8 +26,6 @@ abstract class BundleHermesCTask : DefaultTask() {
|
||||
group = "react"
|
||||
}
|
||||
|
||||
@get:Inject abstract val execOperations: ExecOperations
|
||||
|
||||
@get:Internal abstract val root: DirectoryProperty
|
||||
|
||||
@get:InputFiles
|
||||
@@ -131,9 +127,9 @@ abstract class BundleHermesCTask : DefaultTask() {
|
||||
File(jsIntermediateSourceMapsDir.get().asFile, "$bundleAssetName.compiler.map")
|
||||
|
||||
private fun runCommand(command: List<Any>) {
|
||||
execOperations.exec { exec ->
|
||||
exec.workingDir(root.get().asFile)
|
||||
exec.commandLine(command)
|
||||
project.exec {
|
||||
it.workingDir(root.get().asFile)
|
||||
it.commandLine(command)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -559,7 +559,7 @@ if (global.nativeLoggingHook) {
|
||||
let originalConsoleError = console.error;
|
||||
console.reportErrorsAsExceptions = true;
|
||||
function stringifySafe(arg) {
|
||||
return inspect(arg, {depth: 10}).replace(/\n\s*/g, ' ');
|
||||
return inspect(arg, {depth: 10}).replaceAll(/\n\s*/g, ' ');
|
||||
}
|
||||
console.error = function (...args) {
|
||||
originalConsoleError.apply(this, args);
|
||||
|
||||
+1
-1
@@ -327,7 +327,7 @@ export interface NativeModuleBooleanTypeAnnotation {
|
||||
|
||||
export type NativeModuleEnumMember = {
|
||||
readonly name: string;
|
||||
readonly value: NativeModuleStringLiteralTypeAnnotation | NativeModuleNumberLiteralTypeAnnotation,
|
||||
readonly value: string | number;
|
||||
};
|
||||
|
||||
export type NativeModuleEnumMemberType =
|
||||
|
||||
+1
-1
@@ -311,7 +311,7 @@ export type NativeModuleNumberTypeAnnotation = $ReadOnly<{
|
||||
|
||||
export type NativeModuleEnumMember = {
|
||||
name: string,
|
||||
value: StringLiteralTypeAnnotation | NumberLiteralTypeAnnotation,
|
||||
value: string | number,
|
||||
};
|
||||
|
||||
export type NativeModuleEnumMemberType =
|
||||
|
||||
@@ -96,7 +96,7 @@ function combineSchemasInFileListAndWriteToFile(
|
||||
exclude: ?RegExp,
|
||||
): void {
|
||||
const combined = combineSchemasInFileList(fileList, platform, exclude);
|
||||
const formattedSchema = JSON.stringify(combined);
|
||||
const formattedSchema = JSON.stringify(combined, null, 2);
|
||||
fs.writeFileSync(outfile, formattedSchema);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,4 +84,4 @@ for (const file of schemaFiles) {
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(output, JSON.stringify({modules}));
|
||||
fs.writeFileSync(output, JSON.stringify({modules}, null, 2));
|
||||
|
||||
@@ -406,14 +406,6 @@ struct Bridging<${enumName}> {
|
||||
};`;
|
||||
};
|
||||
|
||||
function getMemberValueAppearance(member: NativeModuleEnumMember['value']) {
|
||||
if (member.type === 'StringLiteralTypeAnnotation') {
|
||||
return `"${member.value}"`;
|
||||
} else {
|
||||
return member.value;
|
||||
}
|
||||
}
|
||||
|
||||
function generateEnum(
|
||||
hasteModuleName: string,
|
||||
origEnumName: string,
|
||||
@@ -425,6 +417,9 @@ function generateEnum(
|
||||
const nativeEnumMemberType: NativeEnumMemberValueType =
|
||||
memberType === 'StringTypeAnnotation' ? 'std::string' : 'int32_t';
|
||||
|
||||
const getMemberValueAppearance = (value: string | number) =>
|
||||
memberType === 'StringTypeAnnotation' ? `"${value}"` : `${value}`;
|
||||
|
||||
const fromCases =
|
||||
members
|
||||
.map(
|
||||
|
||||
+15
-60
@@ -163,17 +163,11 @@ const SIMPLE_NATIVE_MODULES: SchemaType = {
|
||||
members: [
|
||||
{
|
||||
name: 'ONE',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 1,
|
||||
},
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
name: 'TWO',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 2,
|
||||
},
|
||||
value: '2',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -184,24 +178,15 @@ const SIMPLE_NATIVE_MODULES: SchemaType = {
|
||||
members: [
|
||||
{
|
||||
name: 'POINT_ZERO',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 0.0,
|
||||
},
|
||||
value: '0.0',
|
||||
},
|
||||
{
|
||||
name: 'POINT_ONE',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 0.1,
|
||||
},
|
||||
value: '0.1',
|
||||
},
|
||||
{
|
||||
name: 'POINT_TWO',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 0.2,
|
||||
},
|
||||
value: '0.2',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -212,17 +197,11 @@ const SIMPLE_NATIVE_MODULES: SchemaType = {
|
||||
members: [
|
||||
{
|
||||
name: 'HELLO',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 'hello',
|
||||
},
|
||||
value: 'hello',
|
||||
},
|
||||
{
|
||||
name: 'GoodBye',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 'goodbye',
|
||||
},
|
||||
value: 'goodbye',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -1947,17 +1926,11 @@ const CXX_ONLY_NATIVE_MODULES: SchemaType = {
|
||||
members: [
|
||||
{
|
||||
name: 'IA',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 23,
|
||||
},
|
||||
value: '23',
|
||||
},
|
||||
{
|
||||
name: 'IB',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 42,
|
||||
},
|
||||
value: '42',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -1968,17 +1941,11 @@ const CXX_ONLY_NATIVE_MODULES: SchemaType = {
|
||||
members: [
|
||||
{
|
||||
name: 'FA',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 1.23,
|
||||
},
|
||||
value: '1.23',
|
||||
},
|
||||
{
|
||||
name: 'FB',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 4.56,
|
||||
},
|
||||
value: '4.56',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -1989,17 +1956,11 @@ const CXX_ONLY_NATIVE_MODULES: SchemaType = {
|
||||
members: [
|
||||
{
|
||||
name: 'NA',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 'NA',
|
||||
},
|
||||
value: 'NA',
|
||||
},
|
||||
{
|
||||
name: 'NB',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 'NB',
|
||||
},
|
||||
value: 'NB',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -2010,17 +1971,11 @@ const CXX_ONLY_NATIVE_MODULES: SchemaType = {
|
||||
members: [
|
||||
{
|
||||
name: 'SA',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 's---a',
|
||||
},
|
||||
value: 's---a',
|
||||
},
|
||||
{
|
||||
name: 'SB',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 's---b',
|
||||
},
|
||||
value: 's---b',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
+2
-2
@@ -2047,7 +2047,7 @@ template <>
|
||||
struct Bridging<NativeSampleTurboModuleFloatEnum> {
|
||||
static NativeSampleTurboModuleFloatEnum fromJs(jsi::Runtime &rt, const jsi::Value &rawValue) {
|
||||
double value = (double)rawValue.asNumber();
|
||||
if (value == 0) {
|
||||
if (value == 0.0) {
|
||||
return NativeSampleTurboModuleFloatEnum::POINT_ZERO;
|
||||
} else if (value == 0.1) {
|
||||
return NativeSampleTurboModuleFloatEnum::POINT_ONE;
|
||||
@@ -2060,7 +2060,7 @@ struct Bridging<NativeSampleTurboModuleFloatEnum> {
|
||||
|
||||
static jsi::Value toJs(jsi::Runtime &rt, NativeSampleTurboModuleFloatEnum value) {
|
||||
if (value == NativeSampleTurboModuleFloatEnum::POINT_ZERO) {
|
||||
return bridging::toJs(rt, 0);
|
||||
return bridging::toJs(rt, 0.0);
|
||||
} else if (value == NativeSampleTurboModuleFloatEnum::POINT_ONE) {
|
||||
return bridging::toJs(rt, 0.1);
|
||||
} else if (value == NativeSampleTurboModuleFloatEnum::POINT_TWO) {
|
||||
|
||||
+4
-16
@@ -478,17 +478,11 @@ describe('typeEnumResolution', () => {
|
||||
members: [
|
||||
{
|
||||
name: 'Hello',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 'hello',
|
||||
},
|
||||
value: 'hello',
|
||||
},
|
||||
{
|
||||
name: 'Goodbye',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 'goodbye',
|
||||
},
|
||||
value: 'goodbye',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -527,17 +521,11 @@ describe('typeEnumResolution', () => {
|
||||
members: [
|
||||
{
|
||||
name: 'On',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 1,
|
||||
},
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
name: 'Off',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 0,
|
||||
},
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
+15
-60
@@ -147,17 +147,11 @@ exports[`RN Codegen Flow Parser can generate fixture CXX_ONLY_NATIVE_MODULE 1`]
|
||||
'members': [
|
||||
{
|
||||
'name': 'SD',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'SD'
|
||||
}
|
||||
'value': 'SD'
|
||||
},
|
||||
{
|
||||
'name': 'HD',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'HD'
|
||||
}
|
||||
'value': 'HD'
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -168,24 +162,15 @@ exports[`RN Codegen Flow Parser can generate fixture CXX_ONLY_NATIVE_MODULE 1`]
|
||||
'members': [
|
||||
{
|
||||
'name': 'Corrupted',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': -1
|
||||
}
|
||||
'value': -1
|
||||
},
|
||||
{
|
||||
'name': 'Low',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': 720
|
||||
}
|
||||
'value': 720
|
||||
},
|
||||
{
|
||||
'name': 'High',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': 1080
|
||||
}
|
||||
'value': 1080
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -196,24 +181,15 @@ exports[`RN Codegen Flow Parser can generate fixture CXX_ONLY_NATIVE_MODULE 1`]
|
||||
'members': [
|
||||
{
|
||||
'name': 'One',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'one'
|
||||
}
|
||||
'value': 'one'
|
||||
},
|
||||
{
|
||||
'name': 'Two',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'two'
|
||||
}
|
||||
'value': 'two'
|
||||
},
|
||||
{
|
||||
'name': 'Three',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'three'
|
||||
}
|
||||
'value': 'three'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -495,17 +471,11 @@ exports[`RN Codegen Flow Parser can generate fixture IOS_ONLY_NATIVE_MODULE 1`]
|
||||
'members': [
|
||||
{
|
||||
'name': 'SD',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'SD'
|
||||
}
|
||||
'value': 'SD'
|
||||
},
|
||||
{
|
||||
'name': 'HD',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'HD'
|
||||
}
|
||||
'value': 'HD'
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -516,17 +486,11 @@ exports[`RN Codegen Flow Parser can generate fixture IOS_ONLY_NATIVE_MODULE 1`]
|
||||
'members': [
|
||||
{
|
||||
'name': 'Low',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': 720
|
||||
}
|
||||
'value': 720
|
||||
},
|
||||
{
|
||||
'name': 'High',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': 1080
|
||||
}
|
||||
'value': 1080
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -537,24 +501,15 @@ exports[`RN Codegen Flow Parser can generate fixture IOS_ONLY_NATIVE_MODULE 1`]
|
||||
'members': [
|
||||
{
|
||||
'name': 'One',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'one'
|
||||
}
|
||||
'value': 'one'
|
||||
},
|
||||
{
|
||||
'name': 'Two',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'two'
|
||||
}
|
||||
'value': 'two'
|
||||
},
|
||||
{
|
||||
'name': 'Three',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'three'
|
||||
}
|
||||
'value': 'three'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+4
-22
@@ -230,28 +230,10 @@ class FlowParser implements Parser {
|
||||
parseEnumMembers(
|
||||
typeAnnotation: $FlowFixMe,
|
||||
): $ReadOnlyArray<NativeModuleEnumMember> {
|
||||
return typeAnnotation.members.map(member => {
|
||||
const value =
|
||||
typeof member.init?.value === 'number'
|
||||
? {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: member.init.value,
|
||||
}
|
||||
: typeof member.init?.value === 'string'
|
||||
? {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.init.value,
|
||||
}
|
||||
: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.id.name,
|
||||
};
|
||||
|
||||
return {
|
||||
name: member.id.name,
|
||||
value: value,
|
||||
};
|
||||
});
|
||||
return typeAnnotation.members.map(member => ({
|
||||
name: member.id.name,
|
||||
value: member.init?.value ?? member.id.name,
|
||||
}));
|
||||
}
|
||||
|
||||
isModuleInterface(node: $FlowFixMe): boolean {
|
||||
|
||||
+4
-16
@@ -175,33 +175,21 @@ export class MockedParser implements Parser {
|
||||
? [
|
||||
{
|
||||
name: 'Hello',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 'hello',
|
||||
},
|
||||
value: 'hello',
|
||||
},
|
||||
{
|
||||
name: 'Goodbye',
|
||||
value: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: 'goodbye',
|
||||
},
|
||||
value: 'goodbye',
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
name: 'On',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 1,
|
||||
},
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
name: 'Off',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 0,
|
||||
},
|
||||
value: '0',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
+15
-60
@@ -134,17 +134,11 @@ exports[`RN Codegen TypeScript Parser can generate fixture CXX_ONLY_NATIVE_MODUL
|
||||
'members': [
|
||||
{
|
||||
'name': 'SD',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'SD'
|
||||
}
|
||||
'value': 'SD'
|
||||
},
|
||||
{
|
||||
'name': 'HD',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'HD'
|
||||
}
|
||||
'value': 'HD'
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -155,24 +149,15 @@ exports[`RN Codegen TypeScript Parser can generate fixture CXX_ONLY_NATIVE_MODUL
|
||||
'members': [
|
||||
{
|
||||
'name': 'Corrupted',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': -1
|
||||
}
|
||||
'value': -1
|
||||
},
|
||||
{
|
||||
'name': 'Low',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': 720
|
||||
}
|
||||
'value': 720
|
||||
},
|
||||
{
|
||||
'name': 'High',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': 1080
|
||||
}
|
||||
'value': 1080
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -183,24 +168,15 @@ exports[`RN Codegen TypeScript Parser can generate fixture CXX_ONLY_NATIVE_MODUL
|
||||
'members': [
|
||||
{
|
||||
'name': 'One',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'one'
|
||||
}
|
||||
'value': 'one'
|
||||
},
|
||||
{
|
||||
'name': 'Two',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'two'
|
||||
}
|
||||
'value': 'two'
|
||||
},
|
||||
{
|
||||
'name': 'Three',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'three'
|
||||
}
|
||||
'value': 'three'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -482,17 +458,11 @@ exports[`RN Codegen TypeScript Parser can generate fixture IOS_ONLY_NATIVE_MODUL
|
||||
'members': [
|
||||
{
|
||||
'name': 'SD',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'SD'
|
||||
}
|
||||
'value': 'SD'
|
||||
},
|
||||
{
|
||||
'name': 'HD',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'HD'
|
||||
}
|
||||
'value': 'HD'
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -503,17 +473,11 @@ exports[`RN Codegen TypeScript Parser can generate fixture IOS_ONLY_NATIVE_MODUL
|
||||
'members': [
|
||||
{
|
||||
'name': 'Low',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': 720
|
||||
}
|
||||
'value': 720
|
||||
},
|
||||
{
|
||||
'name': 'High',
|
||||
'value': {
|
||||
'type': 'NumberLiteralTypeAnnotation',
|
||||
'value': 1080
|
||||
}
|
||||
'value': 1080
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -524,24 +488,15 @@ exports[`RN Codegen TypeScript Parser can generate fixture IOS_ONLY_NATIVE_MODUL
|
||||
'members': [
|
||||
{
|
||||
'name': 'One',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'one'
|
||||
}
|
||||
'value': 'one'
|
||||
},
|
||||
{
|
||||
'name': 'Two',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'two'
|
||||
}
|
||||
'value': 'two'
|
||||
},
|
||||
{
|
||||
'name': 'Three',
|
||||
'value': {
|
||||
'type': 'StringLiteralTypeAnnotation',
|
||||
'value': 'three'
|
||||
}
|
||||
'value': 'three'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+5
-35
@@ -124,27 +124,9 @@ describe('TypeScript Module Parser', () => {
|
||||
|
||||
expect(parser).not.toThrow();
|
||||
expect(parser().enumMap.MyEnum.members).toEqual([
|
||||
{
|
||||
name: 'ZERO',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'POSITIVE',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'NEGATIVE',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: -1,
|
||||
},
|
||||
},
|
||||
{name: 'ZERO', value: 0},
|
||||
{name: 'POSITIVE', value: 1},
|
||||
{name: 'NEGATIVE', value: -1},
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -165,20 +147,8 @@ describe('TypeScript Module Parser', () => {
|
||||
|
||||
expect(parser).not.toThrow();
|
||||
expect(parser().enumMap.MyEnum.members).toEqual([
|
||||
{
|
||||
name: 'ZERO',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'POSITIVE',
|
||||
value: {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: 1,
|
||||
},
|
||||
},
|
||||
{name: 'ZERO', value: 0},
|
||||
{name: 'POSITIVE', value: 1},
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -250,30 +250,17 @@ class TypeScriptParser implements Parser {
|
||||
typeAnnotation: $FlowFixMe,
|
||||
): $ReadOnlyArray<NativeModuleEnumMember> {
|
||||
return typeAnnotation.members.map(member => {
|
||||
const value =
|
||||
member.initializer?.operator === '-'
|
||||
? {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: -1 * member.initializer?.argument?.value,
|
||||
}
|
||||
: typeof member.initializer?.value === 'number'
|
||||
? {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: member.initializer?.value,
|
||||
}
|
||||
: typeof member.initializer?.value === 'string'
|
||||
? {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.initializer?.value,
|
||||
}
|
||||
: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.id.name,
|
||||
};
|
||||
// Handle negative values
|
||||
if (member.initializer?.operator === '-') {
|
||||
return {
|
||||
name: member.id.name,
|
||||
value: -member.initializer?.argument?.value ?? member.id.name,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
name: member.id.name,
|
||||
value,
|
||||
value: member.initializer?.value ?? member.id.name,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,17 +106,17 @@ export function allowTransformProp(prop: string): void {
|
||||
}
|
||||
|
||||
export function isSupportedColorStyleProp(prop: string): boolean {
|
||||
return SUPPORTED_COLOR_STYLES.hasOwnProperty(prop);
|
||||
return Object.hasOwn(SUPPORTED_COLOR_STYLES, prop);
|
||||
}
|
||||
|
||||
export function isSupportedInterpolationParam(param: string): boolean {
|
||||
return SUPPORTED_INTERPOLATION_PARAMS.hasOwnProperty(param);
|
||||
return Object.hasOwn(SUPPORTED_INTERPOLATION_PARAMS, param);
|
||||
}
|
||||
|
||||
export function isSupportedStyleProp(prop: string): boolean {
|
||||
return SUPPORTED_STYLES.hasOwnProperty(prop);
|
||||
return Object.hasOwn(SUPPORTED_STYLES, prop);
|
||||
}
|
||||
|
||||
export function isSupportedTransformProp(prop: string): boolean {
|
||||
return SUPPORTED_TRANSFORMS.hasOwnProperty(prop);
|
||||
return Object.hasOwn(SUPPORTED_TRANSFORMS, prop);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ function createAnimatedProps(
|
||||
const key = keys[ii];
|
||||
const value = inputProps[key];
|
||||
|
||||
if (allowlist == null || hasOwn(allowlist, key)) {
|
||||
if (allowlist == null || Object.hasOwn(allowlist, key)) {
|
||||
let node;
|
||||
if (key === 'style') {
|
||||
node = AnimatedStyle.from(value, allowlist?.style);
|
||||
@@ -271,11 +271,3 @@ export default class AnimatedProps extends AnimatedNode {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Supported versions of JSC do not implement the newer Object.hasOwn. Remove
|
||||
// this shim when they do.
|
||||
// $FlowIgnore[method-unbinding]
|
||||
const _hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
|
||||
// $FlowIgnore[method-unbinding]
|
||||
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
|
||||
|
||||
@@ -35,7 +35,7 @@ function createAnimatedStyle(
|
||||
const key = keys[ii];
|
||||
const value = inputStyle[key];
|
||||
|
||||
if (allowlist == null || hasOwn(allowlist, key)) {
|
||||
if (allowlist == null || Object.hasOwn(allowlist, key)) {
|
||||
let node;
|
||||
if (value != null && key === 'transform') {
|
||||
node = ReactNativeFeatureFlags.shouldUseAnimatedObjectForTransform()
|
||||
@@ -241,11 +241,3 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Supported versions of JSC do not implement the newer Object.hasOwn. Remove
|
||||
// this shim when they do.
|
||||
// $FlowIgnore[method-unbinding]
|
||||
const _hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
|
||||
// $FlowIgnore[method-unbinding]
|
||||
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
|
||||
|
||||
+3
-11
@@ -28,15 +28,6 @@ type FormDataPart =
|
||||
...
|
||||
};
|
||||
|
||||
/**
|
||||
* Encode a FormData filename compliant with RFC 2183
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives
|
||||
*/
|
||||
function encodeFilename(filename: string): string {
|
||||
return encodeURIComponent(filename.replace(/\//g, '_'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Polyfill for XMLHttpRequest2 FormData API, allowing multipart POST requests
|
||||
* with mixed data (string, native files) to be submitted via XMLHttpRequest.
|
||||
@@ -91,8 +82,9 @@ class FormData {
|
||||
// content type (cf. web Blob interface.)
|
||||
if (typeof value === 'object' && !Array.isArray(value) && value) {
|
||||
if (typeof value.name === 'string') {
|
||||
headers['content-disposition'] +=
|
||||
`; filename="${encodeFilename(value.name)}"`;
|
||||
headers['content-disposition'] += `; filename="${
|
||||
value.name
|
||||
}"; filename*=utf-8''${encodeURI(value.name)}`;
|
||||
}
|
||||
if (typeof value.type === 'string') {
|
||||
headers['content-type'] = value.type;
|
||||
|
||||
@@ -48,7 +48,8 @@ describe('FormData', function () {
|
||||
type: 'image/jpeg',
|
||||
name: 'photo.jpg',
|
||||
headers: {
|
||||
'content-disposition': 'form-data; name="photo"; filename="photo.jpg"',
|
||||
'content-disposition':
|
||||
'form-data; name="photo"; filename="photo.jpg"; filename*=utf-8\'\'photo.jpg',
|
||||
'content-type': 'image/jpeg',
|
||||
},
|
||||
fieldName: 'photo',
|
||||
@@ -69,7 +70,7 @@ describe('FormData', function () {
|
||||
name: '测试photo.jpg',
|
||||
headers: {
|
||||
'content-disposition':
|
||||
'form-data; name="photo"; filename="%E6%B5%8B%E8%AF%95photo.jpg"',
|
||||
'form-data; name="photo"; filename="测试photo.jpg"; filename*=utf-8\'\'%E6%B5%8B%E8%AF%95photo.jpg',
|
||||
'content-type': 'image/jpeg',
|
||||
},
|
||||
fieldName: 'photo',
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import setUpReactFabricPublicInstanceFantomTests from './setUpReactFabricPublicInstanceFantomTests';
|
||||
|
||||
setUpReactFabricPublicInstanceFantomTests({isModern: false});
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import './setUpFeatureFlags';
|
||||
import setUpReactFabricPublicInstanceFantomTests from './setUpReactFabricPublicInstanceFantomTests';
|
||||
|
||||
setUpReactFabricPublicInstanceFantomTests({isModern: true});
|
||||
packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/__tests__/setUpFeatureFlags.js
Vendored
-16
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import * as ReactNativeFeatureFlags from '../../../../src/private/featureflags/ReactNativeFeatureFlags';
|
||||
|
||||
ReactNativeFeatureFlags.override({
|
||||
enableAccessToHostTreeInFabric: () => true,
|
||||
});
|
||||
-365
@@ -1,365 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
import '../../../Core/InitializeCore.js';
|
||||
|
||||
import * as ReactNativeTester from '../../../../src/private/__tests__/ReactNativeTester';
|
||||
import ReactNativeElement from '../../../../src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
import TextInputState from '../../../Components/TextInput/TextInputState';
|
||||
import View from '../../../Components/View/View';
|
||||
import ReactFabricHostComponent from '../ReactFabricHostComponent';
|
||||
import nullthrows from 'nullthrows';
|
||||
import * as React from 'react';
|
||||
|
||||
export default function setUpTests({isModern}: {isModern: boolean}) {
|
||||
// TODO: move these tests to the test file for `ReactNativeElement` when the legacy implementation is removed.
|
||||
describe(`ReactFabricPublicInstance (${isModern ? 'modern' : 'legacy'})`, () => {
|
||||
it('should provide instances of the right class as refs in host components', () => {
|
||||
let node;
|
||||
|
||||
const root = ReactNativeTester.createRoot();
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
ref={receivedNode => {
|
||||
node = receivedNode;
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
||||
expect(node).toBeInstanceOf(
|
||||
isModern ? ReactNativeElement : ReactFabricHostComponent,
|
||||
);
|
||||
});
|
||||
|
||||
describe('blur', () => {
|
||||
test('blur() invokes TextInputState', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
ref={node => {
|
||||
maybeNode = node;
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
||||
const node = nullthrows(maybeNode);
|
||||
|
||||
const blurTextInput = jest.fn();
|
||||
|
||||
// We don't support view commands in Fantom yet, so we have to mock this.
|
||||
TextInputState.blurTextInput = blurTextInput;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
node.blur();
|
||||
});
|
||||
|
||||
expect(blurTextInput).toHaveBeenCalledTimes(1);
|
||||
expect(blurTextInput.mock.calls).toEqual([[node]]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('focus', () => {
|
||||
test('focus() invokes TextInputState', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
ref={node => {
|
||||
maybeNode = node;
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
||||
const node = nullthrows(maybeNode);
|
||||
|
||||
const focusTextInput = jest.fn();
|
||||
|
||||
// We don't support view commands in Fantom yet, so we have to mock this.
|
||||
TextInputState.focusTextInput = focusTextInput;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
node.focus();
|
||||
});
|
||||
|
||||
expect(focusTextInput).toHaveBeenCalledTimes(1);
|
||||
expect(focusTextInput.mock.calls).toEqual([[node]]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('measure', () => {
|
||||
it('component.measure(...) invokes callback', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
style={{width: 100, height: 100, left: 10, top: 10}}
|
||||
ref={node => {
|
||||
maybeNode = node;
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
||||
const node = nullthrows(maybeNode);
|
||||
|
||||
const callback = jest.fn();
|
||||
node.measure(callback);
|
||||
|
||||
expect(callback).toHaveBeenCalledTimes(1);
|
||||
expect(callback.mock.calls).toEqual([[10, 10, 100, 100, 10, 10]]);
|
||||
});
|
||||
|
||||
it('unmounted.measure(...) does nothing', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
style={{width: 100, height: 100, left: 10, top: 10}}
|
||||
ref={node => {
|
||||
maybeNode = node;
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
||||
const node = nullthrows(maybeNode);
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(<></>);
|
||||
});
|
||||
|
||||
const callback = jest.fn();
|
||||
node.measure(callback);
|
||||
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('measureInWindow', () => {
|
||||
it('component.measureInWindow(...) invokes callback', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
style={{width: 100, height: 100, left: 10, top: 10}}
|
||||
ref={node => {
|
||||
maybeNode = node;
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
||||
const node = nullthrows(maybeNode);
|
||||
|
||||
const callback = jest.fn();
|
||||
node.measureInWindow(callback);
|
||||
|
||||
expect(callback).toHaveBeenCalledTimes(1);
|
||||
expect(callback.mock.calls).toEqual([[10, 10, 100, 100]]);
|
||||
});
|
||||
|
||||
it('unmounted.measureInWindow(...) does nothing', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
style={{width: 100, height: 100, left: 10, top: 10}}
|
||||
ref={node => {
|
||||
maybeNode = node;
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
|
||||
const node = nullthrows(maybeNode);
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(<></>);
|
||||
});
|
||||
|
||||
const callback = jest.fn();
|
||||
node.measureInWindow(callback);
|
||||
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('measureLayout', () => {
|
||||
it('component.measureLayout(component, ...) invokes callback', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeParentNode;
|
||||
let maybeChildNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
style={{width: 100, height: 100, left: 10, top: 10}}
|
||||
ref={node => {
|
||||
maybeParentNode = node;
|
||||
}}>
|
||||
<View
|
||||
style={{width: 10, height: 10, left: 20, top: 20}}
|
||||
ref={node => {
|
||||
maybeChildNode = node;
|
||||
}}
|
||||
/>
|
||||
</View>,
|
||||
);
|
||||
});
|
||||
|
||||
const parentNode = nullthrows(maybeParentNode);
|
||||
const childNode = nullthrows(maybeChildNode);
|
||||
|
||||
const callback = jest.fn();
|
||||
childNode.measureLayout(parentNode, callback);
|
||||
|
||||
expect(callback).toHaveBeenCalledTimes(1);
|
||||
expect(callback.mock.calls).toEqual([[20, 20, 10, 10]]);
|
||||
});
|
||||
|
||||
it('unmounted.measureLayout(component, ...) does nothing', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeParentNode;
|
||||
let maybeChildNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
style={{width: 100, height: 100, left: 10, top: 10}}
|
||||
ref={node => {
|
||||
maybeParentNode = node;
|
||||
}}>
|
||||
<View
|
||||
style={{width: 10, height: 10, left: 20, top: 20}}
|
||||
ref={node => {
|
||||
maybeChildNode = node;
|
||||
}}
|
||||
/>
|
||||
</View>,
|
||||
);
|
||||
});
|
||||
|
||||
const parentNode = nullthrows(maybeParentNode);
|
||||
const childNode = nullthrows(maybeChildNode);
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View style={{width: 100, height: 100, left: 10, top: 10}} />,
|
||||
);
|
||||
});
|
||||
|
||||
const callback = jest.fn();
|
||||
childNode.measureLayout(parentNode, callback);
|
||||
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('component.measureLayout(unmounted, ...) does nothing', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeParentNode;
|
||||
let maybeChildNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
style={{width: 100, height: 100, left: 10, top: 10}}
|
||||
ref={node => {
|
||||
maybeParentNode = node;
|
||||
}}>
|
||||
<View
|
||||
style={{width: 10, height: 10, left: 20, top: 20}}
|
||||
ref={node => {
|
||||
maybeChildNode = node;
|
||||
}}
|
||||
/>
|
||||
</View>,
|
||||
);
|
||||
});
|
||||
|
||||
const parentNode = nullthrows(maybeParentNode);
|
||||
const childNode = nullthrows(maybeChildNode);
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View style={{width: 100, height: 100, left: 10, top: 10}} />,
|
||||
);
|
||||
});
|
||||
|
||||
const callback = jest.fn();
|
||||
parentNode.measureLayout(childNode, callback);
|
||||
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('unmounted.measureLayout(unmounted, ...) does nothing', () => {
|
||||
const root = ReactNativeTester.createRoot();
|
||||
|
||||
let maybeParentNode;
|
||||
let maybeChildNode;
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(
|
||||
<View
|
||||
style={{width: 100, height: 100, left: 10, top: 10}}
|
||||
ref={node => {
|
||||
maybeParentNode = node;
|
||||
}}>
|
||||
<View
|
||||
style={{width: 10, height: 10, left: 20, top: 20}}
|
||||
ref={node => {
|
||||
maybeChildNode = node;
|
||||
}}
|
||||
/>
|
||||
</View>,
|
||||
);
|
||||
});
|
||||
|
||||
const parentNode = nullthrows(maybeParentNode);
|
||||
const childNode = nullthrows(maybeChildNode);
|
||||
|
||||
ReactNativeTester.runTask(() => {
|
||||
root.render(<></>);
|
||||
});
|
||||
|
||||
const callback = jest.fn();
|
||||
childNode.measureLayout(parentNode, callback);
|
||||
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -468,7 +468,8 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init);
|
||||
- (dispatch_queue_t)methodQueue
|
||||
{
|
||||
if (_bridge.valid) {
|
||||
RCTAssert(_methodQueue != nullptr, @"Module %@ has no methodQueue (instance: %@)", self, self.instance);
|
||||
id instance = self.instance;
|
||||
RCTAssert(_methodQueue != nullptr, @"Module %@ has no methodQueue (instance: %@)", self, instance);
|
||||
}
|
||||
return _methodQueue;
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
/**
|
||||
* UIView class for root <ModalHostView> component.
|
||||
*/
|
||||
@interface RCTModalHostViewComponentView : RCTViewComponentView <UIAdaptivePresentationControllerDelegate>
|
||||
@interface RCTModalHostViewComponentView : RCTViewComponentView
|
||||
|
||||
/**
|
||||
* Subclasses may override this method and present the modal on different view controller.
|
||||
|
||||
-12
@@ -149,8 +149,6 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
||||
{
|
||||
BOOL shouldBePresented = !_isPresented && _shouldPresent && self.window;
|
||||
if (shouldBePresented) {
|
||||
self.viewController.presentationController.delegate = self;
|
||||
|
||||
_isPresented = YES;
|
||||
[self presentViewController:self.viewController
|
||||
animated:_shouldAnimatePresentation
|
||||
@@ -276,16 +274,6 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
||||
[childComponentView removeFromSuperview];
|
||||
}
|
||||
|
||||
#pragma mark - UIAdaptivePresentationControllerDelegate
|
||||
|
||||
- (void)presentationControllerDidAttemptToDismiss:(UIPresentationController *)controller
|
||||
{
|
||||
auto eventEmitter = [self modalEventEmitter];
|
||||
if (eventEmitter) {
|
||||
eventEmitter->onRequestClose({});
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -121,8 +121,8 @@ using namespace facebook::react;
|
||||
auto &props = *sharedProps;
|
||||
props.layoutConstraints = LayoutConstraints{{0, 0}, {500, 500}};
|
||||
auto &yogaStyle = props.yogaStyle;
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleLength::points(200));
|
||||
return sharedProps;
|
||||
})
|
||||
.children({
|
||||
@@ -136,8 +136,8 @@ using namespace facebook::react;
|
||||
yogaStyle.setPositionType(yoga::PositionType::Absolute);
|
||||
yogaStyle.setPosition(yoga::Edge::Left, yoga::StyleLength::points(0));
|
||||
yogaStyle.setPosition(yoga::Edge::Top, yoga::StyleLength::points(0));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleLength::points(200));
|
||||
return sharedProps;
|
||||
})
|
||||
.children({
|
||||
@@ -216,8 +216,8 @@ using namespace facebook::react;
|
||||
yogaStyle.setPositionType(yoga::PositionType::Absolute);
|
||||
yogaStyle.setPosition(yoga::Edge::Left, yoga::StyleLength::points(0));
|
||||
yogaStyle.setPosition(yoga::Edge::Top, yoga::StyleLength::points(30));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(50));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleLength::points(50));
|
||||
return sharedProps;
|
||||
})
|
||||
.children({
|
||||
@@ -260,8 +260,8 @@ using namespace facebook::react;
|
||||
yogaStyle.setPositionType(yoga::PositionType::Absolute);
|
||||
yogaStyle.setPosition(yoga::Edge::Left, yoga::StyleLength::points(0));
|
||||
yogaStyle.setPosition(yoga::Edge::Top, yoga::StyleLength::points(90));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(50));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleLength::points(50));
|
||||
return sharedProps;
|
||||
})
|
||||
.children({
|
||||
@@ -418,8 +418,8 @@ static ParagraphShadowNode::ConcreteState::Shared stateWithShadowNode(
|
||||
auto &props = *sharedProps;
|
||||
props.layoutConstraints = LayoutConstraints{{0, 0}, {500, 500}};
|
||||
auto &yogaStyle = props.yogaStyle;
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleLength::points(200));
|
||||
return sharedProps;
|
||||
})
|
||||
.children({
|
||||
@@ -434,8 +434,8 @@ static ParagraphShadowNode::ConcreteState::Shared stateWithShadowNode(
|
||||
yogaStyle.setPositionType(yoga::PositionType::Absolute);
|
||||
yogaStyle.setPosition(yoga::Edge::Left, yoga::StyleLength::points(0));
|
||||
yogaStyle.setPosition(yoga::Edge::Top, yoga::StyleLength::points(90));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(20));
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleLength::points(20));
|
||||
return sharedProps;
|
||||
})
|
||||
.children({
|
||||
|
||||
@@ -87,9 +87,6 @@ CGFloat RCTCoreGraphicsFloatFromYogaValue(YGValue value, CGFloat baseFloatValue)
|
||||
return RCTCoreGraphicsFloatFromYogaFloat(value.value) * baseFloatValue;
|
||||
case YGUnitAuto:
|
||||
case YGUnitUndefined:
|
||||
case YGUnitMaxContent:
|
||||
case YGUnitFitContent:
|
||||
case YGUnitStretch:
|
||||
return baseFloatValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,9 +63,6 @@ typedef NS_ENUM(unsigned int, meta_prop_t) {
|
||||
#define RCT_SET_YGVALUE(ygvalue, setter, ...) \
|
||||
switch (ygvalue.unit) { \
|
||||
case YGUnitAuto: \
|
||||
case YGUnitMaxContent: \
|
||||
case YGUnitFitContent: \
|
||||
case YGUnitStretch: \
|
||||
case YGUnitUndefined: \
|
||||
setter(__VA_ARGS__, YGUndefined); \
|
||||
break; \
|
||||
@@ -91,35 +88,6 @@ typedef NS_ENUM(unsigned int, meta_prop_t) {
|
||||
case YGUnitPercent: \
|
||||
setter##Percent(__VA_ARGS__, ygvalue.value); \
|
||||
break; \
|
||||
case YGUnitMaxContent: \
|
||||
case YGUnitFitContent: \
|
||||
case YGUnitStretch: \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define RCT_SET_YGVALUE_AUTO_INTRINSIC(ygvalue, setter, ...) \
|
||||
switch (ygvalue.unit) { \
|
||||
case YGUnitAuto: \
|
||||
setter##Auto(__VA_ARGS__); \
|
||||
break; \
|
||||
case YGUnitMaxContent: \
|
||||
setter##MaxContent(__VA_ARGS__); \
|
||||
break; \
|
||||
case YGUnitFitContent: \
|
||||
setter##FitContent(__VA_ARGS__); \
|
||||
break; \
|
||||
case YGUnitStretch: \
|
||||
setter##Stretch(__VA_ARGS__); \
|
||||
break; \
|
||||
case YGUnitUndefined: \
|
||||
setter(__VA_ARGS__, YGUndefined); \
|
||||
break; \
|
||||
case YGUnitPoint: \
|
||||
setter(__VA_ARGS__, ygvalue.value); \
|
||||
break; \
|
||||
case YGUnitPercent: \
|
||||
setter##Percent(__VA_ARGS__, ygvalue.value); \
|
||||
break; \
|
||||
}
|
||||
|
||||
static void RCTProcessMetaPropsPadding(const YGValue metaProps[META_PROP_COUNT], YGNodeRef node)
|
||||
@@ -515,14 +483,14 @@ RCT_BORDER_PROPERTY(Start, START)
|
||||
RCT_BORDER_PROPERTY(End, END)
|
||||
|
||||
// Dimensions
|
||||
#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \
|
||||
-(void)set##setProp : (YGValue)value \
|
||||
{ \
|
||||
RCT_SET_YGVALUE_AUTO_INTRINSIC(value, YGNodeStyleSet##cssProp, _yogaNode); \
|
||||
} \
|
||||
-(YGValue)getProp \
|
||||
{ \
|
||||
return YGNodeStyleGet##cssProp(_yogaNode); \
|
||||
#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \
|
||||
-(void)set##setProp : (YGValue)value \
|
||||
{ \
|
||||
RCT_SET_YGVALUE_AUTO(value, YGNodeStyleSet##cssProp, _yogaNode); \
|
||||
} \
|
||||
-(YGValue)getProp \
|
||||
{ \
|
||||
return YGNodeStyleGet##cssProp(_yogaNode); \
|
||||
}
|
||||
|
||||
#define RCT_MIN_MAX_DIMENSION_PROPERTY(setProp, getProp, cssProp) \
|
||||
@@ -666,7 +634,7 @@ RCTShadowViewMeasure(YGNodeConstRef node, float width, YGMeasureMode widthMode,
|
||||
|
||||
- (void)setFlexBasis:(YGValue)value
|
||||
{
|
||||
RCT_SET_YGVALUE_AUTO_INTRINSIC(value, YGNodeStyleSetFlexBasis, _yogaNode);
|
||||
RCT_SET_YGVALUE_AUTO(value, YGNodeStyleSetFlexBasis, _yogaNode);
|
||||
}
|
||||
|
||||
- (YGValue)flexBasis
|
||||
|
||||
@@ -426,10 +426,6 @@ public abstract interface class com/facebook/react/ReactRootView$ReactRootViewEv
|
||||
public abstract fun onAttachedToReactInstance (Lcom/facebook/react/ReactRootView;)V
|
||||
}
|
||||
|
||||
public abstract class com/facebook/react/TurboReactPackage : com/facebook/react/BaseReactPackage {
|
||||
public fun <init> ()V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/ViewManagerOnDemandReactPackage {
|
||||
public abstract fun createViewManager (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/lang/String;)Lcom/facebook/react/uimanager/ViewManager;
|
||||
public abstract fun getViewManagerNames (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/Collection;
|
||||
@@ -780,6 +776,16 @@ public abstract class com/facebook/react/bridge/GuardedAsyncTask : android/os/As
|
||||
protected abstract fun doInBackgroundGuarded ([Ljava/lang/Object;)V
|
||||
}
|
||||
|
||||
public abstract class com/facebook/react/bridge/GuardedResultAsyncTask : android/os/AsyncTask {
|
||||
protected fun <init> (Lcom/facebook/react/bridge/JSExceptionHandler;)V
|
||||
protected fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
|
||||
protected synthetic fun doInBackground ([Ljava/lang/Object;)Ljava/lang/Object;
|
||||
protected final fun doInBackground ([Ljava/lang/Void;)Ljava/lang/Object;
|
||||
protected abstract fun doInBackgroundGuarded ()Ljava/lang/Object;
|
||||
protected final fun onPostExecute (Ljava/lang/Object;)V
|
||||
protected abstract fun onPostExecuteGuarded (Ljava/lang/Object;)V
|
||||
}
|
||||
|
||||
public abstract class com/facebook/react/bridge/GuardedRunnable : java/lang/Runnable {
|
||||
public fun <init> (Lcom/facebook/react/bridge/JSExceptionHandler;)V
|
||||
public fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
|
||||
@@ -4085,6 +4091,10 @@ public abstract class com/facebook/react/uimanager/BaseViewManagerDelegate : com
|
||||
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/uimanager/ComponentNameResolver {
|
||||
public abstract fun getComponentNames ()[Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class com/facebook/react/uimanager/DisplayMetricsHolder {
|
||||
public static final field INSTANCE Lcom/facebook/react/uimanager/DisplayMetricsHolder;
|
||||
public static final fun getDisplayMetricsWritableMap (D)Lcom/facebook/react/bridge/WritableMap;
|
||||
@@ -4096,6 +4106,22 @@ public final class com/facebook/react/uimanager/DisplayMetricsHolder {
|
||||
public static final fun setWindowDisplayMetrics (Landroid/util/DisplayMetrics;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/uimanager/FabricViewStateManager {
|
||||
public fun <init> ()V
|
||||
public fun getStateData ()Lcom/facebook/react/bridge/ReadableMap;
|
||||
public fun hasStateWrapper ()Z
|
||||
public fun setState (Lcom/facebook/react/uimanager/FabricViewStateManager$StateUpdateCallback;)V
|
||||
public fun setStateWrapper (Lcom/facebook/react/uimanager/StateWrapper;)V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/uimanager/FabricViewStateManager$HasFabricViewStateManager {
|
||||
public abstract fun getFabricViewStateManager ()Lcom/facebook/react/uimanager/FabricViewStateManager;
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/uimanager/FabricViewStateManager$StateUpdateCallback {
|
||||
public abstract fun getStateUpdate ()Lcom/facebook/react/bridge/WritableMap;
|
||||
}
|
||||
|
||||
public final class com/facebook/react/uimanager/FloatUtil {
|
||||
public static final field INSTANCE Lcom/facebook/react/uimanager/FloatUtil;
|
||||
public static final fun floatsEqual (FF)Z
|
||||
@@ -7111,6 +7137,45 @@ public final class com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout
|
||||
public fun setRefreshing (Z)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/views/switchview/ReactSwitchManager : com/facebook/react/uimanager/SimpleViewManager, com/facebook/react/viewmanagers/AndroidSwitchManagerInterface {
|
||||
public static final field REACT_CLASS Ljava/lang/String;
|
||||
public fun <init> ()V
|
||||
protected synthetic fun addEventEmitters (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)V
|
||||
protected fun addEventEmitters (Lcom/facebook/react/uimanager/ThemedReactContext;Lcom/facebook/react/views/switchview/ReactSwitch;)V
|
||||
public fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/LayoutShadowNode;
|
||||
public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode;
|
||||
protected synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
|
||||
protected fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/facebook/react/views/switchview/ReactSwitch;
|
||||
protected fun getDelegate ()Lcom/facebook/react/uimanager/ViewManagerDelegate;
|
||||
public fun getName ()Ljava/lang/String;
|
||||
public fun getShadowNodeClass ()Ljava/lang/Class;
|
||||
public fun measure (Landroid/content/Context;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/ReadableMap;FLcom/facebook/yoga/YogaMeasureMode;FLcom/facebook/yoga/YogaMeasureMode;[F)J
|
||||
public synthetic fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
|
||||
public fun receiveCommand (Lcom/facebook/react/views/switchview/ReactSwitch;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
|
||||
public synthetic fun setBackgroundColor (Landroid/view/View;I)V
|
||||
public fun setBackgroundColor (Lcom/facebook/react/views/switchview/ReactSwitch;I)V
|
||||
public synthetic fun setDisabled (Landroid/view/View;Z)V
|
||||
public fun setDisabled (Lcom/facebook/react/views/switchview/ReactSwitch;Z)V
|
||||
public synthetic fun setEnabled (Landroid/view/View;Z)V
|
||||
public fun setEnabled (Lcom/facebook/react/views/switchview/ReactSwitch;Z)V
|
||||
public synthetic fun setNativeValue (Landroid/view/View;Z)V
|
||||
public fun setNativeValue (Lcom/facebook/react/views/switchview/ReactSwitch;Z)V
|
||||
public synthetic fun setOn (Landroid/view/View;Z)V
|
||||
public fun setOn (Lcom/facebook/react/views/switchview/ReactSwitch;Z)V
|
||||
public synthetic fun setThumbColor (Landroid/view/View;Ljava/lang/Integer;)V
|
||||
public fun setThumbColor (Lcom/facebook/react/views/switchview/ReactSwitch;Ljava/lang/Integer;)V
|
||||
public synthetic fun setThumbTintColor (Landroid/view/View;Ljava/lang/Integer;)V
|
||||
public fun setThumbTintColor (Lcom/facebook/react/views/switchview/ReactSwitch;Ljava/lang/Integer;)V
|
||||
public synthetic fun setTrackColorForFalse (Landroid/view/View;Ljava/lang/Integer;)V
|
||||
public fun setTrackColorForFalse (Lcom/facebook/react/views/switchview/ReactSwitch;Ljava/lang/Integer;)V
|
||||
public synthetic fun setTrackColorForTrue (Landroid/view/View;Ljava/lang/Integer;)V
|
||||
public fun setTrackColorForTrue (Lcom/facebook/react/views/switchview/ReactSwitch;Ljava/lang/Integer;)V
|
||||
public synthetic fun setTrackTintColor (Landroid/view/View;Ljava/lang/Integer;)V
|
||||
public fun setTrackTintColor (Lcom/facebook/react/views/switchview/ReactSwitch;Ljava/lang/Integer;)V
|
||||
public synthetic fun setValue (Landroid/view/View;Z)V
|
||||
public fun setValue (Lcom/facebook/react/views/switchview/ReactSwitch;Z)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/views/text/DefaultStyleValuesUtil {
|
||||
public static final field INSTANCE Lcom/facebook/react/views/text/DefaultStyleValuesUtil;
|
||||
public static final fun getDefaultTextColor (Landroid/content/Context;)Landroid/content/res/ColorStateList;
|
||||
|
||||
@@ -591,8 +591,7 @@ android {
|
||||
"src/main/res/shell",
|
||||
"src/main/res/views/alert",
|
||||
"src/main/res/views/modal",
|
||||
"src/main/res/views/uimanager",
|
||||
"src/main/res/views/view"))
|
||||
"src/main/res/views/uimanager"))
|
||||
java.exclude("com/facebook/react/processing")
|
||||
java.exclude("com/facebook/react/module/processing")
|
||||
}
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react
|
||||
|
||||
@Deprecated(
|
||||
message = "Use BaseReactPackage instead",
|
||||
replaceWith = ReplaceWith(expression = "BaseReactPackage"))
|
||||
public abstract class TurboReactPackage : BaseReactPackage() {}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
/**
|
||||
* Abstract base for a AsyncTask with result support that should have any RuntimeExceptions it
|
||||
* throws handled by the {@link JSExceptionHandler} registered if the app is in dev mode.
|
||||
*/
|
||||
public abstract class GuardedResultAsyncTask<Result> extends AsyncTask<Void, Void, Result> {
|
||||
|
||||
private final JSExceptionHandler mExceptionHandler;
|
||||
|
||||
protected GuardedResultAsyncTask(ReactContext reactContext) {
|
||||
this(reactContext.getExceptionHandler());
|
||||
}
|
||||
|
||||
protected GuardedResultAsyncTask(JSExceptionHandler exceptionHandler) {
|
||||
mExceptionHandler = exceptionHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Result doInBackground(Void... params) {
|
||||
try {
|
||||
return doInBackgroundGuarded();
|
||||
} catch (RuntimeException e) {
|
||||
mExceptionHandler.handleException(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onPostExecute(Result result) {
|
||||
try {
|
||||
onPostExecuteGuarded(result);
|
||||
} catch (RuntimeException e) {
|
||||
mExceptionHandler.handleException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Result doInBackgroundGuarded();
|
||||
|
||||
protected abstract void onPostExecuteGuarded(Result result);
|
||||
}
|
||||
+2
-8
@@ -445,18 +445,12 @@ public class FabricUIManager
|
||||
|
||||
@Override
|
||||
public void markActiveTouchForTag(int surfaceId, int reactTag) {
|
||||
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
||||
if (surfaceMountingManager != null) {
|
||||
surfaceMountingManager.markActiveTouchForTag(reactTag);
|
||||
}
|
||||
mMountingManager.getSurfaceManager(surfaceId).markActiveTouchForTag(reactTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sweepActiveTouchForTag(int surfaceId, int reactTag) {
|
||||
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
||||
if (surfaceMountingManager != null) {
|
||||
surfaceMountingManager.sweepActiveTouchForTag(reactTag);
|
||||
}
|
||||
mMountingManager.getSurfaceManager(surfaceId).sweepActiveTouchForTag(reactTag);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-7
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<4a219bb47b1b9d988a164bca19eb4fa9>>
|
||||
* @generated SignedSource<<6d8d8f4b81d7be882b315d0960499dcb>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -202,12 +202,6 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun excludeYogaFromRawProps(): Boolean = accessor.excludeYogaFromRawProps()
|
||||
|
||||
/**
|
||||
* Fixes a bug in Differentiator where parent views may be referenced before they're created
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean = accessor.fixDifferentiatorEmittingUpdatesWithWrongParentTag()
|
||||
|
||||
/**
|
||||
* Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
|
||||
*/
|
||||
|
||||
+1
-11
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<d75efd6beee8dd9d38b5d648fbecbcda>>
|
||||
* @generated SignedSource<<031fce8e8b4c20a3e3d6dbecf94d138a>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
||||
private var enableUIConsistencyCache: Boolean? = null
|
||||
private var enableViewRecyclingCache: Boolean? = null
|
||||
private var excludeYogaFromRawPropsCache: Boolean? = null
|
||||
private var fixDifferentiatorEmittingUpdatesWithWrongParentTagCache: Boolean? = null
|
||||
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
|
||||
private var fixMountingCoordinatorReportedPendingTransactionsOnAndroidCache: Boolean? = null
|
||||
private var fuseboxEnabledDebugCache: Boolean? = null
|
||||
@@ -329,15 +328,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean {
|
||||
var cached = fixDifferentiatorEmittingUpdatesWithWrongParentTagCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.fixDifferentiatorEmittingUpdatesWithWrongParentTag()
|
||||
fixDifferentiatorEmittingUpdatesWithWrongParentTagCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean {
|
||||
var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache
|
||||
if (cached == null) {
|
||||
|
||||
+1
-3
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<7454ab19a01cfbb0a54f14bd83fc3a90>>
|
||||
* @generated SignedSource<<35811667ac2543e1f64e27bbdb483ec1>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -86,8 +86,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun excludeYogaFromRawProps(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun fixMountingCoordinatorReportedPendingTransactionsOnAndroid(): Boolean
|
||||
|
||||
+1
-3
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<70d951b2956759280afae4af8f9a2869>>
|
||||
* @generated SignedSource<<9d829c58e49164a0b2b6b66bc0ce088a>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -81,8 +81,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun excludeYogaFromRawProps(): Boolean = false
|
||||
|
||||
override fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean = true
|
||||
|
||||
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false
|
||||
|
||||
override fun fixMountingCoordinatorReportedPendingTransactionsOnAndroid(): Boolean = false
|
||||
|
||||
+1
-12
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<f60000cb58a9632c3aa193854be3de4e>>
|
||||
* @generated SignedSource<<0121e113410a5b0e14eaf74a3076df2f>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var enableUIConsistencyCache: Boolean? = null
|
||||
private var enableViewRecyclingCache: Boolean? = null
|
||||
private var excludeYogaFromRawPropsCache: Boolean? = null
|
||||
private var fixDifferentiatorEmittingUpdatesWithWrongParentTagCache: Boolean? = null
|
||||
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
|
||||
private var fixMountingCoordinatorReportedPendingTransactionsOnAndroidCache: Boolean? = null
|
||||
private var fuseboxEnabledDebugCache: Boolean? = null
|
||||
@@ -362,16 +361,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean {
|
||||
var cached = fixDifferentiatorEmittingUpdatesWithWrongParentTagCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.fixDifferentiatorEmittingUpdatesWithWrongParentTag()
|
||||
accessedFeatureFlags.add("fixDifferentiatorEmittingUpdatesWithWrongParentTag")
|
||||
fixDifferentiatorEmittingUpdatesWithWrongParentTagCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean {
|
||||
var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache
|
||||
if (cached == null) {
|
||||
|
||||
+1
-3
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<d62af893c5d18a2152f098ff305ae41e>>
|
||||
* @generated SignedSource<<2787d9027695dd14ec6b917a32a1a6de>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -81,8 +81,6 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun excludeYogaFromRawProps(): Boolean
|
||||
|
||||
@DoNotStrip public fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean
|
||||
|
||||
@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
|
||||
|
||||
@DoNotStrip public fun fixMountingCoordinatorReportedPendingTransactionsOnAndroid(): Boolean
|
||||
|
||||
+5
-8
@@ -13,7 +13,6 @@ import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.facebook.fbreact.specs.NativeAppearanceSpec
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.UiThreadUtil
|
||||
import com.facebook.react.module.annotations.ReactModule
|
||||
|
||||
/** Module that exposes the user's preferred color scheme. */
|
||||
@@ -59,13 +58,11 @@ constructor(
|
||||
}
|
||||
|
||||
public override fun setColorScheme(style: String) {
|
||||
UiThreadUtil.runOnUiThread {
|
||||
when (style) {
|
||||
"dark" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
"light" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
"unspecified" ->
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
}
|
||||
when (style) {
|
||||
"dark" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
"light" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
"unspecified" ->
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -84,7 +84,6 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
view.setTag(R.id.accessibility_actions, null);
|
||||
view.setTag(R.id.accessibility_value, null);
|
||||
view.setTag(R.id.accessibility_state_expanded, null);
|
||||
view.setTag(R.id.view_clipped, null);
|
||||
|
||||
// This indirectly calls (and resets):
|
||||
// setTranslationX
|
||||
|
||||
+5
-4
@@ -5,12 +5,13 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStripAny
|
||||
import com.facebook.proguard.annotations.DoNotStripAny;
|
||||
|
||||
@DoNotStripAny
|
||||
internal interface ComponentNameResolver {
|
||||
public interface ComponentNameResolver {
|
||||
|
||||
/* returns a list of all the component names that are registered in React Native. */
|
||||
public val componentNames: Array<String>?
|
||||
String[] getComponentNames();
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
|
||||
/**
|
||||
* This is a helper base class for ViewGroups that use Fabric State.
|
||||
*
|
||||
* <p>Reason to use this: UpdateState calls from the View layer to the Fabric core can fail, and
|
||||
* optionally Fabric will call a "failure callback" if that happens. This class abstracts that and
|
||||
* makes it easier ensure that State in Fabric is always up-to-date.
|
||||
*
|
||||
* <p>1. Whenever ViewManager.updateState is called, call View.setStateWrapper. 2. Instead of
|
||||
* calling StateWrapper.updateState directly, call View.setState and it will automatically keep
|
||||
* retrying the UpdateState call until it succeeds; or you call setState again; or the View layer is
|
||||
* updated with a newer StateWrapper.
|
||||
*/
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
@Deprecated(
|
||||
since =
|
||||
"Deprecated class since v0.73.0, please use com.facebook.react.uimanager.StateWrapper"
|
||||
+ " instead.",
|
||||
forRemoval = true)
|
||||
public class FabricViewStateManager {
|
||||
private static final String TAG = "FabricViewStateManager";
|
||||
|
||||
@Deprecated
|
||||
public interface HasFabricViewStateManager {
|
||||
FabricViewStateManager getFabricViewStateManager();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public interface StateUpdateCallback {
|
||||
WritableMap getStateUpdate();
|
||||
}
|
||||
|
||||
@Nullable private StateWrapper mStateWrapper = null;
|
||||
|
||||
@Deprecated
|
||||
public void setStateWrapper(StateWrapper stateWrapper) {
|
||||
mStateWrapper = stateWrapper;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean hasStateWrapper() {
|
||||
return mStateWrapper != null;
|
||||
}
|
||||
|
||||
private void setState(
|
||||
@Nullable final StateWrapper stateWrapper,
|
||||
final StateUpdateCallback stateUpdateCallback,
|
||||
final int numTries) {
|
||||
// The StateWrapper will change, breaking the async loop, whenever the UpdateState MountItem
|
||||
// is executed.
|
||||
// The caller is responsible for detecting if data is up-to-date, and doing nothing, or
|
||||
// detecting if state is stale and calling setState again.
|
||||
if (stateWrapper == null) {
|
||||
FLog.e(TAG, "setState called without a StateWrapper");
|
||||
return;
|
||||
}
|
||||
if (stateWrapper != mStateWrapper) {
|
||||
return;
|
||||
}
|
||||
// We bail out after an arbitrary number of tries. In practice this should never go higher
|
||||
// than 2 or 3, but there's nothing guaranteeing that.
|
||||
if (numTries > 60) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Nullable WritableMap stateUpdate = stateUpdateCallback.getStateUpdate();
|
||||
if (stateUpdate == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: State update cannot fail; remove `failureRunnable` and custom retrying logic.
|
||||
stateWrapper.updateState(stateUpdate);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setState(final StateUpdateCallback stateUpdateCallback) {
|
||||
setState(mStateWrapper, stateUpdateCallback, 0);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public @Nullable ReadableMap getStateData() {
|
||||
return mStateWrapper != null ? mStateWrapper.getStateData() : null;
|
||||
}
|
||||
}
|
||||
+12
-11
@@ -5,10 +5,10 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
/** Interface for the root native view of a React native application. */
|
||||
public interface RootView {
|
||||
@@ -17,20 +17,21 @@ public interface RootView {
|
||||
* Called when a child starts a native gesture (e.g. a scroll in a ScrollView). Should be called
|
||||
* from the child's onTouchIntercepted implementation.
|
||||
*/
|
||||
public fun onChildStartedNativeGesture(childView: View?, ev: MotionEvent)
|
||||
void onChildStartedNativeGesture(View childView, MotionEvent ev);
|
||||
|
||||
@Deprecated(
|
||||
message = "Use onChildStartedNativeGesture with a childView parameter.",
|
||||
replaceWith = ReplaceWith("onChildStartedNativeGesture"))
|
||||
public fun onChildStartedNativeGesture(ev: MotionEvent) {
|
||||
onChildStartedNativeGesture(null, ev)
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
default void onChildStartedNativeGesture(MotionEvent ev) {
|
||||
onChildStartedNativeGesture(null, ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a child ends a native gesture. Should be called from the child's onTouchIntercepted
|
||||
* implementation.
|
||||
*/
|
||||
public fun onChildEndedNativeGesture(childView: View, ev: MotionEvent)
|
||||
void onChildEndedNativeGesture(View childView, MotionEvent ev);
|
||||
|
||||
public fun handleException(t: Throwable)
|
||||
void handleException(Throwable t);
|
||||
}
|
||||
+3
-3
@@ -5,10 +5,10 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.uimanager.events
|
||||
package com.facebook.react.uimanager.events;
|
||||
|
||||
public fun interface BatchEventDispatchedListener {
|
||||
public interface BatchEventDispatchedListener {
|
||||
|
||||
/** Called after a batch of low priority events has been dispatched. */
|
||||
public fun onBatchEventDispatched()
|
||||
void onBatchEventDispatched();
|
||||
}
|
||||
+1
-1
@@ -495,7 +495,7 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
||||
return super.onHoverEvent(event)
|
||||
}
|
||||
|
||||
override fun onChildStartedNativeGesture(childView: View?, ev: MotionEvent) {
|
||||
override fun onChildStartedNativeGesture(childView: View, ev: MotionEvent) {
|
||||
eventDispatcher?.let { eventDispatcher ->
|
||||
jSTouchDispatcher.onChildStartedNativeGesture(ev, eventDispatcher)
|
||||
jSPointerDispatcher?.onChildStartedNativeGesture(childView, ev, eventDispatcher)
|
||||
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// switchview because switch is a keyword
|
||||
package com.facebook.react.views.switchview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerHelper;
|
||||
import com.facebook.react.uimanager.ViewManagerDelegate;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.viewmanagers.AndroidSwitchManagerDelegate;
|
||||
import com.facebook.react.viewmanagers.AndroidSwitchManagerInterface;
|
||||
import com.facebook.yoga.YogaMeasureFunction;
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import com.facebook.yoga.YogaMeasureOutput;
|
||||
import com.facebook.yoga.YogaNode;
|
||||
|
||||
/** View manager for {@link ReactSwitch} components. */
|
||||
public class ReactSwitchManager extends SimpleViewManager<ReactSwitch>
|
||||
implements AndroidSwitchManagerInterface<ReactSwitch> {
|
||||
|
||||
public static final String REACT_CLASS = "AndroidSwitch";
|
||||
|
||||
static class ReactSwitchShadowNode extends LayoutShadowNode implements YogaMeasureFunction {
|
||||
|
||||
private int mWidth;
|
||||
private int mHeight;
|
||||
private boolean mMeasured;
|
||||
|
||||
private ReactSwitchShadowNode() {
|
||||
initMeasureFunction();
|
||||
}
|
||||
|
||||
private void initMeasureFunction() {
|
||||
setMeasureFunction(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long measure(
|
||||
YogaNode node,
|
||||
float width,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode) {
|
||||
if (!mMeasured) {
|
||||
// Create a switch with the default config and measure it; since we don't (currently)
|
||||
// support setting custom switch text, this is fine, as all switches will measure the same
|
||||
// on a specific device/theme/locale combination.
|
||||
ReactSwitch reactSwitch = new ReactSwitch(getThemedContext());
|
||||
reactSwitch.setShowText(false);
|
||||
final int spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
reactSwitch.measure(spec, spec);
|
||||
mWidth = reactSwitch.getMeasuredWidth();
|
||||
mHeight = reactSwitch.getMeasuredHeight();
|
||||
mMeasured = true;
|
||||
}
|
||||
|
||||
return YogaMeasureOutput.make(mWidth, mHeight);
|
||||
}
|
||||
}
|
||||
|
||||
private static final CompoundButton.OnCheckedChangeListener ON_CHECKED_CHANGE_LISTENER =
|
||||
new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
ReactContext reactContext = (ReactContext) buttonView.getContext();
|
||||
|
||||
int reactTag = buttonView.getId();
|
||||
UIManagerHelper.getEventDispatcherForReactTag(reactContext, reactTag)
|
||||
.dispatchEvent(
|
||||
new ReactSwitchEvent(
|
||||
UIManagerHelper.getSurfaceId(reactContext), reactTag, isChecked));
|
||||
}
|
||||
};
|
||||
|
||||
private final ViewManagerDelegate<ReactSwitch> mDelegate;
|
||||
|
||||
public ReactSwitchManager() {
|
||||
mDelegate = new AndroidSwitchManagerDelegate<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return REACT_CLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayoutShadowNode createShadowNodeInstance() {
|
||||
return new ReactSwitchShadowNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getShadowNodeClass() {
|
||||
return ReactSwitchShadowNode.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReactSwitch createViewInstance(ThemedReactContext context) {
|
||||
ReactSwitch view = new ReactSwitch(context);
|
||||
view.setShowText(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(ReactSwitch view, @ColorInt int backgroundColor) {
|
||||
view.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = "disabled", defaultBoolean = false)
|
||||
public void setDisabled(ReactSwitch view, boolean disabled) {
|
||||
view.setEnabled(!disabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = ViewProps.ENABLED, defaultBoolean = true)
|
||||
public void setEnabled(ReactSwitch view, boolean enabled) {
|
||||
view.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = ViewProps.ON)
|
||||
public void setOn(ReactSwitch view, boolean on) {
|
||||
setValueInternal(view, on);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = "value")
|
||||
public void setValue(ReactSwitch view, boolean value) {
|
||||
setValueInternal(view, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = "thumbTintColor", customType = "Color")
|
||||
public void setThumbTintColor(ReactSwitch view, @Nullable Integer color) {
|
||||
this.setThumbColor(view, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = "thumbColor", customType = "Color")
|
||||
public void setThumbColor(ReactSwitch view, @Nullable Integer color) {
|
||||
view.setThumbColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = "trackColorForFalse", customType = "Color")
|
||||
public void setTrackColorForFalse(ReactSwitch view, @Nullable Integer color) {
|
||||
view.setTrackColorForFalse(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = "trackColorForTrue", customType = "Color")
|
||||
public void setTrackColorForTrue(ReactSwitch view, @Nullable Integer color) {
|
||||
view.setTrackColorForTrue(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = "trackTintColor", customType = "Color")
|
||||
public void setTrackTintColor(ReactSwitch view, @Nullable Integer color) {
|
||||
view.setTrackColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNativeValue(ReactSwitch view, boolean value) {
|
||||
setValueInternal(view, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveCommand(
|
||||
@NonNull ReactSwitch view, String commandId, @Nullable ReadableArray args) {
|
||||
switch (commandId) {
|
||||
case "setNativeValue":
|
||||
setValueInternal(view, args != null && args.getBoolean(0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addEventEmitters(final ThemedReactContext reactContext, final ReactSwitch view) {
|
||||
view.setOnCheckedChangeListener(ON_CHECKED_CHANGE_LISTENER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewManagerDelegate<ReactSwitch> getDelegate() {
|
||||
return mDelegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long measure(
|
||||
Context context,
|
||||
ReadableMap localData,
|
||||
ReadableMap props,
|
||||
ReadableMap state,
|
||||
float width,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode,
|
||||
@Nullable float[] attachmentsPositions) {
|
||||
ReactSwitch view = new ReactSwitch(context);
|
||||
view.setShowText(false);
|
||||
int measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
view.measure(measureSpec, measureSpec);
|
||||
return YogaMeasureOutput.make(
|
||||
PixelUtil.toDIPFromPixel(view.getMeasuredWidth()),
|
||||
PixelUtil.toDIPFromPixel(view.getMeasuredHeight()));
|
||||
}
|
||||
|
||||
private static void setValueInternal(ReactSwitch view, boolean value) {
|
||||
// we set the checked change listener to null and then restore it so that we don't fire an
|
||||
// onChange event to JS when JS itself is updating the value of the switch
|
||||
view.setOnCheckedChangeListener(null);
|
||||
view.setOn(value);
|
||||
view.setOnCheckedChangeListener(ON_CHECKED_CHANGE_LISTENER);
|
||||
}
|
||||
}
|
||||
-152
@@ -1,152 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.switchview
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.CompoundButton
|
||||
import androidx.annotation.ColorInt
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.bridge.ReadableArray
|
||||
import com.facebook.react.bridge.ReadableMap
|
||||
import com.facebook.react.uimanager.BaseViewManager
|
||||
import com.facebook.react.uimanager.PixelUtil
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.UIManagerHelper
|
||||
import com.facebook.react.uimanager.ViewManagerDelegate
|
||||
import com.facebook.react.uimanager.ViewProps
|
||||
import com.facebook.react.uimanager.annotations.ReactProp
|
||||
import com.facebook.react.viewmanagers.AndroidSwitchManagerDelegate
|
||||
import com.facebook.react.viewmanagers.AndroidSwitchManagerInterface
|
||||
import com.facebook.yoga.YogaMeasureMode
|
||||
import com.facebook.yoga.YogaMeasureOutput
|
||||
|
||||
internal class ReactSwitchManager :
|
||||
BaseViewManager<ReactSwitch, ReactSwitchShadowNode>(),
|
||||
AndroidSwitchManagerInterface<ReactSwitch> {
|
||||
|
||||
private val delegate: ViewManagerDelegate<ReactSwitch> = AndroidSwitchManagerDelegate(this)
|
||||
|
||||
override fun getName(): String = REACT_CLASS
|
||||
|
||||
override fun createShadowNodeInstance(): ReactSwitchShadowNode = ReactSwitchShadowNode()
|
||||
|
||||
override fun getShadowNodeClass(): Class<ReactSwitchShadowNode> =
|
||||
ReactSwitchShadowNode::class.java
|
||||
|
||||
override fun createViewInstance(context: ThemedReactContext): ReactSwitch =
|
||||
ReactSwitch(context).apply { showText = false }
|
||||
|
||||
override fun setBackgroundColor(view: ReactSwitch, @ColorInt backgroundColor: Int) {
|
||||
view.setBackgroundColor(backgroundColor)
|
||||
}
|
||||
|
||||
@ReactProp(name = "disabled", defaultBoolean = false)
|
||||
override fun setDisabled(view: ReactSwitch, disabled: Boolean) {
|
||||
view.isEnabled = !disabled
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.ENABLED, defaultBoolean = true)
|
||||
override fun setEnabled(view: ReactSwitch, enabled: Boolean) {
|
||||
view.isEnabled = enabled
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.ON)
|
||||
override fun setOn(view: ReactSwitch, on: Boolean) {
|
||||
setValueInternal(view, on)
|
||||
}
|
||||
|
||||
@ReactProp(name = "value")
|
||||
override fun setValue(view: ReactSwitch, value: Boolean) {
|
||||
setValueInternal(view, value)
|
||||
}
|
||||
|
||||
@ReactProp(name = "thumbTintColor", customType = "Color")
|
||||
override fun setThumbTintColor(view: ReactSwitch, color: Int?) {
|
||||
setThumbColor(view, color)
|
||||
}
|
||||
|
||||
@ReactProp(name = "thumbColor", customType = "Color")
|
||||
override fun setThumbColor(view: ReactSwitch, color: Int?) {
|
||||
view.setThumbColor(color)
|
||||
}
|
||||
|
||||
@ReactProp(name = "trackColorForFalse", customType = "Color")
|
||||
override fun setTrackColorForFalse(view: ReactSwitch, color: Int?) {
|
||||
view.setTrackColorForFalse(color)
|
||||
}
|
||||
|
||||
@ReactProp(name = "trackColorForTrue", customType = "Color")
|
||||
override fun setTrackColorForTrue(view: ReactSwitch, color: Int?) {
|
||||
view.setTrackColorForTrue(color)
|
||||
}
|
||||
|
||||
@ReactProp(name = "trackTintColor", customType = "Color")
|
||||
override fun setTrackTintColor(view: ReactSwitch, color: Int?) {
|
||||
view.setTrackColor(color)
|
||||
}
|
||||
|
||||
override fun setNativeValue(view: ReactSwitch, value: Boolean) {
|
||||
setValueInternal(view, value)
|
||||
}
|
||||
|
||||
override fun receiveCommand(view: ReactSwitch, commandId: String, args: ReadableArray?) {
|
||||
when (commandId) {
|
||||
"setNativeValue" -> setValueInternal(view, args?.getBoolean(0) ?: false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addEventEmitters(reactContext: ThemedReactContext, view: ReactSwitch) {
|
||||
view.setOnCheckedChangeListener(ON_CHECKED_CHANGE_LISTENER)
|
||||
}
|
||||
|
||||
override fun updateExtraData(root: ReactSwitch, extraData: Any) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun getDelegate(): ViewManagerDelegate<ReactSwitch> = delegate
|
||||
|
||||
override fun measure(
|
||||
context: Context,
|
||||
localData: ReadableMap?,
|
||||
props: ReadableMap?,
|
||||
state: ReadableMap?,
|
||||
width: Float,
|
||||
widthMode: YogaMeasureMode,
|
||||
height: Float,
|
||||
heightMode: YogaMeasureMode,
|
||||
attachmentsPositions: FloatArray?
|
||||
): Long {
|
||||
val view = ReactSwitch(context).apply { showText = false }
|
||||
val measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
|
||||
view.measure(measureSpec, measureSpec)
|
||||
return YogaMeasureOutput.make(
|
||||
PixelUtil.toDIPFromPixel(view.measuredWidth.toFloat()),
|
||||
PixelUtil.toDIPFromPixel(view.measuredHeight.toFloat()))
|
||||
}
|
||||
|
||||
private fun setValueInternal(view: ReactSwitch, value: Boolean) {
|
||||
// Temporarily remove the listener to avoid triggering JS events
|
||||
view.setOnCheckedChangeListener(null)
|
||||
view.setOn(value)
|
||||
view.setOnCheckedChangeListener(ON_CHECKED_CHANGE_LISTENER)
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
public const val REACT_CLASS: String = "AndroidSwitch"
|
||||
|
||||
private val ON_CHECKED_CHANGE_LISTENER =
|
||||
CompoundButton.OnCheckedChangeListener { buttonView, isChecked ->
|
||||
val reactContext = buttonView.context as ReactContext
|
||||
val reactTag = buttonView.id
|
||||
UIManagerHelper.getEventDispatcherForReactTag(reactContext, reactTag)
|
||||
?.dispatchEvent(
|
||||
ReactSwitchEvent(UIManagerHelper.getSurfaceId(reactContext), reactTag, isChecked))
|
||||
}
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.switchview
|
||||
|
||||
import android.view.View
|
||||
import com.facebook.react.uimanager.LayoutShadowNode
|
||||
import com.facebook.yoga.YogaMeasureFunction
|
||||
import com.facebook.yoga.YogaMeasureMode
|
||||
import com.facebook.yoga.YogaMeasureOutput
|
||||
import com.facebook.yoga.YogaNode
|
||||
|
||||
internal class ReactSwitchShadowNode : LayoutShadowNode(), YogaMeasureFunction {
|
||||
private var width = 0
|
||||
private var height = 0
|
||||
private var measured = false
|
||||
|
||||
init {
|
||||
initMeasureFunction()
|
||||
}
|
||||
|
||||
private fun initMeasureFunction() {
|
||||
setMeasureFunction(this)
|
||||
}
|
||||
|
||||
override fun measure(
|
||||
node: YogaNode,
|
||||
width: Float,
|
||||
widthMode: YogaMeasureMode,
|
||||
height: Float,
|
||||
heightMode: YogaMeasureMode
|
||||
): Long {
|
||||
if (!measured) {
|
||||
// Create a switch with the default config and measure it; since we don't (currently)
|
||||
// support setting custom switch text, this is fine, as all switches will measure the same
|
||||
// on a specific device/theme/locale combination.
|
||||
val reactSwitch = ReactSwitch(themedContext)
|
||||
reactSwitch.showText = false
|
||||
val spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
|
||||
reactSwitch.measure(spec, spec)
|
||||
this.width = reactSwitch.measuredWidth
|
||||
this.height = reactSwitch.measuredHeight
|
||||
measured = true
|
||||
}
|
||||
|
||||
return YogaMeasureOutput.make(this.width, this.height)
|
||||
}
|
||||
}
|
||||
+12
-61
@@ -125,7 +125,6 @@ public class ReactViewGroup extends ViewGroup
|
||||
// {@link ViewGroup#getChildCount} so those methods may return views that are not attached.
|
||||
// This is risky but allows us to perform a correct cleanup in {@link NativeViewHierarchyManager}.
|
||||
private boolean mRemoveClippedSubviews;
|
||||
private volatile boolean mInSubviewClippingLoop;
|
||||
private @Nullable View[] mAllChildren;
|
||||
private int mAllChildrenCount;
|
||||
private @Nullable Rect mClippingRect;
|
||||
@@ -159,7 +158,6 @@ public class ReactViewGroup extends ViewGroup
|
||||
setClipChildren(false);
|
||||
|
||||
mRemoveClippedSubviews = false;
|
||||
mInSubviewClippingLoop = false;
|
||||
mAllChildren = null;
|
||||
mAllChildrenCount = 0;
|
||||
mClippingRect = null;
|
||||
@@ -365,7 +363,6 @@ public class ReactViewGroup extends ViewGroup
|
||||
View child = getChildAt(i);
|
||||
mAllChildren[i] = child;
|
||||
child.addOnLayoutChangeListener(mChildrenLayoutChangeListener);
|
||||
setViewClipped(child, false);
|
||||
}
|
||||
updateClippingRect();
|
||||
} else {
|
||||
@@ -410,7 +407,6 @@ public class ReactViewGroup extends ViewGroup
|
||||
|
||||
private void updateClippingToRect(Rect clippingRect) {
|
||||
Assertions.assertNotNull(mAllChildren);
|
||||
mInSubviewClippingLoop = true;
|
||||
int clippedSoFar = 0;
|
||||
for (int i = 0; i < mAllChildrenCount; i++) {
|
||||
try {
|
||||
@@ -419,7 +415,7 @@ public class ReactViewGroup extends ViewGroup
|
||||
int realClippedSoFar = 0;
|
||||
Set<View> uniqueViews = new HashSet<>();
|
||||
for (int j = 0; j < i; j++) {
|
||||
realClippedSoFar += isViewClipped(mAllChildren[j], null) ? 1 : 0;
|
||||
realClippedSoFar += isViewClipped(mAllChildren[j]) ? 1 : 0;
|
||||
uniqueViews.add(mAllChildren[j]);
|
||||
}
|
||||
|
||||
@@ -440,11 +436,10 @@ public class ReactViewGroup extends ViewGroup
|
||||
+ uniqueViews.size(),
|
||||
e);
|
||||
}
|
||||
if (isViewClipped(mAllChildren[i], i)) {
|
||||
if (isViewClipped(mAllChildren[i])) {
|
||||
clippedSoFar++;
|
||||
}
|
||||
}
|
||||
mInSubviewClippingLoop = false;
|
||||
}
|
||||
|
||||
private void updateSubviewClipStatus(Rect clippingRect, int idx, int clippedSoFar) {
|
||||
@@ -463,16 +458,14 @@ public class ReactViewGroup extends ViewGroup
|
||||
// it won't be size and located properly.
|
||||
Animation animation = child.getAnimation();
|
||||
boolean isAnimating = animation != null && !animation.hasEnded();
|
||||
if (!intersects && !isViewClipped(child, idx) && !isAnimating) {
|
||||
setViewClipped(child, true);
|
||||
if (!intersects && !isViewClipped(child) && !isAnimating) {
|
||||
// We can try saving on invalidate call here as the view that we remove is out of visible area
|
||||
// therefore invalidation is not necessary.
|
||||
removeViewInLayout(child);
|
||||
needUpdateClippingRecursive = true;
|
||||
} else if (intersects && isViewClipped(child, idx)) {
|
||||
} else if (intersects && isViewClipped(child)) {
|
||||
int adjustedIdx = idx - clippedSoFar;
|
||||
Assertions.assertCondition(adjustedIdx >= 0);
|
||||
setViewClipped(child, false);
|
||||
addViewInLayout(child, adjustedIdx, sDefaultLayoutParam, true);
|
||||
invalidate();
|
||||
needUpdateClippingRecursive = true;
|
||||
@@ -504,21 +497,19 @@ public class ReactViewGroup extends ViewGroup
|
||||
subview.getLeft(), subview.getTop(), subview.getRight(), subview.getBottom());
|
||||
|
||||
// If it was intersecting before, should be attached to the parent
|
||||
boolean oldIntersects = !isViewClipped(subview, null);
|
||||
boolean oldIntersects = !isViewClipped(subview);
|
||||
|
||||
if (intersects != oldIntersects) {
|
||||
mInSubviewClippingLoop = true;
|
||||
int clippedSoFar = 0;
|
||||
for (int i = 0; i < mAllChildrenCount; i++) {
|
||||
if (mAllChildren[i] == subview) {
|
||||
updateSubviewClipStatus(mClippingRect, i, clippedSoFar);
|
||||
break;
|
||||
}
|
||||
if (isViewClipped(mAllChildren[i], i)) {
|
||||
if (isViewClipped(mAllChildren[i])) {
|
||||
clippedSoFar++;
|
||||
}
|
||||
}
|
||||
mInSubviewClippingLoop = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +541,7 @@ public class ReactViewGroup extends ViewGroup
|
||||
@Override
|
||||
public void onViewAdded(View child) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
checkViewClippingTag(child, Boolean.FALSE);
|
||||
|
||||
if (!customDrawOrderDisabled()) {
|
||||
getDrawingOrderHelper().handleAddView(child);
|
||||
setChildrenDrawingOrderEnabled(getDrawingOrderHelper().shouldEnableCustomDrawingOrder());
|
||||
@@ -563,7 +554,7 @@ public class ReactViewGroup extends ViewGroup
|
||||
@Override
|
||||
public void onViewRemoved(View child) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
checkViewClippingTag(child, Boolean.TRUE);
|
||||
|
||||
if (!customDrawOrderDisabled()) {
|
||||
if (indexOfChild(child) == -1) {
|
||||
return;
|
||||
@@ -576,21 +567,6 @@ public class ReactViewGroup extends ViewGroup
|
||||
super.onViewRemoved(child);
|
||||
}
|
||||
|
||||
private void checkViewClippingTag(View child, Boolean expectedTag) {
|
||||
if (mInSubviewClippingLoop) {
|
||||
Object tag = child.getTag(R.id.view_clipped);
|
||||
if (!expectedTag.equals(tag)) {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
"ReactViewGroup.onViewRemoved",
|
||||
new ReactNoCrashSoftException(
|
||||
"View clipping tag mismatch: tag=" + tag + " expected=" + expectedTag));
|
||||
}
|
||||
}
|
||||
if (mRemoveClippedSubviews) {
|
||||
child.setTag(R.id.view_clipped, expectedTag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getChildDrawingOrder(int childCount, int index) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
@@ -662,22 +638,19 @@ public class ReactViewGroup extends ViewGroup
|
||||
/*package*/ void addViewWithSubviewClippingEnabled(
|
||||
final View child, int index, ViewGroup.LayoutParams params) {
|
||||
Assertions.assertCondition(mRemoveClippedSubviews);
|
||||
setViewClipped(child, true); // the view has not been added, so it is "clipped"
|
||||
addInArray(child, index);
|
||||
|
||||
// we add view as "clipped" and then run {@link #updateSubviewClipStatus} to conditionally
|
||||
// attach it
|
||||
Rect clippingRect = Assertions.assertNotNull(mClippingRect);
|
||||
View[] childArray = Assertions.assertNotNull(mAllChildren);
|
||||
mInSubviewClippingLoop = true;
|
||||
int clippedSoFar = 0;
|
||||
for (int i = 0; i < index; i++) {
|
||||
if (isViewClipped(childArray[i], i)) {
|
||||
if (isViewClipped(childArray[i])) {
|
||||
clippedSoFar++;
|
||||
}
|
||||
}
|
||||
updateSubviewClipStatus(clippingRect, index, clippedSoFar);
|
||||
mInSubviewClippingLoop = false;
|
||||
child.addOnLayoutChangeListener(mChildrenLayoutChangeListener);
|
||||
|
||||
if (child instanceof ReactClippingProhibitedView) {
|
||||
@@ -712,10 +685,10 @@ public class ReactViewGroup extends ViewGroup
|
||||
View[] childArray = Assertions.assertNotNull(mAllChildren);
|
||||
view.removeOnLayoutChangeListener(mChildrenLayoutChangeListener);
|
||||
int index = indexOfChildInAllChildren(view);
|
||||
if (!isViewClipped(childArray[index], index)) {
|
||||
if (!isViewClipped(childArray[index])) {
|
||||
int clippedSoFar = 0;
|
||||
for (int i = 0; i < index; i++) {
|
||||
if (isViewClipped(childArray[i], i)) {
|
||||
if (isViewClipped(childArray[i])) {
|
||||
clippedSoFar++;
|
||||
}
|
||||
}
|
||||
@@ -736,27 +709,9 @@ public class ReactViewGroup extends ViewGroup
|
||||
|
||||
/**
|
||||
* @return {@code true} if the view has been removed from the ViewGroup.
|
||||
* @param index For logging - index of the view in {@code mAllChildren}, or {@code null} to skip
|
||||
* logging.
|
||||
*/
|
||||
private boolean isViewClipped(View view, @Nullable Integer index) {
|
||||
Object tag = view.getTag(R.id.view_clipped);
|
||||
if (tag != null) {
|
||||
return (boolean) tag;
|
||||
}
|
||||
private boolean isViewClipped(View view) {
|
||||
ViewParent parent = view.getParent();
|
||||
if (index != null) {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
"ReactViewGroup.isViewClipped",
|
||||
new ReactNoCrashSoftException(
|
||||
"View missing clipping tag: index="
|
||||
+ index
|
||||
+ " parentNull="
|
||||
+ (parent == null)
|
||||
+ " parentThis="
|
||||
+ (parent == this)));
|
||||
}
|
||||
// fallback - parent *should* be null if the view was removed
|
||||
if (parent == null) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -765,10 +720,6 @@ public class ReactViewGroup extends ViewGroup
|
||||
}
|
||||
}
|
||||
|
||||
private static void setViewClipped(View view, boolean clipped) {
|
||||
view.setTag(R.id.view_clipped, clipped);
|
||||
}
|
||||
|
||||
private int indexOfChildInAllChildren(View child) {
|
||||
final int count = mAllChildrenCount;
|
||||
final View[] childArray = Assertions.assertNotNull(mAllChildren);
|
||||
|
||||
@@ -74,9 +74,6 @@ public class YogaNative {
|
||||
static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis);
|
||||
static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin);
|
||||
static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent);
|
||||
@@ -94,40 +91,22 @@ public class YogaNative {
|
||||
static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width);
|
||||
static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height);
|
||||
static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth);
|
||||
static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMinWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight);
|
||||
static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMinHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth);
|
||||
static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMaxWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight);
|
||||
static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMaxHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightStretchJNI(long nativePointer);
|
||||
static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio);
|
||||
static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
|
||||
|
||||
@@ -124,12 +124,6 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setFlexBasisAuto();
|
||||
|
||||
public abstract void setFlexBasisMaxContent();
|
||||
|
||||
public abstract void setFlexBasisFitContent();
|
||||
|
||||
public abstract void setFlexBasisStretch();
|
||||
|
||||
public abstract YogaValue getMargin(YogaEdge edge);
|
||||
|
||||
public abstract void setMargin(YogaEdge edge, float margin);
|
||||
@@ -164,12 +158,6 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setWidthAuto();
|
||||
|
||||
public abstract void setWidthMaxContent();
|
||||
|
||||
public abstract void setWidthFitContent();
|
||||
|
||||
public abstract void setWidthStretch();
|
||||
|
||||
public abstract YogaValue getHeight();
|
||||
|
||||
public abstract void setHeight(float height);
|
||||
@@ -178,60 +166,30 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setHeightAuto();
|
||||
|
||||
public abstract void setHeightMaxContent();
|
||||
|
||||
public abstract void setHeightFitContent();
|
||||
|
||||
public abstract void setHeightStretch();
|
||||
|
||||
public abstract YogaValue getMinWidth();
|
||||
|
||||
public abstract void setMinWidth(float minWidth);
|
||||
|
||||
public abstract void setMinWidthPercent(float percent);
|
||||
|
||||
public abstract void setMinWidthMaxContent();
|
||||
|
||||
public abstract void setMinWidthFitContent();
|
||||
|
||||
public abstract void setMinWidthStretch();
|
||||
|
||||
public abstract YogaValue getMinHeight();
|
||||
|
||||
public abstract void setMinHeight(float minHeight);
|
||||
|
||||
public abstract void setMinHeightPercent(float percent);
|
||||
|
||||
public abstract void setMinHeightMaxContent();
|
||||
|
||||
public abstract void setMinHeightFitContent();
|
||||
|
||||
public abstract void setMinHeightStretch();
|
||||
|
||||
public abstract YogaValue getMaxWidth();
|
||||
|
||||
public abstract void setMaxWidth(float maxWidth);
|
||||
|
||||
public abstract void setMaxWidthPercent(float percent);
|
||||
|
||||
public abstract void setMaxWidthMaxContent();
|
||||
|
||||
public abstract void setMaxWidthFitContent();
|
||||
|
||||
public abstract void setMaxWidthStretch();
|
||||
|
||||
public abstract YogaValue getMaxHeight();
|
||||
|
||||
public abstract void setMaxHeight(float maxheight);
|
||||
|
||||
public abstract void setMaxHeightPercent(float percent);
|
||||
|
||||
public abstract void setMaxHeightMaxContent();
|
||||
|
||||
public abstract void setMaxHeightFitContent();
|
||||
|
||||
public abstract void setMaxHeightStretch();
|
||||
|
||||
public abstract float getAspectRatio();
|
||||
|
||||
public abstract void setAspectRatio(float aspectRatio);
|
||||
|
||||
-84
@@ -373,18 +373,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMargin(YogaEdge edge) {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue()));
|
||||
}
|
||||
@@ -453,18 +441,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -481,18 +457,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMinWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer));
|
||||
}
|
||||
@@ -505,18 +469,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMinWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMinHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -529,18 +481,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMinHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMaxWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer));
|
||||
}
|
||||
@@ -553,18 +493,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMaxWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMaxHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -577,18 +505,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMaxHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public float getAspectRatio() {
|
||||
return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer);
|
||||
}
|
||||
|
||||
@@ -15,33 +15,15 @@ public interface YogaProps {
|
||||
|
||||
void setWidthPercent(float percent);
|
||||
|
||||
void setWidthAuto();
|
||||
|
||||
void setWidthMaxContent();
|
||||
|
||||
void setWidthFitContent();
|
||||
|
||||
void setWidthStretch();
|
||||
|
||||
void setMinWidth(float minWidth);
|
||||
|
||||
void setMinWidthPercent(float percent);
|
||||
|
||||
void setMinWidthMaxContent();
|
||||
|
||||
void setMinWidthFitContent();
|
||||
|
||||
void setMinWidthStretch();
|
||||
|
||||
void setMaxWidth(float maxWidth);
|
||||
|
||||
void setMaxWidthPercent(float percent);
|
||||
|
||||
void setMaxWidthMaxContent();
|
||||
|
||||
void setMaxWidthFitContent();
|
||||
|
||||
void setMaxWidthStretch();
|
||||
void setWidthAuto();
|
||||
|
||||
/* Height properties */
|
||||
|
||||
@@ -49,33 +31,15 @@ public interface YogaProps {
|
||||
|
||||
void setHeightPercent(float percent);
|
||||
|
||||
void setHeightAuto();
|
||||
|
||||
void setHeightMaxContent();
|
||||
|
||||
void setHeightFitContent();
|
||||
|
||||
void setHeightStretch();
|
||||
|
||||
void setMinHeight(float minHeight);
|
||||
|
||||
void setMinHeightPercent(float percent);
|
||||
|
||||
void setMinHeightMaxContent();
|
||||
|
||||
void setMinHeightFitContent();
|
||||
|
||||
void setMinHeightStretch();
|
||||
|
||||
void setMaxHeight(float maxHeight);
|
||||
|
||||
void setMaxHeightPercent(float percent);
|
||||
|
||||
void setMaxHeightMaxContent();
|
||||
|
||||
void setMaxHeightFitContent();
|
||||
|
||||
void setMaxHeightStretch();
|
||||
void setHeightAuto();
|
||||
|
||||
/* Margin properties */
|
||||
|
||||
@@ -117,12 +81,6 @@ public interface YogaProps {
|
||||
|
||||
void setFlexBasis(float flexBasis);
|
||||
|
||||
void setFlexBasisMaxContent();
|
||||
|
||||
void setFlexBasisFitContent();
|
||||
|
||||
void setFlexBasisStretch();
|
||||
|
||||
void setFlexDirection(YogaFlexDirection direction);
|
||||
|
||||
void setFlexGrow(float flexGrow);
|
||||
|
||||
@@ -13,10 +13,7 @@ public enum YogaUnit {
|
||||
UNDEFINED(0),
|
||||
POINT(1),
|
||||
PERCENT(2),
|
||||
AUTO(3),
|
||||
MAX_CONTENT(4),
|
||||
FIT_CONTENT(5),
|
||||
STRETCH(6);
|
||||
AUTO(3);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
@@ -34,9 +31,6 @@ public enum YogaUnit {
|
||||
case 1: return POINT;
|
||||
case 2: return PERCENT;
|
||||
case 3: return AUTO;
|
||||
case 4: return MAX_CONTENT;
|
||||
case 5: return FIT_CONTENT;
|
||||
case 6: return STRETCH;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-92
@@ -429,28 +429,6 @@ static void jni_YGNodeCopyStyleJNI(
|
||||
YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name)
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name)
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) \
|
||||
static void jni_YGNodeStyleSet##name##MaxContentJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##MaxContent(_jlong2YGNodeRef(nativePointer)); \
|
||||
} \
|
||||
static void jni_YGNodeStyleSet##name##FitContentJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##FitContent(_jlong2YGNodeRef(nativePointer)); \
|
||||
} \
|
||||
static void jni_YGNodeStyleSet##name##StretchJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##Stretch(_jlong2YGNodeRef(nativePointer)); \
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
||||
static jlong jni_YGNodeStyleGet##name##JNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \
|
||||
@@ -505,13 +483,13 @@ YG_NODE_JNI_STYLE_PROP(jfloat, float, Flex);
|
||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
|
||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
|
||||
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(FlexBasis);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Width);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Height);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(FlexBasis);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Width);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MinWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MaxWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Height);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MinHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MaxHeight);
|
||||
|
||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(Position);
|
||||
|
||||
@@ -892,15 +870,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetFlexBasisAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisAutoJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisFitContentJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisStretchJNI},
|
||||
{"jni_YGNodeStyleGetMarginJNI",
|
||||
"(JI)J",
|
||||
(void*)jni_YGNodeStyleGetMarginJNI},
|
||||
@@ -948,15 +917,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetWidthAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthAutoJNI},
|
||||
{"jni_YGNodeStyleSetWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetHeightJNI},
|
||||
{"jni_YGNodeStyleSetHeightJNI",
|
||||
"(JF)V",
|
||||
@@ -967,15 +927,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetHeightAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightAutoJNI},
|
||||
{"jni_YGNodeStyleSetHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetMinWidthJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMinWidthJNI},
|
||||
@@ -985,15 +936,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMinWidthPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthPercentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetMinHeightJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMinHeightJNI},
|
||||
@@ -1003,15 +945,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMinHeightPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightPercentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetMaxWidthJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMaxWidthJNI},
|
||||
@@ -1021,15 +954,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMaxWidthPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthPercentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetMaxHeightJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMaxHeightJNI},
|
||||
@@ -1039,15 +963,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMaxHeightPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightPercentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetAspectRatioJNI",
|
||||
"(J)F",
|
||||
(void*)jni_YGNodeStyleGetAspectRatioJNI},
|
||||
|
||||
+1
-15
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<640630d7a40b53f7d507569aa6409f69>>
|
||||
* @generated SignedSource<<902b269e45fcb4970c6f8a86818e1940>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -213,12 +213,6 @@ class ReactNativeFeatureFlagsProviderHolder
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixDifferentiatorEmittingUpdatesWithWrongParentTag");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixMappingOfEventPrioritiesBetweenFabricAndReact");
|
||||
@@ -470,11 +464,6 @@ bool JReactNativeFeatureFlagsCxxInterop::excludeYogaFromRawProps(
|
||||
return ReactNativeFeatureFlags::excludeYogaFromRawProps();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::fixDifferentiatorEmittingUpdatesWithWrongParentTag(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::fixDifferentiatorEmittingUpdatesWithWrongParentTag();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
||||
@@ -678,9 +667,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"excludeYogaFromRawProps",
|
||||
JReactNativeFeatureFlagsCxxInterop::excludeYogaFromRawProps),
|
||||
makeNativeMethod(
|
||||
"fixDifferentiatorEmittingUpdatesWithWrongParentTag",
|
||||
JReactNativeFeatureFlagsCxxInterop::fixDifferentiatorEmittingUpdatesWithWrongParentTag),
|
||||
makeNativeMethod(
|
||||
"fixMappingOfEventPrioritiesBetweenFabricAndReact",
|
||||
JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact),
|
||||
|
||||
+1
-4
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<4218168e779a2241d0752771c1f51b12>>
|
||||
* @generated SignedSource<<17da0d7937c5c0c533293b86c8cdc9be>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -117,9 +117,6 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool excludeYogaFromRawProps(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool fixDifferentiatorEmittingUpdatesWithWrongParentTag(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool fixMappingOfEventPrioritiesBetweenFabricAndReact(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- tag used to store state of ReactViewGroup subview clipping -->
|
||||
<item type="id" name="view_clipped"/>
|
||||
</resources>
|
||||
@@ -221,13 +221,6 @@ Pod::Spec.new do |s|
|
||||
|
||||
end
|
||||
|
||||
s.subspec "consistency" do |ss|
|
||||
ss.dependency folly_dep_name, folly_version
|
||||
ss.compiler_flags = folly_compiler_flags
|
||||
ss.source_files = "react/renderer/consistency/**/*.{m,mm,cpp,h}"
|
||||
ss.header_dir = "react/renderer/consistency"
|
||||
end
|
||||
|
||||
s.subspec "uimanager" do |ss|
|
||||
ss.subspec "consistency" do |sss|
|
||||
sss.dependency folly_dep_name, folly_version
|
||||
|
||||
@@ -125,14 +125,18 @@ void HostAgent::handleRequest(const cdp::PreparsedRequest& req) {
|
||||
|
||||
shouldSendOKResponse = true;
|
||||
isFinishedHandlingRequest = true;
|
||||
} else if (req.method == "ReactNativeApplication.enable") {
|
||||
sessionState_.isReactNativeApplicationDomainEnabled = true;
|
||||
} else if (req.method == "FuseboxClient.setClientMetadata") {
|
||||
fuseboxClientType_ = FuseboxClientType::Fusebox;
|
||||
|
||||
if (sessionState_.isLogDomainEnabled) {
|
||||
sendFuseboxNotice();
|
||||
}
|
||||
|
||||
shouldSendOKResponse = true;
|
||||
isFinishedHandlingRequest = true;
|
||||
} else if (req.method == "ReactNativeApplication.enable") {
|
||||
sessionState_.isReactNativeApplicationDomainEnabled = true;
|
||||
|
||||
frontendChannel_(cdp::jsonNotification(
|
||||
"ReactNativeApplication.metadataUpdated",
|
||||
createHostMetadataPayload(hostMetadata_)));
|
||||
|
||||
@@ -20,39 +20,31 @@ folly_config = get_folly_config()
|
||||
folly_compiler_flags = folly_config[:compiler_flags]
|
||||
folly_version = folly_config[:version]
|
||||
|
||||
header_search_paths = [
|
||||
"\"$(PODS_TARGET_SRCROOT)/..\"",
|
||||
"\"$(PODS_ROOT)/boost\"",
|
||||
"\"$(PODS_ROOT)/DoubleConversion\"",
|
||||
"\"$(PODS_ROOT)/fast_float/include\"",
|
||||
"\"$(PODS_ROOT)/fmt/include\"",
|
||||
"\"$(PODS_ROOT)/RCT-Folly\"",
|
||||
]
|
||||
use_frameworks = ENV['USE_FRAMEWORKS'] != nil
|
||||
|
||||
header_dir = 'jsinspector-modern'
|
||||
module_name = "jsinspector_modern"
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React-jsinspector"
|
||||
s.version = version
|
||||
s.summary = "React Native subsystem for modern debugging over the Chrome DevTools Protocol (CDP)"
|
||||
s.summary = "-" # TODO
|
||||
s.homepage = "https://reactnative.dev/"
|
||||
s.license = package["license"]
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = min_supported_versions
|
||||
s.source = source
|
||||
s.source_files = "*.{cpp,h,def}"
|
||||
s.header_dir = header_dir
|
||||
s.header_dir = 'jsinspector-modern'
|
||||
s.compiler_flags = folly_compiler_flags
|
||||
s.pod_target_xcconfig = {
|
||||
"HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
|
||||
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/..\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/fast_float/include\" \"$(PODS_ROOT)/fmt/include\"",
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
||||
"DEFINES_MODULE" => "YES"
|
||||
}.merge!(ENV['USE_FRAMEWORKS'] ? {
|
||||
}.merge!(use_frameworks ? {
|
||||
"PUBLIC_HEADERS_FOLDER_PATH" => "#{module_name}.framework/Headers/#{header_dir}"
|
||||
} : {})
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
if use_frameworks
|
||||
s.module_name = module_name
|
||||
end
|
||||
|
||||
|
||||
@@ -348,6 +348,21 @@ TYPED_TEST(JsiIntegrationPortableTest, ExceptionDuringAddBindingIsIgnored) {
|
||||
EXPECT_TRUE(this->eval("globalThis.foo === 42").getBool());
|
||||
}
|
||||
|
||||
TYPED_TEST(JsiIntegrationPortableTest, FuseboxSetClientMetadata) {
|
||||
this->connect();
|
||||
|
||||
this->expectMessageFromPage(JsonEq(R"({
|
||||
"id": 1,
|
||||
"result": {}
|
||||
})"));
|
||||
|
||||
this->toPage_->sendMessage(R"({
|
||||
"id": 1,
|
||||
"method": "FuseboxClient.setClientMetadata",
|
||||
"params": {}
|
||||
})");
|
||||
}
|
||||
|
||||
TYPED_TEST(JsiIntegrationPortableTest, ReactNativeApplicationEnable) {
|
||||
this->connect();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<2409869111055ff0b32c1f40c10042d7>>
|
||||
* @generated SignedSource<<ef215623465d45c563030d724287b1c9>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -142,10 +142,6 @@ bool ReactNativeFeatureFlags::excludeYogaFromRawProps() {
|
||||
return getAccessor().excludeYogaFromRawProps();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::fixDifferentiatorEmittingUpdatesWithWrongParentTag() {
|
||||
return getAccessor().fixDifferentiatorEmittingUpdatesWithWrongParentTag();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact() {
|
||||
return getAccessor().fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<e628af8109a1d8bb6425515d824852a3>>
|
||||
* @generated SignedSource<<f741660e4cf2528defe0ab1f61858aab>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -184,11 +184,6 @@ class ReactNativeFeatureFlags {
|
||||
*/
|
||||
RN_EXPORT static bool excludeYogaFromRawProps();
|
||||
|
||||
/**
|
||||
* Fixes a bug in Differentiator where parent views may be referenced before they're created
|
||||
*/
|
||||
RN_EXPORT static bool fixDifferentiatorEmittingUpdatesWithWrongParentTag();
|
||||
|
||||
/**
|
||||
* Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
|
||||
*/
|
||||
|
||||
+18
-36
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<1e5b87b564e880cfb1423a85692092ba>>
|
||||
* @generated SignedSource<<4c3956150bbf826c2abf4f8daf569b88>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -551,24 +551,6 @@ bool ReactNativeFeatureFlagsAccessor::excludeYogaFromRawProps() {
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::fixDifferentiatorEmittingUpdatesWithWrongParentTag() {
|
||||
auto flagValue = fixDifferentiatorEmittingUpdatesWithWrongParentTag_.load();
|
||||
|
||||
if (!flagValue.has_value()) {
|
||||
// This block is not exclusive but it is not necessary.
|
||||
// If multiple threads try to initialize the feature flag, we would only
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(29, "fixDifferentiatorEmittingUpdatesWithWrongParentTag");
|
||||
|
||||
flagValue = currentProvider_->fixDifferentiatorEmittingUpdatesWithWrongParentTag();
|
||||
fixDifferentiatorEmittingUpdatesWithWrongParentTag_ = flagValue;
|
||||
}
|
||||
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAndReact() {
|
||||
auto flagValue = fixMappingOfEventPrioritiesBetweenFabricAndReact_.load();
|
||||
|
||||
@@ -578,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(30, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
|
||||
markFlagAsAccessed(29, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
|
||||
|
||||
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
||||
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
|
||||
@@ -596,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMountingCoordinatorReportedPendingTrans
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(31, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
|
||||
markFlagAsAccessed(30, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
|
||||
fixMountingCoordinatorReportedPendingTransactionsOnAndroid_ = flagValue;
|
||||
@@ -614,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledDebug() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(32, "fuseboxEnabledDebug");
|
||||
markFlagAsAccessed(31, "fuseboxEnabledDebug");
|
||||
|
||||
flagValue = currentProvider_->fuseboxEnabledDebug();
|
||||
fuseboxEnabledDebug_ = flagValue;
|
||||
@@ -632,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(33, "fuseboxEnabledRelease");
|
||||
markFlagAsAccessed(32, "fuseboxEnabledRelease");
|
||||
|
||||
flagValue = currentProvider_->fuseboxEnabledRelease();
|
||||
fuseboxEnabledRelease_ = flagValue;
|
||||
@@ -650,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::initEagerTurboModulesOnNativeModulesQueueA
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(34, "initEagerTurboModulesOnNativeModulesQueueAndroid");
|
||||
markFlagAsAccessed(33, "initEagerTurboModulesOnNativeModulesQueueAndroid");
|
||||
|
||||
flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid();
|
||||
initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue;
|
||||
@@ -668,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::lazyAnimationCallbacks() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(35, "lazyAnimationCallbacks");
|
||||
markFlagAsAccessed(34, "lazyAnimationCallbacks");
|
||||
|
||||
flagValue = currentProvider_->lazyAnimationCallbacks();
|
||||
lazyAnimationCallbacks_ = flagValue;
|
||||
@@ -686,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(36, "loadVectorDrawablesOnImages");
|
||||
markFlagAsAccessed(35, "loadVectorDrawablesOnImages");
|
||||
|
||||
flagValue = currentProvider_->loadVectorDrawablesOnImages();
|
||||
loadVectorDrawablesOnImages_ = flagValue;
|
||||
@@ -704,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(37, "traceTurboModulePromiseRejectionsOnAndroid");
|
||||
markFlagAsAccessed(36, "traceTurboModulePromiseRejectionsOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
|
||||
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
|
||||
@@ -722,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(38, "useAlwaysAvailableJSErrorHandling");
|
||||
markFlagAsAccessed(37, "useAlwaysAvailableJSErrorHandling");
|
||||
|
||||
flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
|
||||
useAlwaysAvailableJSErrorHandling_ = flagValue;
|
||||
@@ -740,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(39, "useFabricInterop");
|
||||
markFlagAsAccessed(38, "useFabricInterop");
|
||||
|
||||
flagValue = currentProvider_->useFabricInterop();
|
||||
useFabricInterop_ = flagValue;
|
||||
@@ -758,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless()
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(40, "useImmediateExecutorInAndroidBridgeless");
|
||||
markFlagAsAccessed(39, "useImmediateExecutorInAndroidBridgeless");
|
||||
|
||||
flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless();
|
||||
useImmediateExecutorInAndroidBridgeless_ = flagValue;
|
||||
@@ -776,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(41, "useNativeViewConfigsInBridgelessMode");
|
||||
markFlagAsAccessed(40, "useNativeViewConfigsInBridgelessMode");
|
||||
|
||||
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
|
||||
useNativeViewConfigsInBridgelessMode_ = flagValue;
|
||||
@@ -794,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimisedViewPreallocationOnAndroid() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(42, "useOptimisedViewPreallocationOnAndroid");
|
||||
markFlagAsAccessed(41, "useOptimisedViewPreallocationOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid();
|
||||
useOptimisedViewPreallocationOnAndroid_ = flagValue;
|
||||
@@ -812,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(43, "useOptimizedEventBatchingOnAndroid");
|
||||
markFlagAsAccessed(42, "useOptimizedEventBatchingOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
|
||||
useOptimizedEventBatchingOnAndroid_ = flagValue;
|
||||
@@ -830,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(44, "useRuntimeShadowNodeReferenceUpdate");
|
||||
markFlagAsAccessed(43, "useRuntimeShadowNodeReferenceUpdate");
|
||||
|
||||
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
|
||||
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
|
||||
@@ -848,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(45, "useTurboModuleInterop");
|
||||
markFlagAsAccessed(44, "useTurboModuleInterop");
|
||||
|
||||
flagValue = currentProvider_->useTurboModuleInterop();
|
||||
useTurboModuleInterop_ = flagValue;
|
||||
@@ -866,7 +848,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(46, "useTurboModules");
|
||||
markFlagAsAccessed(45, "useTurboModules");
|
||||
|
||||
flagValue = currentProvider_->useTurboModules();
|
||||
useTurboModules_ = flagValue;
|
||||
|
||||
+2
-4
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<eb44aabe7e352481267aa9a6bf035ff1>>
|
||||
* @generated SignedSource<<3d98085a73dfc51541342dbb42ed89ab>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,6 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
bool enableUIConsistency();
|
||||
bool enableViewRecycling();
|
||||
bool excludeYogaFromRawProps();
|
||||
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag();
|
||||
bool fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
||||
bool fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
|
||||
bool fuseboxEnabledDebug();
|
||||
@@ -90,7 +89,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
|
||||
bool wasOverridden_;
|
||||
|
||||
std::array<std::atomic<const char*>, 47> accessedFeatureFlags_;
|
||||
std::array<std::atomic<const char*>, 46> accessedFeatureFlags_;
|
||||
|
||||
std::atomic<std::optional<bool>> commonTestFlag_;
|
||||
std::atomic<std::optional<bool>> completeReactInstanceCreationOnBgThreadOnAndroid_;
|
||||
@@ -121,7 +120,6 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::atomic<std::optional<bool>> enableUIConsistency_;
|
||||
std::atomic<std::optional<bool>> enableViewRecycling_;
|
||||
std::atomic<std::optional<bool>> excludeYogaFromRawProps_;
|
||||
std::atomic<std::optional<bool>> fixDifferentiatorEmittingUpdatesWithWrongParentTag_;
|
||||
std::atomic<std::optional<bool>> fixMappingOfEventPrioritiesBetweenFabricAndReact_;
|
||||
std::atomic<std::optional<bool>> fixMountingCoordinatorReportedPendingTransactionsOnAndroid_;
|
||||
std::atomic<std::optional<bool>> fuseboxEnabledDebug_;
|
||||
|
||||
+1
-5
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<ee899be30798eb6d386b44bc6bc027ea>>
|
||||
* @generated SignedSource<<aff3c46b8d2db3bde519e1392569d53d>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -143,10 +143,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag() override {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override {
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-2
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<e5d1c60102f7444332bd34627c02eddd>>
|
||||
* @generated SignedSource<<8f8c7a372cdf9a3c06bc0d71f1ed85ad>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,6 @@ class ReactNativeFeatureFlagsProvider {
|
||||
virtual bool enableUIConsistency() = 0;
|
||||
virtual bool enableViewRecycling() = 0;
|
||||
virtual bool excludeYogaFromRawProps() = 0;
|
||||
virtual bool fixDifferentiatorEmittingUpdatesWithWrongParentTag() = 0;
|
||||
virtual bool fixMappingOfEventPrioritiesBetweenFabricAndReact() = 0;
|
||||
virtual bool fixMountingCoordinatorReportedPendingTransactionsOnAndroid() = 0;
|
||||
virtual bool fuseboxEnabledDebug() = 0;
|
||||
|
||||
+1
-6
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<4055a9b5e34ff6740a99d4e08853fe7d>>
|
||||
* @generated SignedSource<<4808c1455f8e17c42036055dd6a81d7d>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -189,11 +189,6 @@ bool NativeReactNativeFeatureFlags::excludeYogaFromRawProps(
|
||||
return ReactNativeFeatureFlags::excludeYogaFromRawProps();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::fixDifferentiatorEmittingUpdatesWithWrongParentTag(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::fixDifferentiatorEmittingUpdatesWithWrongParentTag();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
||||
|
||||
+1
-3
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<9541abe6da92d991557ca6d2f1e36a9a>>
|
||||
* @generated SignedSource<<6b4909879b76908792d89e3f24c1453a>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -95,8 +95,6 @@ class NativeReactNativeFeatureFlags
|
||||
|
||||
bool excludeYogaFromRawProps(jsi::Runtime& runtime);
|
||||
|
||||
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag(jsi::Runtime& runtime);
|
||||
|
||||
bool fixMappingOfEventPrioritiesBetweenFabricAndReact(jsi::Runtime& runtime);
|
||||
|
||||
bool fixMountingCoordinatorReportedPendingTransactionsOnAndroid(jsi::Runtime& runtime);
|
||||
|
||||
+9
-4
@@ -45,8 +45,10 @@ namespace {
|
||||
#endif
|
||||
|
||||
NO_DESTROY const std::string TRACK_PREFIX = "Track:";
|
||||
NO_DESTROY const std::string DEFAULT_TRACK_NAME = "# Web Performance";
|
||||
NO_DESTROY const std::string CUSTOM_TRACK_NAME_PREFIX = "# Web Performance: ";
|
||||
|
||||
std::tuple<std::optional<std::string>, std::string_view> parseTrackName(
|
||||
std::tuple<std::string, std::string_view> parseTrackName(
|
||||
const std::string& name) {
|
||||
// Until there's a standard way to pass through track information, parse it
|
||||
// manually, e.g., "Track:Foo:Event name"
|
||||
@@ -56,13 +58,16 @@ std::tuple<std::optional<std::string>, std::string_view> parseTrackName(
|
||||
if (name.starts_with(TRACK_PREFIX)) {
|
||||
const auto trackNameDelimiter = name.find(':', TRACK_PREFIX.length());
|
||||
if (trackNameDelimiter != std::string::npos) {
|
||||
trackName = name.substr(
|
||||
TRACK_PREFIX.length(), trackNameDelimiter - TRACK_PREFIX.length());
|
||||
trackName = CUSTOM_TRACK_NAME_PREFIX +
|
||||
name.substr(
|
||||
TRACK_PREFIX.length(),
|
||||
trackNameDelimiter - TRACK_PREFIX.length());
|
||||
eventName = std::string_view(name).substr(trackNameDelimiter + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_tuple(trackName, eventName);
|
||||
auto& trackNameRef = trackName.has_value() ? *trackName : DEFAULT_TRACK_NAME;
|
||||
return std::make_tuple(trackNameRef, eventName);
|
||||
}
|
||||
|
||||
class PerformanceObserverWrapper : public jsi::NativeState {
|
||||
|
||||
+1
-9
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <react/debug/flags.h>
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
|
||||
#include <react/renderer/animations/conversions.h>
|
||||
#include <react/renderer/animations/utils.h>
|
||||
#include <react/renderer/components/image/ImageProps.h>
|
||||
@@ -392,14 +392,6 @@ LayoutAnimationKeyFrameManager::pullTransaction(
|
||||
if (keyframe.type == AnimationConfigurationType::Update &&
|
||||
mutation.newChildShadowView.tag > 0) {
|
||||
keyframe.viewPrev = mutation.newChildShadowView;
|
||||
if (ReactNativeFeatureFlags::
|
||||
fixDifferentiatorEmittingUpdatesWithWrongParentTag()) {
|
||||
keyframe.parentView = mutation.parentShadowView;
|
||||
react_native_assert(
|
||||
keyframe.finalMutationsForKeyFrame.size() == 1);
|
||||
keyframe.finalMutationsForKeyFrame[0].parentShadowView =
|
||||
mutation.parentShadowView;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-30
@@ -41,38 +41,16 @@ bool ParagraphAttributes::operator!=(const ParagraphAttributes& rhs) const {
|
||||
|
||||
#if RN_DEBUG_STRING_CONVERTIBLE
|
||||
SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
|
||||
ParagraphAttributes paragraphAttributes{};
|
||||
return {
|
||||
debugStringConvertibleItem("maximumNumberOfLines", maximumNumberOfLines),
|
||||
debugStringConvertibleItem("ellipsizeMode", ellipsizeMode),
|
||||
debugStringConvertibleItem("textBreakStrategy", textBreakStrategy),
|
||||
debugStringConvertibleItem("adjustsFontSizeToFit", adjustsFontSizeToFit),
|
||||
debugStringConvertibleItem("minimumFontSize", minimumFontSize),
|
||||
debugStringConvertibleItem("maximumFontSize", maximumFontSize),
|
||||
debugStringConvertibleItem("includeFontPadding", includeFontPadding),
|
||||
debugStringConvertibleItem(
|
||||
"maximumNumberOfLines",
|
||||
maximumNumberOfLines,
|
||||
paragraphAttributes.maximumNumberOfLines),
|
||||
debugStringConvertibleItem(
|
||||
"ellipsizeMode", ellipsizeMode, paragraphAttributes.ellipsizeMode),
|
||||
debugStringConvertibleItem(
|
||||
"textBreakStrategy",
|
||||
textBreakStrategy,
|
||||
paragraphAttributes.textBreakStrategy),
|
||||
debugStringConvertibleItem(
|
||||
"adjustsFontSizeToFit",
|
||||
adjustsFontSizeToFit,
|
||||
paragraphAttributes.adjustsFontSizeToFit),
|
||||
debugStringConvertibleItem(
|
||||
"minimumFontSize",
|
||||
minimumFontSize,
|
||||
paragraphAttributes.minimumFontSize),
|
||||
debugStringConvertibleItem(
|
||||
"maximumFontSize",
|
||||
maximumFontSize,
|
||||
paragraphAttributes.maximumFontSize),
|
||||
debugStringConvertibleItem(
|
||||
"includeFontPadding",
|
||||
includeFontPadding,
|
||||
paragraphAttributes.includeFontPadding),
|
||||
debugStringConvertibleItem(
|
||||
"android_hyphenationFrequency",
|
||||
android_hyphenationFrequency,
|
||||
paragraphAttributes.android_hyphenationFrequency)};
|
||||
"android_hyphenationFrequency", android_hyphenationFrequency)};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user