mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aaff0d37e2 | ||
|
|
16a89816fc |
+2
-1
@@ -48,6 +48,7 @@ packages/react-native/flow/
|
||||
[options]
|
||||
enums=true
|
||||
experimental.pattern_matching=true
|
||||
experimental.pattern_matching.includes=<PROJECT_ROOT>/packages/react-native/src/private/components/virtualview/
|
||||
casting_syntax=both
|
||||
component_syntax=true
|
||||
|
||||
@@ -104,4 +105,4 @@ untyped-import
|
||||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.274.2
|
||||
^0.274.0
|
||||
|
||||
@@ -129,7 +129,7 @@ runs:
|
||||
run: yarn build
|
||||
- name: Build types
|
||||
shell: bash
|
||||
run: yarn build-types --skip-snapshot
|
||||
run: yarn build-types
|
||||
# Continue with publish steps
|
||||
- name: Set npm credentials
|
||||
if: ${{ inputs.release-type == 'release' ||
|
||||
|
||||
@@ -49,7 +49,7 @@ runs:
|
||||
run: yarn run lint-markdown
|
||||
- name: Build types
|
||||
shell: bash
|
||||
run: yarn build-types --skip-snapshot
|
||||
run: yarn build-types
|
||||
- name: Run typescript check of generated types
|
||||
shell: bash
|
||||
run: yarn test-generated-typescript
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
- name: Build packages
|
||||
run: yarn build
|
||||
- name: Build types
|
||||
run: yarn build-types --skip-snapshot
|
||||
run: yarn build-types
|
||||
- name: Set NPM auth token
|
||||
run: echo "//registry.npmjs.org/:_authToken=$GHA_NPM_TOKEN" > ~/.npmrc
|
||||
- name: Find and publish all bumped packages
|
||||
|
||||
+7
-7
@@ -32,7 +32,7 @@
|
||||
"test-typescript": "tsc -p packages/react-native/types/tsconfig.json",
|
||||
"test-generated-typescript": "tsc -p packages/react-native/types_generated/tsconfig.test.json",
|
||||
"test": "jest",
|
||||
"fantom": "./scripts/fantom.sh",
|
||||
"fantom": "JS_DIR='..' yarn jest --config private/react-native-fantom/config/jest.config.js",
|
||||
"trigger-react-native-release": "node ./scripts/releases-local/trigger-react-native-release.js",
|
||||
"update-lock": "npx yarn-deduplicate"
|
||||
},
|
||||
@@ -58,7 +58,7 @@
|
||||
"@typescript-eslint/parser": "^7.1.1",
|
||||
"ansi-styles": "^4.2.1",
|
||||
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.1",
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.0",
|
||||
"babel-plugin-transform-define": "^2.1.4",
|
||||
"babel-plugin-transform-flow-enums": "^0.0.2",
|
||||
"clang-format": "^1.8.0",
|
||||
@@ -76,11 +76,11 @@
|
||||
"eslint-plugin-react-native": "^4.0.0",
|
||||
"eslint-plugin-redundant-undefined": "^0.4.0",
|
||||
"eslint-plugin-relay": "^1.8.3",
|
||||
"flow-api-translator": "0.29.1",
|
||||
"flow-bin": "^0.274.2",
|
||||
"flow-api-translator": "0.29.0",
|
||||
"flow-bin": "^0.274.0",
|
||||
"glob": "^7.1.1",
|
||||
"hermes-eslint": "0.29.1",
|
||||
"hermes-transform": "0.29.1",
|
||||
"hermes-eslint": "0.29.0",
|
||||
"hermes-transform": "0.29.0",
|
||||
"inquirer": "^7.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-config": "^29.7.0",
|
||||
@@ -96,7 +96,7 @@
|
||||
"node-fetch": "^2.2.0",
|
||||
"nullthrows": "^1.1.1",
|
||||
"prettier": "2.8.8",
|
||||
"prettier-plugin-hermes-parser": "0.29.1",
|
||||
"prettier-plugin-hermes-parser": "0.29.0",
|
||||
"react": "19.1.0",
|
||||
"react-test-renderer": "19.1.0",
|
||||
"rimraf": "^3.0.2",
|
||||
|
||||
@@ -125,7 +125,7 @@ export const tasks = {
|
||||
}),
|
||||
),
|
||||
installDependencies: task(FIFTH, 'Install CocoaPods dependencies', () => {
|
||||
const env: {[string]: string | void} = {
|
||||
const env = {
|
||||
RCT_NEW_ARCH_ENABLED: options.newArchitecture ? '1' : '0',
|
||||
USE_FRAMEWORKS: options.frameworks,
|
||||
USE_HERMES: options.hermes ? '1' : '0',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@generated SignedSource<<634e06e29a06ec6a22c087e7f8b01796>>
|
||||
Git revision: 35c4630bd58bbcbc6f4c54c084b4e52994dc4940
|
||||
@generated SignedSource<<cf5be4596d1f07e220b710fc286d02fa>>
|
||||
Git revision: d95ac13bf0ab64a5e6c2eb18eb138587063b9c34
|
||||
Built with --nohooks: false
|
||||
Is local checkout: false
|
||||
Remote URL: https://github.com/facebook/react-native-devtools-frontend
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -27,11 +27,11 @@
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 22.14.0",
|
||||
"electron": ">=36.3.0"
|
||||
"electron": ">=36.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.6",
|
||||
"electron": "36.3.0"
|
||||
"electron": "36.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"semver": "^7.1.3"
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import type {JsonPagesListResponse} from '../inspector-proxy/types';
|
||||
import type {BrowserLauncher} from '../types/BrowserLauncher';
|
||||
|
||||
import DefaultBrowserLauncher from '../utils/DefaultBrowserLauncher';
|
||||
import {fetchJson, requestLocal} from './FetchUtils';
|
||||
@@ -23,7 +22,7 @@ const PAGES_POLLING_DELAY = 2100;
|
||||
jest.useFakeTimers();
|
||||
|
||||
describe('enableStandaloneFuseboxShell experiment', () => {
|
||||
const BrowserLauncherWithFuseboxShell: BrowserLauncher = {
|
||||
const BrowserLauncherWithFuseboxShell = {
|
||||
...DefaultBrowserLauncher,
|
||||
unstable_showFuseboxShell: () => {
|
||||
throw new Error('Not implemented');
|
||||
|
||||
@@ -22,7 +22,6 @@ import type {
|
||||
import type {IncomingMessage, ServerResponse} from 'http';
|
||||
|
||||
import getBaseUrlFromRequest from '../utils/getBaseUrlFromRequest';
|
||||
import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl';
|
||||
import Device from './Device';
|
||||
import EventLoopPerfTracker from './EventLoopPerfTracker';
|
||||
import InspectorProxyHeartbeat from './InspectorProxyHeartbeat';
|
||||
@@ -250,15 +249,13 @@ export default class InspectorProxy implements InspectorProxyQueries {
|
||||
|
||||
const webSocketUrlWithoutProtocol = `${host}${WS_DEBUGGER_URL}?device=${deviceId}&page=${page.id}`;
|
||||
const webSocketDebuggerUrl = `${webSocketScheme}://${webSocketUrlWithoutProtocol}`;
|
||||
const devtoolsFrontendUrl = getDevToolsFrontendUrl(
|
||||
this.#experiments,
|
||||
webSocketDebuggerUrl,
|
||||
this.#serverBaseUrl.origin,
|
||||
{
|
||||
relative: true,
|
||||
useFuseboxEntryPoint: page.capabilities.prefersFuseboxFrontend,
|
||||
},
|
||||
);
|
||||
|
||||
// For now, `/json/list` returns the legacy built-in `devtools://` URL, to
|
||||
// preserve existing handling by Flipper. This may return a placeholder in
|
||||
// future -- please use the `/open-debugger` endpoint.
|
||||
const devtoolsFrontendUrl =
|
||||
`devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&${webSocketScheme}=` +
|
||||
encodeURIComponent(webSocketUrlWithoutProtocol);
|
||||
|
||||
return {
|
||||
id: `${deviceId}-${page.id}`,
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.1",
|
||||
"hermes-eslint": "0.29.1"
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.0",
|
||||
"hermes-eslint": "0.29.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 22.14.0"
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
"source-map-support": "0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.1",
|
||||
"hermes-eslint": "0.29.1"
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.0",
|
||||
"hermes-eslint": "0.29.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 22.14.0"
|
||||
|
||||
-5
@@ -70,7 +70,6 @@ abstract class GenerateEntryPointTask : DefaultTask() {
|
||||
|
||||
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
import com.facebook.react.views.view.WindowUtilKt;
|
||||
import com.facebook.react.soloader.OpenSourceMergedSoMapping;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
@@ -94,10 +93,6 @@ abstract class GenerateEntryPointTask : DefaultTask() {
|
||||
if ({{packageName}}.BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
||||
DefaultNewArchitectureEntryPoint.load();
|
||||
}
|
||||
|
||||
if ({{packageName}}.BuildConfig.IS_EDGE_TO_EDGE_ENABLED) {
|
||||
WindowUtilKt.setEdgeToEdgeFeatureFlagOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
-3
@@ -11,7 +11,6 @@ import com.android.build.api.variant.ApplicationAndroidComponentsExtension
|
||||
import com.android.build.api.variant.LibraryAndroidComponentsExtension
|
||||
import com.android.build.gradle.LibraryExtension
|
||||
import com.facebook.react.ReactExtension
|
||||
import com.facebook.react.utils.ProjectUtils.isEdgeToEdgeEnabled
|
||||
import com.facebook.react.utils.ProjectUtils.isHermesEnabled
|
||||
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled
|
||||
import java.io.File
|
||||
@@ -40,8 +39,6 @@ internal object AgpConfiguratorUtils {
|
||||
project.isNewArchEnabled(extension).toString())
|
||||
ext.defaultConfig.buildConfigField(
|
||||
"boolean", "IS_HERMES_ENABLED", project.isHermesEnabled.toString())
|
||||
ext.defaultConfig.buildConfigField(
|
||||
"boolean", "IS_EDGE_TO_EDGE_ENABLED", project.isEdgeToEdgeEnabled.toString())
|
||||
}
|
||||
}
|
||||
project.pluginManager.withPlugin("com.android.application", action)
|
||||
|
||||
-9
@@ -11,11 +11,9 @@ import com.facebook.react.ReactExtension
|
||||
import com.facebook.react.model.ModelPackageJson
|
||||
import com.facebook.react.utils.KotlinStdlibCompatUtils.lowercaseCompat
|
||||
import com.facebook.react.utils.KotlinStdlibCompatUtils.toBooleanStrictOrNullCompat
|
||||
import com.facebook.react.utils.PropertyUtils.EDGE_TO_EDGE_ENABLED
|
||||
import com.facebook.react.utils.PropertyUtils.HERMES_ENABLED
|
||||
import com.facebook.react.utils.PropertyUtils.NEW_ARCH_ENABLED
|
||||
import com.facebook.react.utils.PropertyUtils.REACT_NATIVE_ARCHITECTURES
|
||||
import com.facebook.react.utils.PropertyUtils.SCOPED_EDGE_TO_EDGE_ENABLED
|
||||
import com.facebook.react.utils.PropertyUtils.SCOPED_HERMES_ENABLED
|
||||
import com.facebook.react.utils.PropertyUtils.SCOPED_NEW_ARCH_ENABLED
|
||||
import com.facebook.react.utils.PropertyUtils.SCOPED_REACT_NATIVE_ARCHITECTURES
|
||||
@@ -61,13 +59,6 @@ internal object ProjectUtils {
|
||||
HERMES_FALLBACK
|
||||
}
|
||||
|
||||
internal val Project.isEdgeToEdgeEnabled: Boolean
|
||||
get() =
|
||||
(project.hasProperty(EDGE_TO_EDGE_ENABLED) &&
|
||||
project.property(EDGE_TO_EDGE_ENABLED).toString().toBoolean()) ||
|
||||
(project.hasProperty(SCOPED_EDGE_TO_EDGE_ENABLED) &&
|
||||
project.property(SCOPED_EDGE_TO_EDGE_ENABLED).toString().toBoolean())
|
||||
|
||||
internal val Project.useThirdPartyJSC: Boolean
|
||||
get() =
|
||||
(project.hasProperty(USE_THIRD_PARTY_JSC) &&
|
||||
|
||||
+1
-5
@@ -14,14 +14,10 @@ object PropertyUtils {
|
||||
const val NEW_ARCH_ENABLED = "newArchEnabled"
|
||||
const val SCOPED_NEW_ARCH_ENABLED = "react.newArchEnabled"
|
||||
|
||||
/** Public property that toggles Hermes */
|
||||
/** Public property that toggles the New Architecture */
|
||||
const val HERMES_ENABLED = "hermesEnabled"
|
||||
const val SCOPED_HERMES_ENABLED = "react.hermesEnabled"
|
||||
|
||||
/** Public property that toggles edge-to-edge */
|
||||
const val EDGE_TO_EDGE_ENABLED = "edgeToEdgeEnabled"
|
||||
const val SCOPED_EDGE_TO_EDGE_ENABLED = "react.edgeToEdgeEnabled"
|
||||
|
||||
/** Public property that excludes jsctooling from core */
|
||||
const val USE_THIRD_PARTY_JSC = "useThirdPartyJSC"
|
||||
const val SCOPED_USE_THIRD_PARTY_JSC = "react.useThirdPartyJSC"
|
||||
|
||||
-5
@@ -55,7 +55,6 @@ class GenerateEntryPointTaskTest {
|
||||
|
||||
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
import com.facebook.react.views.view.WindowUtilKt;
|
||||
import com.facebook.react.soloader.OpenSourceMergedSoMapping;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
@@ -79,10 +78,6 @@ class GenerateEntryPointTaskTest {
|
||||
if (com.facebook.react.BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
||||
DefaultNewArchitectureEntryPoint.load();
|
||||
}
|
||||
|
||||
if (com.facebook.react.BuildConfig.IS_EDGE_TO_EDGE_ENABLED) {
|
||||
WindowUtilKt.setEdgeToEdgeFeatureFlagOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
+1
-28
@@ -12,7 +12,6 @@ import com.facebook.react.model.ModelCodegenConfig
|
||||
import com.facebook.react.model.ModelPackageJson
|
||||
import com.facebook.react.tests.createProject
|
||||
import com.facebook.react.utils.ProjectUtils.getReactNativeArchitectures
|
||||
import com.facebook.react.utils.ProjectUtils.isEdgeToEdgeEnabled
|
||||
import com.facebook.react.utils.ProjectUtils.isHermesEnabled
|
||||
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled
|
||||
import com.facebook.react.utils.ProjectUtils.needsCodegenFromPackageJson
|
||||
@@ -99,7 +98,7 @@ class ProjectUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isHermesEnabled_withDisabledViaProperty_returnsFalse() {
|
||||
fun isNewArchEnabled_withDisabledViaProperty_returnsFalse() {
|
||||
val project = createProject()
|
||||
project.extensions.extraProperties.set("hermesEnabled", "false")
|
||||
assertThat(project.isHermesEnabled).isFalse()
|
||||
@@ -151,32 +150,6 @@ class ProjectUtilsTest {
|
||||
assertThat(project.isHermesEnabled).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isEdgeToEdgeEnabled_returnsFalseByDefault() {
|
||||
assertThat(createProject().isEdgeToEdgeEnabled).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isEdgeToEdgeEnabled_withDisabledViaProperty_returnsFalse() {
|
||||
val project = createProject()
|
||||
project.extensions.extraProperties.set("edgeToEdgeEnabled", "false")
|
||||
assertThat(project.isEdgeToEdgeEnabled).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isEdgeToEdgeEnabled_withEnabledViaProperty_returnsTrue() {
|
||||
val project = createProject()
|
||||
project.extensions.extraProperties.set("edgeToEdgeEnabled", "true")
|
||||
assertThat(project.isEdgeToEdgeEnabled).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isEdgeToEdgeEnabled_withInvalidViaProperty_returnsFalse() {
|
||||
val project = createProject()
|
||||
project.extensions.extraProperties.set("edgeToEdgeEnabled", "¯\\_(ツ)_/¯")
|
||||
assertThat(project.isEdgeToEdgeEnabled).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun needsCodegenFromPackageJson_withCodegenConfigInPackageJson_returnsTrue() {
|
||||
val project = createProject()
|
||||
|
||||
@@ -43,7 +43,7 @@ const INTERNAL_CALLSITES_REGEX = new RegExp(
|
||||
|
||||
export {mergeConfig} from 'metro-config';
|
||||
|
||||
let frameworkDefaults: InputConfigT = {};
|
||||
let frameworkDefaults = {};
|
||||
export function setFrameworkDefaults(config: InputConfigT) {
|
||||
frameworkDefaults = config;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
const LOG_LEVELS = {
|
||||
trace: 0,
|
||||
info: 1,
|
||||
warn: 2,
|
||||
error: 3,
|
||||
};
|
||||
|
||||
describe('console', () => {
|
||||
describe('.table(data, rows)', () => {
|
||||
let originalNativeLoggingHook;
|
||||
let logFn;
|
||||
|
||||
beforeEach(() => {
|
||||
originalNativeLoggingHook = global.nativeLoggingHook;
|
||||
logFn = global.nativeLoggingHook = jest.fn();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
global.nativeLoggingHook = originalNativeLoggingHook;
|
||||
});
|
||||
|
||||
it('should print the passed array as a Markdown table', () => {
|
||||
console.table([
|
||||
{name: 'First', value: 500},
|
||||
{name: 'Second', value: 600},
|
||||
{name: 'Third', value: 700},
|
||||
{name: 'Fourth', value: 800, extraValue: true},
|
||||
]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | name | value | extraValue |
|
||||
| ------- | -------- | ----- | ---------- |
|
||||
| 0 | 'First' | 500 | |
|
||||
| 1 | 'Second' | 600 | |
|
||||
| 2 | 'Third' | 700 | |
|
||||
| 3 | 'Fourth' | 800 | true |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should print the passed dictionary as a Markdown table', () => {
|
||||
console.table({
|
||||
first: {name: 'First', value: 500},
|
||||
second: {name: 'Second', value: 600},
|
||||
third: {name: 'Third', value: 700},
|
||||
fourth: {name: 'Fourth', value: 800, extraValue: true},
|
||||
});
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | name | value | extraValue |
|
||||
| ------- | -------- | ----- | ---------- |
|
||||
| first | 'First' | 500 | |
|
||||
| second | 'Second' | 600 | |
|
||||
| third | 'Third' | 700 | |
|
||||
| fourth | 'Fourth' | 800 | true |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should work with different types of values', () => {
|
||||
console.table([
|
||||
{
|
||||
string: '',
|
||||
number: 0,
|
||||
boolean: true,
|
||||
function: () => {},
|
||||
object: {a: 1, b: 2},
|
||||
null: null,
|
||||
undefined: undefined,
|
||||
},
|
||||
{
|
||||
string: 'a',
|
||||
number: 1,
|
||||
boolean: true,
|
||||
function: () => {},
|
||||
object: {a: 1, b: 2},
|
||||
null: null,
|
||||
undefined: undefined,
|
||||
},
|
||||
{
|
||||
string: 'aa',
|
||||
number: 2,
|
||||
boolean: false,
|
||||
function: () => {},
|
||||
object: {a: 1, b: 2},
|
||||
null: null,
|
||||
undefined: undefined,
|
||||
},
|
||||
{
|
||||
string: 'aaa',
|
||||
number: 3,
|
||||
boolean: false,
|
||||
function: () => {},
|
||||
object: {a: 1, b: 2},
|
||||
null: null,
|
||||
undefined: undefined,
|
||||
},
|
||||
]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | string | number | boolean | function | object | null | undefined |
|
||||
| ------- | ------ | ------ | ------- | -------- | ------ | ---- | --------- |
|
||||
| 0 | '' | 0 | true | ƒ | {…} | null | undefined |
|
||||
| 1 | 'a' | 1 | true | ƒ | {…} | null | undefined |
|
||||
| 2 | 'aa' | 2 | false | ƒ | {…} | null | undefined |
|
||||
| 3 | 'aaa' | 3 | false | ƒ | {…} | null | undefined |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should print the keys in all the objects', () => {
|
||||
console.table([
|
||||
{name: 'foo'},
|
||||
{name: 'bar', value: 1},
|
||||
{value: 2, surname: 'baz'},
|
||||
{address: 'other'},
|
||||
]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | name | value | surname | address |
|
||||
| ------- | ----- | ----- | ------- | ------- |
|
||||
| 0 | 'foo' | | | |
|
||||
| 1 | 'bar' | 1 | | |
|
||||
| 2 | | 2 | 'baz' | |
|
||||
| 3 | | | | 'other' |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should print an empty string for empty arrays', () => {
|
||||
console.table([]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([``, LOG_LEVELS.info]);
|
||||
});
|
||||
|
||||
it('should print an empty string for empty dictionaries', () => {
|
||||
console.table({});
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([``, LOG_LEVELS.info]);
|
||||
});
|
||||
|
||||
// This test is currently failing
|
||||
it('should print an indices table for an array of empty objects', () => {
|
||||
console.table([{}, {}, {}, {}]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) |
|
||||
| ------- |
|
||||
| 0 |
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 3 |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should print an indices table for a dictionary of empty objects', () => {
|
||||
console.table({
|
||||
first: {},
|
||||
second: {},
|
||||
third: {},
|
||||
fourth: {},
|
||||
});
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) |
|
||||
| ------- |
|
||||
| first |
|
||||
| second |
|
||||
| third |
|
||||
| fourth |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should not modify the logged value', () => {
|
||||
global.nativeLoggingHook = jest.fn();
|
||||
|
||||
const array = [
|
||||
{name: 'First', value: 500},
|
||||
{name: 'Second', value: 600},
|
||||
{name: 'Third', value: 700},
|
||||
{name: 'Fourth', value: 800, extraValue: true},
|
||||
];
|
||||
const originalArrayValue = JSON.parse(JSON.stringify(array));
|
||||
|
||||
console.table(array);
|
||||
|
||||
expect(array).toEqual(originalArrayValue);
|
||||
|
||||
const object = {
|
||||
first: {name: 'First', value: 500},
|
||||
second: {name: 'Second', value: 600},
|
||||
third: {name: 'Third', value: 700},
|
||||
fourth: {name: 'Fourth', value: 800, extraValue: true},
|
||||
};
|
||||
|
||||
const originalObjectValue = JSON.parse(JSON.stringify(object));
|
||||
|
||||
console.table(object);
|
||||
|
||||
expect(object).toEqual(originalObjectValue);
|
||||
});
|
||||
|
||||
it('should only print the selected columns, if specified (arrays)', () => {
|
||||
console.table(
|
||||
[
|
||||
{first: 1, second: 2, third: 3},
|
||||
{first: 4, second: 5},
|
||||
{third: 7, fourth: 8},
|
||||
{fifth: 9},
|
||||
],
|
||||
// $FlowExpectedError[extra-arg]
|
||||
['first', 'fifth'],
|
||||
);
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | first | fifth |
|
||||
| ------- | ----- | ----- |
|
||||
| 0 | 1 | |
|
||||
| 1 | 4 | |
|
||||
| 2 | | |
|
||||
| 3 | | 9 |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should only print the selected columns, if specified (dictionaries)', () => {
|
||||
console.table(
|
||||
{
|
||||
a: {first: 1, second: 2, third: 3},
|
||||
b: {first: 4, second: 5},
|
||||
c: {third: 7, fourth: 8},
|
||||
d: {fifth: 9},
|
||||
},
|
||||
// $FlowExpectedError[extra-arg]
|
||||
['first', 'fifth'],
|
||||
);
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | first | fifth |
|
||||
| ------- | ----- | ----- |
|
||||
| a | 1 | |
|
||||
| b | 4 | |
|
||||
| c | | |
|
||||
| d | | 9 |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,275 +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
|
||||
*/
|
||||
|
||||
const LOG_LEVELS = {
|
||||
trace: 0,
|
||||
info: 1,
|
||||
warn: 2,
|
||||
error: 3,
|
||||
};
|
||||
|
||||
describe('console.table(data, rows)', () => {
|
||||
let originalNativeLoggingHook;
|
||||
let logFn;
|
||||
|
||||
beforeEach(() => {
|
||||
originalNativeLoggingHook = global.nativeLoggingHook;
|
||||
logFn = global.nativeLoggingHook = jest.fn();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
global.nativeLoggingHook = originalNativeLoggingHook;
|
||||
});
|
||||
|
||||
it('should print the passed array as a Markdown table', () => {
|
||||
console.table([
|
||||
{name: 'First', value: 500},
|
||||
{name: 'Second', value: 600},
|
||||
{name: 'Third', value: 700},
|
||||
{name: 'Fourth', value: 800, extraValue: true},
|
||||
]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | name | value | extraValue |
|
||||
| ------- | -------- | ----- | ---------- |
|
||||
| 0 | 'First' | 500 | |
|
||||
| 1 | 'Second' | 600 | |
|
||||
| 2 | 'Third' | 700 | |
|
||||
| 3 | 'Fourth' | 800 | true |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should print the passed dictionary as a Markdown table', () => {
|
||||
console.table({
|
||||
first: {name: 'First', value: 500},
|
||||
second: {name: 'Second', value: 600},
|
||||
third: {name: 'Third', value: 700},
|
||||
fourth: {name: 'Fourth', value: 800, extraValue: true},
|
||||
});
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | name | value | extraValue |
|
||||
| ------- | -------- | ----- | ---------- |
|
||||
| first | 'First' | 500 | |
|
||||
| second | 'Second' | 600 | |
|
||||
| third | 'Third' | 700 | |
|
||||
| fourth | 'Fourth' | 800 | true |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should work with different types of values', () => {
|
||||
console.table([
|
||||
{
|
||||
string: '',
|
||||
number: 0,
|
||||
boolean: true,
|
||||
function: () => {},
|
||||
object: {a: 1, b: 2},
|
||||
null: null,
|
||||
undefined: undefined,
|
||||
},
|
||||
{
|
||||
string: 'a',
|
||||
number: 1,
|
||||
boolean: true,
|
||||
function: () => {},
|
||||
object: {a: 1, b: 2},
|
||||
null: null,
|
||||
undefined: undefined,
|
||||
},
|
||||
{
|
||||
string: 'aa',
|
||||
number: 2,
|
||||
boolean: false,
|
||||
function: () => {},
|
||||
object: {a: 1, b: 2},
|
||||
null: null,
|
||||
undefined: undefined,
|
||||
},
|
||||
{
|
||||
string: 'aaa',
|
||||
number: 3,
|
||||
boolean: false,
|
||||
function: () => {},
|
||||
object: {a: 1, b: 2},
|
||||
null: null,
|
||||
undefined: undefined,
|
||||
},
|
||||
]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | string | number | boolean | function | object | null | undefined |
|
||||
| ------- | ------ | ------ | ------- | -------- | ------ | ---- | --------- |
|
||||
| 0 | '' | 0 | true | ƒ | {…} | null | undefined |
|
||||
| 1 | 'a' | 1 | true | ƒ | {…} | null | undefined |
|
||||
| 2 | 'aa' | 2 | false | ƒ | {…} | null | undefined |
|
||||
| 3 | 'aaa' | 3 | false | ƒ | {…} | null | undefined |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should print the keys in all the objects', () => {
|
||||
console.table([
|
||||
{name: 'foo'},
|
||||
{name: 'bar', value: 1},
|
||||
{value: 2, surname: 'baz'},
|
||||
{address: 'other'},
|
||||
]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | name | value | surname | address |
|
||||
| ------- | ----- | ----- | ------- | ------- |
|
||||
| 0 | 'foo' | | | |
|
||||
| 1 | 'bar' | 1 | | |
|
||||
| 2 | | 2 | 'baz' | |
|
||||
| 3 | | | | 'other' |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should print an empty string for empty arrays', () => {
|
||||
console.table([]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([``, LOG_LEVELS.info]);
|
||||
});
|
||||
|
||||
it('should print an empty string for empty dictionaries', () => {
|
||||
console.table({});
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([``, LOG_LEVELS.info]);
|
||||
});
|
||||
|
||||
// This test is currently failing
|
||||
it('should print an indices table for an array of empty objects', () => {
|
||||
console.table([{}, {}, {}, {}]);
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) |
|
||||
| ------- |
|
||||
| 0 |
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 3 |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should print an indices table for a dictionary of empty objects', () => {
|
||||
console.table({
|
||||
first: {},
|
||||
second: {},
|
||||
third: {},
|
||||
fourth: {},
|
||||
});
|
||||
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) |
|
||||
| ------- |
|
||||
| first |
|
||||
| second |
|
||||
| third |
|
||||
| fourth |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should not modify the logged value', () => {
|
||||
global.nativeLoggingHook = jest.fn();
|
||||
|
||||
const array = [
|
||||
{name: 'First', value: 500},
|
||||
{name: 'Second', value: 600},
|
||||
{name: 'Third', value: 700},
|
||||
{name: 'Fourth', value: 800, extraValue: true},
|
||||
];
|
||||
const originalArrayValue = JSON.parse(JSON.stringify(array));
|
||||
|
||||
console.table(array);
|
||||
|
||||
expect(array).toEqual(originalArrayValue);
|
||||
|
||||
const object = {
|
||||
first: {name: 'First', value: 500},
|
||||
second: {name: 'Second', value: 600},
|
||||
third: {name: 'Third', value: 700},
|
||||
fourth: {name: 'Fourth', value: 800, extraValue: true},
|
||||
};
|
||||
|
||||
const originalObjectValue = JSON.parse(JSON.stringify(object));
|
||||
|
||||
console.table(object);
|
||||
|
||||
expect(object).toEqual(originalObjectValue);
|
||||
});
|
||||
|
||||
it('should only print the selected columns, if specified (arrays)', () => {
|
||||
console.table(
|
||||
[
|
||||
{first: 1, second: 2, third: 3},
|
||||
{first: 4, second: 5},
|
||||
{third: 7, fourth: 8},
|
||||
{fifth: 9},
|
||||
],
|
||||
// $FlowExpectedError[extra-arg]
|
||||
['first', 'fifth'],
|
||||
);
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | first | fifth |
|
||||
| ------- | ----- | ----- |
|
||||
| 0 | 1 | |
|
||||
| 1 | 4 | |
|
||||
| 2 | | |
|
||||
| 3 | | 9 |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should only print the selected columns, if specified (dictionaries)', () => {
|
||||
console.table(
|
||||
{
|
||||
a: {first: 1, second: 2, third: 3},
|
||||
b: {first: 4, second: 5},
|
||||
c: {third: 7, fourth: 8},
|
||||
d: {fifth: 9},
|
||||
},
|
||||
// $FlowExpectedError[extra-arg]
|
||||
['first', 'fifth'],
|
||||
);
|
||||
expect(logFn).toHaveBeenCalledTimes(1);
|
||||
expect(logFn.mock.lastCall).toEqual([
|
||||
`
|
||||
| (index) | first | fifth |
|
||||
| ------- | ----- | ----- |
|
||||
| a | 1 | |
|
||||
| b | 4 | |
|
||||
| c | | |
|
||||
| d | | 9 |`,
|
||||
LOG_LEVELS.info,
|
||||
]);
|
||||
});
|
||||
});
|
||||
@@ -1,41 +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
|
||||
* @fantom_mode *
|
||||
* @fantom_flags fuseboxEnabledRelease:*
|
||||
*/
|
||||
|
||||
describe('console.timeStamp()', () => {
|
||||
it('installed', () => {
|
||||
expect(typeof console.timeStamp).toBe('function');
|
||||
});
|
||||
|
||||
it("doesn't throw when label is not specified", () => {
|
||||
expect(() => console.timeStamp()).not.toThrow();
|
||||
});
|
||||
|
||||
it("doesn't throw when label is specified", () => {
|
||||
expect(() => console.timeStamp('label')).not.toThrow();
|
||||
});
|
||||
|
||||
it("doesn't throw when additional arguments are specified", () => {
|
||||
expect(() =>
|
||||
// $FlowExpectedError[extra-arg]
|
||||
console.timeStamp('label', 100, 500, 'Track', 'Group', 'error'),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it("doesn't throw when invalid arguments are specified", () => {
|
||||
// $FlowExpectedError[incompatible-call]
|
||||
expect(() => console.timeStamp({})).not.toThrow();
|
||||
expect(() =>
|
||||
// $FlowExpectedError[extra-arg]
|
||||
console.timeStamp('label', true, null, {}, [], () => {}),
|
||||
).not.toThrow();
|
||||
});
|
||||
});
|
||||
@@ -569,11 +569,6 @@ function consoleAssertPolyfill(expression, label) {
|
||||
}
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/console/timeStamp_static.
|
||||
// Non-standard API for recording markers on a timeline of the Performance instrumentation.
|
||||
// The actual logging is not provided by definition.
|
||||
function consoleTimeStampPolyfill() {}
|
||||
|
||||
if (global.nativeLoggingHook) {
|
||||
const originalConsole = global.console;
|
||||
// Preserve the original `console` as `originalConsole`
|
||||
@@ -597,7 +592,6 @@ if (global.nativeLoggingHook) {
|
||||
groupEnd: consoleGroupEndPolyfill,
|
||||
groupCollapsed: consoleGroupCollapsedPolyfill,
|
||||
assert: consoleAssertPolyfill,
|
||||
timeStamp: consoleTimeStampPolyfill,
|
||||
};
|
||||
|
||||
// TODO(T206796580): This was copy-pasted from ExceptionsManager.js
|
||||
@@ -700,7 +694,6 @@ if (global.nativeLoggingHook) {
|
||||
profile: stub,
|
||||
profileEnd: stub,
|
||||
table: stub,
|
||||
timeStamp: stub,
|
||||
};
|
||||
|
||||
Object.defineProperty(console, '_isPolyfilled', {
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
"@babel/plugin-transform-unicode-regex": "^7.24.7",
|
||||
"@babel/template": "^7.25.0",
|
||||
"@react-native/babel-plugin-codegen": "0.80.0-main",
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.1",
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.0",
|
||||
"babel-plugin-transform-flow-enums": "^0.0.2",
|
||||
"react-refresh": "^0.14.0"
|
||||
},
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@react-native/babel-preset": "0.80.0-main",
|
||||
"hermes-parser": "0.29.1",
|
||||
"hermes-parser": "0.29.0",
|
||||
"nullthrows": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
+10
-136
@@ -40,10 +40,6 @@ ArrayPropsNativeComponentViewProps::ArrayPropsNativeComponentViewProps(
|
||||
arrayOfMixed(convertRawProp(context, rawProps, \\"arrayOfMixed\\", sourceProps.arrayOfMixed, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ArrayPropsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ArrayPropsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic ArrayPropsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ArrayPropsNativeComponentViewProps();
|
||||
@@ -55,57 +51,18 @@ folly::dynamic ArrayPropsNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (names != oldProps->names) {
|
||||
result[\\"names\\"] = toDynamic(names);
|
||||
}
|
||||
|
||||
if (disableds != oldProps->disableds) {
|
||||
result[\\"disableds\\"] = toDynamic(disableds);
|
||||
}
|
||||
|
||||
if (progress != oldProps->progress) {
|
||||
result[\\"progress\\"] = toDynamic(progress);
|
||||
}
|
||||
|
||||
if (radii != oldProps->radii) {
|
||||
result[\\"radii\\"] = toDynamic(radii);
|
||||
}
|
||||
|
||||
if (colors != oldProps->colors) {
|
||||
result[\\"colors\\"] = toDynamic(colors);
|
||||
}
|
||||
|
||||
if (srcs != oldProps->srcs) {
|
||||
result[\\"srcs\\"] = toDynamic(srcs);
|
||||
}
|
||||
|
||||
if (points != oldProps->points) {
|
||||
result[\\"points\\"] = toDynamic(points);
|
||||
}
|
||||
|
||||
if (edgeInsets != oldProps->edgeInsets) {
|
||||
result[\\"edgeInsets\\"] = toDynamic(edgeInsets);
|
||||
}
|
||||
|
||||
if (dimensions != oldProps->dimensions) {
|
||||
result[\\"dimensions\\"] = toDynamic(dimensions);
|
||||
}
|
||||
|
||||
if (sizes != oldProps->sizes) {
|
||||
result[\\"sizes\\"] = toDynamic(sizes);
|
||||
}
|
||||
|
||||
if (object != oldProps->object) {
|
||||
result[\\"object\\"] = toDynamic(object);
|
||||
}
|
||||
|
||||
if (arrayOfObjects != oldProps->arrayOfObjects) {
|
||||
result[\\"arrayOfObjects\\"] = toDynamic(arrayOfObjects);
|
||||
}
|
||||
|
||||
if (arrayOfMixed != oldProps->arrayOfMixed) {
|
||||
result[\\"arrayOfMixed\\"] = toDynamic(arrayOfMixed);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -142,10 +99,6 @@ BooleanPropNativeComponentViewProps::BooleanPropNativeComponentViewProps(
|
||||
disabledNullable(convertRawProp(context, rawProps, \\"disabledNullable\\", sourceProps.disabledNullable, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName BooleanPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"BooleanPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic BooleanPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = BooleanPropNativeComponentViewProps();
|
||||
@@ -199,10 +152,6 @@ ColorPropNativeComponentViewProps::ColorPropNativeComponentViewProps(
|
||||
tintColor(convertRawProp(context, rawProps, \\"tintColor\\", sourceProps.tintColor, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ColorPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ColorPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic ColorPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ColorPropNativeComponentViewProps();
|
||||
@@ -253,10 +202,6 @@ DimensionPropNativeComponentViewProps::DimensionPropNativeComponentViewProps(
|
||||
marginBack(convertRawProp(context, rawProps, \\"marginBack\\", sourceProps.marginBack, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName DimensionPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"DimensionPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic DimensionPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = DimensionPropNativeComponentViewProps();
|
||||
@@ -268,9 +213,6 @@ folly::dynamic DimensionPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (marginBack != oldProps->marginBack) {
|
||||
result[\\"marginBack\\"] = toDynamic(marginBack);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -306,10 +248,6 @@ EdgeInsetsPropNativeComponentViewProps::EdgeInsetsPropNativeComponentViewProps(
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EdgeInsetsPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EdgeInsetsPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic EdgeInsetsPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EdgeInsetsPropNativeComponentViewProps();
|
||||
@@ -357,10 +295,6 @@ EnumPropNativeComponentViewProps::EnumPropNativeComponentViewProps(
|
||||
intervals(convertRawProp(context, rawProps, \\"intervals\\", sourceProps.intervals, {EnumPropNativeComponentViewIntervals::Intervals0})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EnumPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EnumPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic EnumPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EnumPropNativeComponentViewProps();
|
||||
@@ -372,13 +306,7 @@ folly::dynamic EnumPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (alignment != oldProps->alignment) {
|
||||
result[\\"alignment\\"] = toDynamic(alignment);
|
||||
}
|
||||
|
||||
if (intervals != oldProps->intervals) {
|
||||
result[\\"intervals\\"] = toDynamic(intervals);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -414,10 +342,6 @@ EventNestedObjectPropsNativeComponentViewProps::EventNestedObjectPropsNativeComp
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EventNestedObjectPropsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EventNestedObjectPropsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic EventNestedObjectPropsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EventNestedObjectPropsNativeComponentViewProps();
|
||||
@@ -467,10 +391,6 @@ EventPropsNativeComponentViewProps::EventPropsNativeComponentViewProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EventPropsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EventPropsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic EventPropsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EventPropsNativeComponentViewProps();
|
||||
@@ -526,10 +446,6 @@ FloatPropsNativeComponentViewProps::FloatPropsNativeComponentViewProps(
|
||||
blurRadiusNullable(convertRawProp(context, rawProps, \\"blurRadiusNullable\\", sourceProps.blurRadiusNullable, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName FloatPropsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"FloatPropsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic FloatPropsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = FloatPropsNativeComponentViewProps();
|
||||
@@ -604,10 +520,6 @@ ImagePropNativeComponentViewProps::ImagePropNativeComponentViewProps(
|
||||
thumbImage(convertRawProp(context, rawProps, \\"thumbImage\\", sourceProps.thumbImage, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ImagePropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ImagePropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic ImagePropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ImagePropNativeComponentViewProps();
|
||||
@@ -620,7 +532,7 @@ folly::dynamic ImagePropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -659,10 +571,6 @@ IntegerPropNativeComponentViewProps::IntegerPropNativeComponentViewProps(
|
||||
progress3(convertRawProp(context, rawProps, \\"progress3\\", sourceProps.progress3, {10})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName IntegerPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"IntegerPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic IntegerPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = IntegerPropNativeComponentViewProps();
|
||||
@@ -720,10 +628,6 @@ InterfaceOnlyNativeComponentViewProps::InterfaceOnlyNativeComponentViewProps(
|
||||
title(convertRawProp(context, rawProps, \\"title\\", sourceProps.title, {\\"\\"})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName InterfaceOnlyNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"InterfaceOnlyNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic InterfaceOnlyNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = InterfaceOnlyNativeComponentViewProps();
|
||||
@@ -774,10 +678,6 @@ MixedPropNativeComponentViewProps::MixedPropNativeComponentViewProps(
|
||||
mixedProp(convertRawProp(context, rawProps, \\"mixedProp\\", sourceProps.mixedProp, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MixedPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MixedPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic MixedPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MixedPropNativeComponentViewProps();
|
||||
@@ -789,9 +689,6 @@ folly::dynamic MixedPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (mixedProp != oldProps->mixedProp) {
|
||||
result[\\"mixedProp\\"] = mixedProp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -831,10 +728,6 @@ MultiNativePropNativeComponentViewProps::MultiNativePropNativeComponentViewProps
|
||||
point(convertRawProp(context, rawProps, \\"point\\", sourceProps.point, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MultiNativePropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MultiNativePropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MultiNativePropNativeComponentViewProps();
|
||||
@@ -847,7 +740,7 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
}
|
||||
|
||||
if (color != oldProps->color) {
|
||||
@@ -859,7 +752,10 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
result[\\"point\\"] = toDynamic(point);
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -896,10 +792,6 @@ NoPropsNoEventsNativeComponentViewProps::NoPropsNoEventsNativeComponentViewProps
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName NoPropsNoEventsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"NoPropsNoEventsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic NoPropsNoEventsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = NoPropsNoEventsNativeComponentViewProps();
|
||||
@@ -949,10 +841,6 @@ ObjectPropsNativeComponentProps::ObjectPropsNativeComponentProps(
|
||||
objectPrimitiveRequiredProp(convertRawProp(context, rawProps, \\"objectPrimitiveRequiredProp\\", sourceProps.objectPrimitiveRequiredProp, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ObjectPropsNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ObjectPropsNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ObjectPropsNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ObjectPropsNativeComponentProps();
|
||||
@@ -964,17 +852,8 @@ folly::dynamic ObjectPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (objectProp != oldProps->objectProp) {
|
||||
result[\\"objectProp\\"] = toDynamic(objectProp);
|
||||
}
|
||||
|
||||
if (objectArrayProp != oldProps->objectArrayProp) {
|
||||
result[\\"objectArrayProp\\"] = toDynamic(objectArrayProp);
|
||||
}
|
||||
|
||||
if (objectPrimitiveRequiredProp != oldProps->objectPrimitiveRequiredProp) {
|
||||
result[\\"objectPrimitiveRequiredProp\\"] = toDynamic(objectPrimitiveRequiredProp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1010,10 +889,6 @@ PointPropNativeComponentViewProps::PointPropNativeComponentViewProps(
|
||||
startPoint(convertRawProp(context, rawProps, \\"startPoint\\", sourceProps.startPoint, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName PointPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"PointPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic PointPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = PointPropNativeComponentViewProps();
|
||||
@@ -1026,7 +901,10 @@ folly::dynamic PointPropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
result[\\"startPoint\\"] = toDynamic(startPoint);
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1064,10 +942,6 @@ StringPropNativeComponentViewProps::StringPropNativeComponentViewProps(
|
||||
defaultValue(convertRawProp(context, rawProps, \\"defaultValue\\", sourceProps.defaultValue, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName StringPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"StringPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic StringPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = StringPropNativeComponentViewProps();
|
||||
|
||||
-158
@@ -16,7 +16,6 @@ Object {
|
||||
#include <cinttypes>
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <react/renderer/core/graphicsConversions.h>
|
||||
#include <react/renderer/core/propsConversions.h>
|
||||
#include <react/renderer/graphics/Color.h>
|
||||
#include <react/renderer/graphics/Point.h>
|
||||
@@ -88,16 +87,6 @@ static inline std::string toString(const ArrayPropsNativeComponentViewSizesMaskW
|
||||
}
|
||||
struct ArrayPropsNativeComponentViewObjectStruct {
|
||||
std::string prop{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentViewObjectStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"prop\\"] = prop;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewObjectStruct &result) {
|
||||
@@ -113,12 +102,6 @@ static inline std::string toString(const ArrayPropsNativeComponentViewObjectStru
|
||||
return \\"[Object ArrayPropsNativeComponentViewObjectStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentViewObjectStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ArrayPropsNativeComponentViewObjectStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -132,17 +115,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
struct ArrayPropsNativeComponentViewArrayOfObjectsStruct {
|
||||
Float prop1{0.0};
|
||||
int prop2{0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentViewArrayOfObjectsStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"prop1\\"] = prop1;
|
||||
result[\\"prop2\\"] = prop2;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewArrayOfObjectsStruct &result) {
|
||||
@@ -162,12 +134,6 @@ static inline std::string toString(const ArrayPropsNativeComponentViewArrayOfObj
|
||||
return \\"[Object ArrayPropsNativeComponentViewArrayOfObjectsStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentViewArrayOfObjectsStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ArrayPropsNativeComponentViewArrayOfObjectsStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -199,8 +165,6 @@ class ArrayPropsNativeComponentViewProps final : public ViewProps {
|
||||
std::vector<folly::dynamic> arrayOfMixed{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -239,8 +203,6 @@ class BooleanPropNativeComponentViewProps final : public ViewProps {
|
||||
bool disabledNullable{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -279,8 +241,6 @@ class ColorPropNativeComponentViewProps final : public ViewProps {
|
||||
SharedColor tintColor{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -305,7 +265,6 @@ Object {
|
||||
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <react/renderer/core/graphicsConversions.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -320,8 +279,6 @@ class DimensionPropNativeComponentViewProps final : public ViewProps {
|
||||
YGValue marginBack{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -359,8 +316,6 @@ class EdgeInsetsPropNativeComponentViewProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -405,12 +360,6 @@ static inline std::string toString(const EnumPropNativeComponentViewAlignment &v
|
||||
case EnumPropNativeComponentViewAlignment::BottomRight: return \\"bottom-right\\";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const EnumPropNativeComponentViewAlignment &value) {
|
||||
return toString(value);
|
||||
}
|
||||
#endif
|
||||
enum class EnumPropNativeComponentViewIntervals { Intervals0 = 0, Intervals15 = 15, Intervals30 = 30, Intervals60 = 60 };
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnumPropNativeComponentViewIntervals &result) {
|
||||
@@ -442,17 +391,6 @@ static inline std::string toString(const EnumPropNativeComponentViewIntervals &v
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const EnumPropNativeComponentViewIntervals &value) {
|
||||
switch (value) {
|
||||
case EnumPropNativeComponentViewIntervals::Intervals0: return 0;
|
||||
case EnumPropNativeComponentViewIntervals::Intervals15: return 15;
|
||||
case EnumPropNativeComponentViewIntervals::Intervals30: return 30;
|
||||
case EnumPropNativeComponentViewIntervals::Intervals60: return 60;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
class EnumPropNativeComponentViewProps final : public ViewProps {
|
||||
public:
|
||||
EnumPropNativeComponentViewProps() = default;
|
||||
@@ -464,8 +402,6 @@ class EnumPropNativeComponentViewProps final : public ViewProps {
|
||||
EnumPropNativeComponentViewIntervals intervals{EnumPropNativeComponentViewIntervals::Intervals0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -503,8 +439,6 @@ class EventNestedObjectPropsNativeComponentViewProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -542,8 +476,6 @@ class EventPropsNativeComponentViewProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -587,8 +519,6 @@ class FloatPropsNativeComponentViewProps final : public ViewProps {
|
||||
Float blurRadiusNullable{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -627,8 +557,6 @@ class ImagePropNativeComponentViewProps final : public ViewProps {
|
||||
ImageSource thumbImage{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -668,8 +596,6 @@ class IntegerPropNativeComponentViewProps final : public ViewProps {
|
||||
int progress3{10};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -707,8 +633,6 @@ class InterfaceOnlyNativeComponentViewProps final : public ViewProps {
|
||||
std::string title{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -746,8 +670,6 @@ class MixedPropNativeComponentViewProps final : public ViewProps {
|
||||
folly::dynamic mixedProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -791,8 +713,6 @@ class MultiNativePropNativeComponentViewProps final : public ViewProps {
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -830,8 +750,6 @@ class NoPropsNoEventsNativeComponentViewProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -880,12 +798,6 @@ static inline std::string toString(const ObjectPropsNativeComponentStringEnumPro
|
||||
case ObjectPropsNativeComponentStringEnumProp::Large: return \\"large\\";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentStringEnumProp &value) {
|
||||
return toString(value);
|
||||
}
|
||||
#endif
|
||||
enum class ObjectPropsNativeComponentIntEnumProp { IntEnumProp0 = 0, IntEnumProp1 = 1 };
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentIntEnumProp &result) {
|
||||
@@ -908,15 +820,6 @@ static inline std::string toString(const ObjectPropsNativeComponentIntEnumProp &
|
||||
case ObjectPropsNativeComponentIntEnumProp::IntEnumProp1: return \\"1\\";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentIntEnumProp &value) {
|
||||
switch (value) {
|
||||
case ObjectPropsNativeComponentIntEnumProp::IntEnumProp0: return 0;
|
||||
case ObjectPropsNativeComponentIntEnumProp::IntEnumProp1: return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
struct ObjectPropsNativeComponentObjectPropStruct {
|
||||
std::string stringProp{\\"\\"};
|
||||
bool booleanProp{false};
|
||||
@@ -924,21 +827,6 @@ struct ObjectPropsNativeComponentObjectPropStruct {
|
||||
int intProp{0};
|
||||
ObjectPropsNativeComponentStringEnumProp stringEnumProp{ObjectPropsNativeComponentStringEnumProp::Small};
|
||||
ObjectPropsNativeComponentIntEnumProp intEnumProp{ObjectPropsNativeComponentIntEnumProp::IntEnumProp0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsNativeComponentObjectPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"stringProp\\"] = stringProp;
|
||||
result[\\"booleanProp\\"] = booleanProp;
|
||||
result[\\"floatProp\\"] = floatProp;
|
||||
result[\\"intProp\\"] = intProp;
|
||||
result[\\"stringEnumProp\\"] = ::facebook::react::toDynamic(stringEnumProp);
|
||||
result[\\"intEnumProp\\"] = ::facebook::react::toDynamic(intEnumProp);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPropStruct &result) {
|
||||
@@ -974,24 +862,8 @@ static inline std::string toString(const ObjectPropsNativeComponentObjectPropStr
|
||||
return \\"[Object ObjectPropsNativeComponentObjectPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentObjectPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsNativeComponentObjectArrayPropStruct {
|
||||
std::vector<std::string> array{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsNativeComponentObjectArrayPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"array\\"] = ::facebook::react::toDynamic(array);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectArrayPropStruct &result) {
|
||||
@@ -1007,28 +879,10 @@ static inline std::string toString(const ObjectPropsNativeComponentObjectArrayPr
|
||||
return \\"[Object ObjectPropsNativeComponentObjectArrayPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentObjectArrayPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct {
|
||||
ImageSource image{};
|
||||
SharedColor color{};
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"image\\"] = ::facebook::react::toDynamic(image);
|
||||
result[\\"color\\"] = ::facebook::react::toDynamic(color);
|
||||
result[\\"point\\"] = ::facebook::react::toDynamic(point);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &result) {
|
||||
@@ -1051,12 +905,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
static inline std::string toString(const ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &value) {
|
||||
return \\"[Object ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
class ObjectPropsNativeComponentProps final : public ViewProps {
|
||||
public:
|
||||
ObjectPropsNativeComponentProps() = default;
|
||||
@@ -1069,8 +917,6 @@ class ObjectPropsNativeComponentProps final : public ViewProps {
|
||||
ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1109,8 +955,6 @@ class PointPropNativeComponentViewProps final : public ViewProps {
|
||||
Point startPoint{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1149,8 +993,6 @@ class StringPropNativeComponentViewProps final : public ViewProps {
|
||||
std::string defaultValue{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
|
||||
+10
-136
@@ -40,10 +40,6 @@ ArrayPropsNativeComponentViewProps::ArrayPropsNativeComponentViewProps(
|
||||
arrayOfMixed(convertRawProp(context, rawProps, \\"arrayOfMixed\\", sourceProps.arrayOfMixed, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ArrayPropsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ArrayPropsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic ArrayPropsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ArrayPropsNativeComponentViewProps();
|
||||
@@ -55,57 +51,18 @@ folly::dynamic ArrayPropsNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (names != oldProps->names) {
|
||||
result[\\"names\\"] = toDynamic(names);
|
||||
}
|
||||
|
||||
if (disableds != oldProps->disableds) {
|
||||
result[\\"disableds\\"] = toDynamic(disableds);
|
||||
}
|
||||
|
||||
if (progress != oldProps->progress) {
|
||||
result[\\"progress\\"] = toDynamic(progress);
|
||||
}
|
||||
|
||||
if (radii != oldProps->radii) {
|
||||
result[\\"radii\\"] = toDynamic(radii);
|
||||
}
|
||||
|
||||
if (colors != oldProps->colors) {
|
||||
result[\\"colors\\"] = toDynamic(colors);
|
||||
}
|
||||
|
||||
if (srcs != oldProps->srcs) {
|
||||
result[\\"srcs\\"] = toDynamic(srcs);
|
||||
}
|
||||
|
||||
if (points != oldProps->points) {
|
||||
result[\\"points\\"] = toDynamic(points);
|
||||
}
|
||||
|
||||
if (edgeInsets != oldProps->edgeInsets) {
|
||||
result[\\"edgeInsets\\"] = toDynamic(edgeInsets);
|
||||
}
|
||||
|
||||
if (dimensions != oldProps->dimensions) {
|
||||
result[\\"dimensions\\"] = toDynamic(dimensions);
|
||||
}
|
||||
|
||||
if (sizes != oldProps->sizes) {
|
||||
result[\\"sizes\\"] = toDynamic(sizes);
|
||||
}
|
||||
|
||||
if (object != oldProps->object) {
|
||||
result[\\"object\\"] = toDynamic(object);
|
||||
}
|
||||
|
||||
if (arrayOfObjects != oldProps->arrayOfObjects) {
|
||||
result[\\"arrayOfObjects\\"] = toDynamic(arrayOfObjects);
|
||||
}
|
||||
|
||||
if (arrayOfMixed != oldProps->arrayOfMixed) {
|
||||
result[\\"arrayOfMixed\\"] = toDynamic(arrayOfMixed);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -142,10 +99,6 @@ BooleanPropNativeComponentViewProps::BooleanPropNativeComponentViewProps(
|
||||
disabledNullable(convertRawProp(context, rawProps, \\"disabledNullable\\", sourceProps.disabledNullable, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName BooleanPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"BooleanPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic BooleanPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = BooleanPropNativeComponentViewProps();
|
||||
@@ -199,10 +152,6 @@ ColorPropNativeComponentViewProps::ColorPropNativeComponentViewProps(
|
||||
tintColor(convertRawProp(context, rawProps, \\"tintColor\\", sourceProps.tintColor, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ColorPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ColorPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic ColorPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ColorPropNativeComponentViewProps();
|
||||
@@ -253,10 +202,6 @@ DimensionPropNativeComponentViewProps::DimensionPropNativeComponentViewProps(
|
||||
marginBack(convertRawProp(context, rawProps, \\"marginBack\\", sourceProps.marginBack, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName DimensionPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"DimensionPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic DimensionPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = DimensionPropNativeComponentViewProps();
|
||||
@@ -268,9 +213,6 @@ folly::dynamic DimensionPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (marginBack != oldProps->marginBack) {
|
||||
result[\\"marginBack\\"] = toDynamic(marginBack);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -306,10 +248,6 @@ EdgeInsetsPropNativeComponentViewProps::EdgeInsetsPropNativeComponentViewProps(
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EdgeInsetsPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EdgeInsetsPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic EdgeInsetsPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EdgeInsetsPropNativeComponentViewProps();
|
||||
@@ -357,10 +295,6 @@ EnumPropNativeComponentViewProps::EnumPropNativeComponentViewProps(
|
||||
intervals(convertRawProp(context, rawProps, \\"intervals\\", sourceProps.intervals, {EnumPropNativeComponentViewIntervals::Intervals0})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EnumPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EnumPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic EnumPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EnumPropNativeComponentViewProps();
|
||||
@@ -372,13 +306,7 @@ folly::dynamic EnumPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (alignment != oldProps->alignment) {
|
||||
result[\\"alignment\\"] = toDynamic(alignment);
|
||||
}
|
||||
|
||||
if (intervals != oldProps->intervals) {
|
||||
result[\\"intervals\\"] = toDynamic(intervals);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -414,10 +342,6 @@ EventNestedObjectPropsNativeComponentViewProps::EventNestedObjectPropsNativeComp
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EventNestedObjectPropsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EventNestedObjectPropsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic EventNestedObjectPropsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EventNestedObjectPropsNativeComponentViewProps();
|
||||
@@ -467,10 +391,6 @@ EventPropsNativeComponentViewProps::EventPropsNativeComponentViewProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EventPropsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EventPropsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic EventPropsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EventPropsNativeComponentViewProps();
|
||||
@@ -526,10 +446,6 @@ FloatPropsNativeComponentViewProps::FloatPropsNativeComponentViewProps(
|
||||
blurRadiusNullable(convertRawProp(context, rawProps, \\"blurRadiusNullable\\", sourceProps.blurRadiusNullable, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName FloatPropsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"FloatPropsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic FloatPropsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = FloatPropsNativeComponentViewProps();
|
||||
@@ -604,10 +520,6 @@ ImagePropNativeComponentViewProps::ImagePropNativeComponentViewProps(
|
||||
thumbImage(convertRawProp(context, rawProps, \\"thumbImage\\", sourceProps.thumbImage, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ImagePropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ImagePropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic ImagePropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ImagePropNativeComponentViewProps();
|
||||
@@ -620,7 +532,7 @@ folly::dynamic ImagePropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -659,10 +571,6 @@ IntegerPropNativeComponentViewProps::IntegerPropNativeComponentViewProps(
|
||||
progress3(convertRawProp(context, rawProps, \\"progress3\\", sourceProps.progress3, {10})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName IntegerPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"IntegerPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic IntegerPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = IntegerPropNativeComponentViewProps();
|
||||
@@ -720,10 +628,6 @@ InterfaceOnlyNativeComponentViewProps::InterfaceOnlyNativeComponentViewProps(
|
||||
title(convertRawProp(context, rawProps, \\"title\\", sourceProps.title, {\\"\\"})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName InterfaceOnlyNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"InterfaceOnlyNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic InterfaceOnlyNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = InterfaceOnlyNativeComponentViewProps();
|
||||
@@ -774,10 +678,6 @@ MixedPropNativeComponentViewProps::MixedPropNativeComponentViewProps(
|
||||
mixedProp(convertRawProp(context, rawProps, \\"mixedProp\\", sourceProps.mixedProp, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MixedPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MixedPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic MixedPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MixedPropNativeComponentViewProps();
|
||||
@@ -789,9 +689,6 @@ folly::dynamic MixedPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (mixedProp != oldProps->mixedProp) {
|
||||
result[\\"mixedProp\\"] = mixedProp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -831,10 +728,6 @@ MultiNativePropNativeComponentViewProps::MultiNativePropNativeComponentViewProps
|
||||
point(convertRawProp(context, rawProps, \\"point\\", sourceProps.point, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MultiNativePropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MultiNativePropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MultiNativePropNativeComponentViewProps();
|
||||
@@ -847,7 +740,7 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
}
|
||||
|
||||
if (color != oldProps->color) {
|
||||
@@ -859,7 +752,10 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
result[\\"point\\"] = toDynamic(point);
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -896,10 +792,6 @@ NoPropsNoEventsNativeComponentViewProps::NoPropsNoEventsNativeComponentViewProps
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName NoPropsNoEventsNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"NoPropsNoEventsNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic NoPropsNoEventsNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = NoPropsNoEventsNativeComponentViewProps();
|
||||
@@ -949,10 +841,6 @@ ObjectPropsNativeComponentProps::ObjectPropsNativeComponentProps(
|
||||
objectPrimitiveRequiredProp(convertRawProp(context, rawProps, \\"objectPrimitiveRequiredProp\\", sourceProps.objectPrimitiveRequiredProp, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ObjectPropsNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ObjectPropsNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ObjectPropsNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ObjectPropsNativeComponentProps();
|
||||
@@ -964,17 +852,8 @@ folly::dynamic ObjectPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (objectProp != oldProps->objectProp) {
|
||||
result[\\"objectProp\\"] = toDynamic(objectProp);
|
||||
}
|
||||
|
||||
if (objectArrayProp != oldProps->objectArrayProp) {
|
||||
result[\\"objectArrayProp\\"] = toDynamic(objectArrayProp);
|
||||
}
|
||||
|
||||
if (objectPrimitiveRequiredProp != oldProps->objectPrimitiveRequiredProp) {
|
||||
result[\\"objectPrimitiveRequiredProp\\"] = toDynamic(objectPrimitiveRequiredProp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1010,10 +889,6 @@ PointPropNativeComponentViewProps::PointPropNativeComponentViewProps(
|
||||
startPoint(convertRawProp(context, rawProps, \\"startPoint\\", sourceProps.startPoint, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName PointPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"PointPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic PointPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = PointPropNativeComponentViewProps();
|
||||
@@ -1026,7 +901,10 @@ folly::dynamic PointPropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
result[\\"startPoint\\"] = toDynamic(startPoint);
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1064,10 +942,6 @@ StringPropNativeComponentViewProps::StringPropNativeComponentViewProps(
|
||||
defaultValue(convertRawProp(context, rawProps, \\"defaultValue\\", sourceProps.defaultValue, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName StringPropNativeComponentViewProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"StringPropNativeComponentView\\";
|
||||
}
|
||||
|
||||
folly::dynamic StringPropNativeComponentViewProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = StringPropNativeComponentViewProps();
|
||||
|
||||
-158
@@ -16,7 +16,6 @@ Object {
|
||||
#include <cinttypes>
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <react/renderer/core/graphicsConversions.h>
|
||||
#include <react/renderer/core/propsConversions.h>
|
||||
#include <react/renderer/graphics/Color.h>
|
||||
#include <react/renderer/graphics/Point.h>
|
||||
@@ -88,16 +87,6 @@ static inline std::string toString(const ArrayPropsNativeComponentViewSizesMaskW
|
||||
}
|
||||
struct ArrayPropsNativeComponentViewObjectStruct {
|
||||
std::string prop{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentViewObjectStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"prop\\"] = prop;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewObjectStruct &result) {
|
||||
@@ -113,12 +102,6 @@ static inline std::string toString(const ArrayPropsNativeComponentViewObjectStru
|
||||
return \\"[Object ArrayPropsNativeComponentViewObjectStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentViewObjectStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ArrayPropsNativeComponentViewObjectStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -132,17 +115,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
struct ArrayPropsNativeComponentViewArrayOfObjectsStruct {
|
||||
Float prop1{0.0};
|
||||
int prop2{0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentViewArrayOfObjectsStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"prop1\\"] = prop1;
|
||||
result[\\"prop2\\"] = prop2;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewArrayOfObjectsStruct &result) {
|
||||
@@ -162,12 +134,6 @@ static inline std::string toString(const ArrayPropsNativeComponentViewArrayOfObj
|
||||
return \\"[Object ArrayPropsNativeComponentViewArrayOfObjectsStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentViewArrayOfObjectsStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ArrayPropsNativeComponentViewArrayOfObjectsStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -199,8 +165,6 @@ class ArrayPropsNativeComponentViewProps final : public ViewProps {
|
||||
std::vector<folly::dynamic> arrayOfMixed{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -239,8 +203,6 @@ class BooleanPropNativeComponentViewProps final : public ViewProps {
|
||||
bool disabledNullable{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -279,8 +241,6 @@ class ColorPropNativeComponentViewProps final : public ViewProps {
|
||||
SharedColor tintColor{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -305,7 +265,6 @@ Object {
|
||||
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <react/renderer/core/graphicsConversions.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -320,8 +279,6 @@ class DimensionPropNativeComponentViewProps final : public ViewProps {
|
||||
YGValue marginBack{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -359,8 +316,6 @@ class EdgeInsetsPropNativeComponentViewProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -405,12 +360,6 @@ static inline std::string toString(const EnumPropNativeComponentViewAlignment &v
|
||||
case EnumPropNativeComponentViewAlignment::BottomRight: return \\"bottom-right\\";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const EnumPropNativeComponentViewAlignment &value) {
|
||||
return toString(value);
|
||||
}
|
||||
#endif
|
||||
enum class EnumPropNativeComponentViewIntervals { Intervals0 = 0, Intervals15 = 15, Intervals30 = 30, Intervals60 = 60 };
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnumPropNativeComponentViewIntervals &result) {
|
||||
@@ -442,17 +391,6 @@ static inline std::string toString(const EnumPropNativeComponentViewIntervals &v
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const EnumPropNativeComponentViewIntervals &value) {
|
||||
switch (value) {
|
||||
case EnumPropNativeComponentViewIntervals::Intervals0: return 0;
|
||||
case EnumPropNativeComponentViewIntervals::Intervals15: return 15;
|
||||
case EnumPropNativeComponentViewIntervals::Intervals30: return 30;
|
||||
case EnumPropNativeComponentViewIntervals::Intervals60: return 60;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
class EnumPropNativeComponentViewProps final : public ViewProps {
|
||||
public:
|
||||
EnumPropNativeComponentViewProps() = default;
|
||||
@@ -464,8 +402,6 @@ class EnumPropNativeComponentViewProps final : public ViewProps {
|
||||
EnumPropNativeComponentViewIntervals intervals{EnumPropNativeComponentViewIntervals::Intervals0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -503,8 +439,6 @@ class EventNestedObjectPropsNativeComponentViewProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -542,8 +476,6 @@ class EventPropsNativeComponentViewProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -587,8 +519,6 @@ class FloatPropsNativeComponentViewProps final : public ViewProps {
|
||||
Float blurRadiusNullable{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -627,8 +557,6 @@ class ImagePropNativeComponentViewProps final : public ViewProps {
|
||||
ImageSource thumbImage{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -668,8 +596,6 @@ class IntegerPropNativeComponentViewProps final : public ViewProps {
|
||||
int progress3{10};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -707,8 +633,6 @@ class InterfaceOnlyNativeComponentViewProps final : public ViewProps {
|
||||
std::string title{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -746,8 +670,6 @@ class MixedPropNativeComponentViewProps final : public ViewProps {
|
||||
folly::dynamic mixedProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -791,8 +713,6 @@ class MultiNativePropNativeComponentViewProps final : public ViewProps {
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -830,8 +750,6 @@ class NoPropsNoEventsNativeComponentViewProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -880,12 +798,6 @@ static inline std::string toString(const ObjectPropsNativeComponentStringEnumPro
|
||||
case ObjectPropsNativeComponentStringEnumProp::Large: return \\"large\\";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentStringEnumProp &value) {
|
||||
return toString(value);
|
||||
}
|
||||
#endif
|
||||
enum class ObjectPropsNativeComponentIntEnumProp { IntEnumProp0 = 0, IntEnumProp1 = 1 };
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentIntEnumProp &result) {
|
||||
@@ -908,15 +820,6 @@ static inline std::string toString(const ObjectPropsNativeComponentIntEnumProp &
|
||||
case ObjectPropsNativeComponentIntEnumProp::IntEnumProp1: return \\"1\\";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentIntEnumProp &value) {
|
||||
switch (value) {
|
||||
case ObjectPropsNativeComponentIntEnumProp::IntEnumProp0: return 0;
|
||||
case ObjectPropsNativeComponentIntEnumProp::IntEnumProp1: return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
struct ObjectPropsNativeComponentObjectPropStruct {
|
||||
std::string stringProp{\\"\\"};
|
||||
bool booleanProp{false};
|
||||
@@ -924,21 +827,6 @@ struct ObjectPropsNativeComponentObjectPropStruct {
|
||||
int intProp{0};
|
||||
ObjectPropsNativeComponentStringEnumProp stringEnumProp{ObjectPropsNativeComponentStringEnumProp::Small};
|
||||
ObjectPropsNativeComponentIntEnumProp intEnumProp{ObjectPropsNativeComponentIntEnumProp::IntEnumProp0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsNativeComponentObjectPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"stringProp\\"] = stringProp;
|
||||
result[\\"booleanProp\\"] = booleanProp;
|
||||
result[\\"floatProp\\"] = floatProp;
|
||||
result[\\"intProp\\"] = intProp;
|
||||
result[\\"stringEnumProp\\"] = ::facebook::react::toDynamic(stringEnumProp);
|
||||
result[\\"intEnumProp\\"] = ::facebook::react::toDynamic(intEnumProp);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPropStruct &result) {
|
||||
@@ -974,24 +862,8 @@ static inline std::string toString(const ObjectPropsNativeComponentObjectPropStr
|
||||
return \\"[Object ObjectPropsNativeComponentObjectPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentObjectPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsNativeComponentObjectArrayPropStruct {
|
||||
std::vector<std::string> array{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsNativeComponentObjectArrayPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"array\\"] = ::facebook::react::toDynamic(array);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectArrayPropStruct &result) {
|
||||
@@ -1007,28 +879,10 @@ static inline std::string toString(const ObjectPropsNativeComponentObjectArrayPr
|
||||
return \\"[Object ObjectPropsNativeComponentObjectArrayPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentObjectArrayPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct {
|
||||
ImageSource image{};
|
||||
SharedColor color{};
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"image\\"] = ::facebook::react::toDynamic(image);
|
||||
result[\\"color\\"] = ::facebook::react::toDynamic(color);
|
||||
result[\\"point\\"] = ::facebook::react::toDynamic(point);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &result) {
|
||||
@@ -1051,12 +905,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
static inline std::string toString(const ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &value) {
|
||||
return \\"[Object ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
class ObjectPropsNativeComponentProps final : public ViewProps {
|
||||
public:
|
||||
ObjectPropsNativeComponentProps() = default;
|
||||
@@ -1069,8 +917,6 @@ class ObjectPropsNativeComponentProps final : public ViewProps {
|
||||
ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1109,8 +955,6 @@ class PointPropNativeComponentViewProps final : public ViewProps {
|
||||
Point startPoint{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1149,8 +993,6 @@ class StringPropNativeComponentViewProps final : public ViewProps {
|
||||
std::string defaultValue{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"glob": "^7.1.1",
|
||||
"hermes-parser": "0.29.1",
|
||||
"hermes-parser": "0.29.0",
|
||||
"invariant": "^2.2.4",
|
||||
"nullthrows": "^1.1.1",
|
||||
"yargs": "^17.6.2"
|
||||
@@ -43,7 +43,7 @@
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7",
|
||||
"@babel/plugin-transform-optional-chaining": "^7.24.8",
|
||||
"@babel/preset-env": "^7.25.3",
|
||||
"hermes-estree": "0.29.1",
|
||||
"hermes-estree": "0.29.0",
|
||||
"micromatch": "^4.0.4",
|
||||
"prettier": "2.8.8",
|
||||
"rimraf": "^3.0.2"
|
||||
|
||||
-1
@@ -245,7 +245,6 @@ function getLocalImports(
|
||||
return;
|
||||
case 'DimensionPrimitive':
|
||||
imports.add('#include <yoga/Yoga.h>');
|
||||
imports.add('#include <react/renderer/core/graphicsConversions.h>');
|
||||
return;
|
||||
default:
|
||||
(name: empty);
|
||||
|
||||
+7
-34
@@ -105,7 +105,7 @@ function generatePropsDiffString(
|
||||
case 'ImageSourcePrimitive':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
result["${prop.name}"] = ${prop.name}.toDynamic();
|
||||
}`;
|
||||
case 'ImageRequestPrimitive':
|
||||
// Shouldn't be used in props
|
||||
@@ -115,47 +115,24 @@ function generatePropsDiffString(
|
||||
case 'PointPrimitive':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult["x"] = ${prop.name}.x;
|
||||
pointResult["y"] = ${prop.name}.y;
|
||||
result["${prop.name}"] = pointResult;
|
||||
}`;
|
||||
case 'EdgeInsetsPrimitive':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
case 'DimensionPrimitive':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
// TODO: Implement diffProps for complex types
|
||||
return '';
|
||||
default:
|
||||
(typeAnnotation.name: empty);
|
||||
throw new Error('Received unknown ReservedPropTypeAnnotation');
|
||||
}
|
||||
case 'ArrayTypeAnnotation':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
case 'ObjectTypeAnnotation':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
case 'StringEnumTypeAnnotation':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
case 'Int32EnumTypeAnnotation':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
case 'MixedTypeAnnotation':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = ${prop.name};
|
||||
}`;
|
||||
default:
|
||||
// TODO: Implement diffProps for complex types
|
||||
return '';
|
||||
@@ -165,10 +142,6 @@ function generatePropsDiffString(
|
||||
|
||||
return `
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ${className}::getDiffPropsImplementationTarget() const {
|
||||
return "${componentName}";
|
||||
}
|
||||
|
||||
folly::dynamic ${className}::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ${className}();
|
||||
|
||||
@@ -85,8 +85,6 @@ class ${className} final${extendClasses} {
|
||||
${props}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -117,12 +115,6 @@ static inline std::string toString(const ${enumName} &value) {
|
||||
${toCases}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ${enumName} &value) {
|
||||
return toString(value);
|
||||
}
|
||||
#endif
|
||||
`.trim();
|
||||
|
||||
const IntEnumTemplate = ({
|
||||
@@ -130,13 +122,11 @@ const IntEnumTemplate = ({
|
||||
values,
|
||||
fromCases,
|
||||
toCases,
|
||||
toDynamicCases,
|
||||
}: {
|
||||
enumName: string,
|
||||
values: string,
|
||||
fromCases: string,
|
||||
toCases: string,
|
||||
toDynamicCases: string,
|
||||
}) =>
|
||||
`
|
||||
enum class ${enumName} { ${values} };
|
||||
@@ -154,39 +144,19 @@ static inline std::string toString(const ${enumName} &value) {
|
||||
${toCases}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ${enumName} &value) {
|
||||
switch (value) {
|
||||
${toDynamicCases}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
`.trim();
|
||||
|
||||
const StructTemplate = ({
|
||||
structName,
|
||||
fields,
|
||||
fromCases,
|
||||
toDynamicCases,
|
||||
}: {
|
||||
structName: string,
|
||||
fields: string,
|
||||
fromCases: string,
|
||||
toDynamicCases: string,
|
||||
}) =>
|
||||
`struct ${structName} {
|
||||
${fields}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ${structName}&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
${toDynamicCases}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ${structName} &result) {
|
||||
@@ -198,12 +168,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
static inline std::string toString(const ${structName} &value) {
|
||||
return "[Object ${structName}]";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ${structName} &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
`.trim();
|
||||
|
||||
const ArrayConversionFunctionTemplate = ({
|
||||
@@ -437,16 +401,6 @@ function generateIntEnum(
|
||||
)
|
||||
.join('\n' + ' ');
|
||||
|
||||
const toDynamicCases = values
|
||||
.map(
|
||||
value =>
|
||||
`case ${enumName}::${toIntEnumValueName(
|
||||
prop.name,
|
||||
value,
|
||||
)}: return ${value};`,
|
||||
)
|
||||
.join('\n' + ' ');
|
||||
|
||||
const valueVariables = values
|
||||
.map(val => `${toIntEnumValueName(prop.name, val)} = ${val}`)
|
||||
.join(', ');
|
||||
@@ -456,7 +410,6 @@ function generateIntEnum(
|
||||
values: valueVariables,
|
||||
fromCases,
|
||||
toCases,
|
||||
toDynamicCases,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -748,30 +701,12 @@ function generateStruct(
|
||||
})
|
||||
.join('\n ');
|
||||
|
||||
const toDynamicCases = properties
|
||||
.map((property: NamedShape<PropTypeAnnotation>) => {
|
||||
const name = property.name;
|
||||
switch (property.typeAnnotation.type) {
|
||||
case 'BooleanTypeAnnotation':
|
||||
case 'StringTypeAnnotation':
|
||||
case 'Int32TypeAnnotation':
|
||||
case 'DoubleTypeAnnotation':
|
||||
case 'FloatTypeAnnotation':
|
||||
case 'MixedTypeAnnotation':
|
||||
return `result["${name}"] = ${name};`;
|
||||
default:
|
||||
return `result["${name}"] = ::facebook::react::toDynamic(${name});`;
|
||||
}
|
||||
})
|
||||
.join('\n ');
|
||||
|
||||
structs.set(
|
||||
structName,
|
||||
StructTemplate({
|
||||
structName,
|
||||
fields,
|
||||
fromCases,
|
||||
toDynamicCases,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ TEST(${componentName}_${testName}, etc) {
|
||||
function getTestCasesForProp(
|
||||
propName: string,
|
||||
typeAnnotation: PropTypeAnnotation,
|
||||
): Array<TestCase> {
|
||||
const cases: Array<TestCase> = [];
|
||||
) {
|
||||
const cases = [];
|
||||
if (typeAnnotation.type === 'StringEnumTypeAnnotation') {
|
||||
typeAnnotation.options.forEach(option =>
|
||||
cases.push({
|
||||
|
||||
+10
-192
@@ -40,10 +40,6 @@ ArrayPropsNativeComponentProps::ArrayPropsNativeComponentProps(
|
||||
arrayOfMixed(convertRawProp(context, rawProps, \\"arrayOfMixed\\", sourceProps.arrayOfMixed, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ArrayPropsNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ArrayPropsNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ArrayPropsNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ArrayPropsNativeComponentProps();
|
||||
@@ -55,57 +51,18 @@ folly::dynamic ArrayPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (names != oldProps->names) {
|
||||
result[\\"names\\"] = toDynamic(names);
|
||||
}
|
||||
|
||||
if (disableds != oldProps->disableds) {
|
||||
result[\\"disableds\\"] = toDynamic(disableds);
|
||||
}
|
||||
|
||||
if (progress != oldProps->progress) {
|
||||
result[\\"progress\\"] = toDynamic(progress);
|
||||
}
|
||||
|
||||
if (radii != oldProps->radii) {
|
||||
result[\\"radii\\"] = toDynamic(radii);
|
||||
}
|
||||
|
||||
if (colors != oldProps->colors) {
|
||||
result[\\"colors\\"] = toDynamic(colors);
|
||||
}
|
||||
|
||||
if (srcs != oldProps->srcs) {
|
||||
result[\\"srcs\\"] = toDynamic(srcs);
|
||||
}
|
||||
|
||||
if (points != oldProps->points) {
|
||||
result[\\"points\\"] = toDynamic(points);
|
||||
}
|
||||
|
||||
if (dimensions != oldProps->dimensions) {
|
||||
result[\\"dimensions\\"] = toDynamic(dimensions);
|
||||
}
|
||||
|
||||
if (sizes != oldProps->sizes) {
|
||||
result[\\"sizes\\"] = toDynamic(sizes);
|
||||
}
|
||||
|
||||
if (object != oldProps->object) {
|
||||
result[\\"object\\"] = toDynamic(object);
|
||||
}
|
||||
|
||||
if (array != oldProps->array) {
|
||||
result[\\"array\\"] = toDynamic(array);
|
||||
}
|
||||
|
||||
if (arrayOfArrayOfObject != oldProps->arrayOfArrayOfObject) {
|
||||
result[\\"arrayOfArrayOfObject\\"] = toDynamic(arrayOfArrayOfObject);
|
||||
}
|
||||
|
||||
if (arrayOfMixed != oldProps->arrayOfMixed) {
|
||||
result[\\"arrayOfMixed\\"] = toDynamic(arrayOfMixed);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -141,10 +98,6 @@ ArrayPropsNativeComponentProps::ArrayPropsNativeComponentProps(
|
||||
nativePrimitives(convertRawProp(context, rawProps, \\"nativePrimitives\\", sourceProps.nativePrimitives, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ArrayPropsNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ArrayPropsNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ArrayPropsNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ArrayPropsNativeComponentProps();
|
||||
@@ -156,9 +109,6 @@ folly::dynamic ArrayPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (nativePrimitives != oldProps->nativePrimitives) {
|
||||
result[\\"nativePrimitives\\"] = toDynamic(nativePrimitives);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -194,10 +144,6 @@ BooleanPropNativeComponentProps::BooleanPropNativeComponentProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName BooleanPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"BooleanPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic BooleanPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = BooleanPropNativeComponentProps();
|
||||
@@ -247,10 +193,6 @@ ColorPropNativeComponentProps::ColorPropNativeComponentProps(
|
||||
tintColor(convertRawProp(context, rawProps, \\"tintColor\\", sourceProps.tintColor, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ColorPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ColorPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ColorPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ColorPropNativeComponentProps();
|
||||
@@ -300,10 +242,6 @@ CommandNativeComponentProps::CommandNativeComponentProps(
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName CommandNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"CommandNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic CommandNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = CommandNativeComponentProps();
|
||||
@@ -350,10 +288,6 @@ CommandNativeComponentProps::CommandNativeComponentProps(
|
||||
accessibilityHint(convertRawProp(context, rawProps, \\"accessibilityHint\\", sourceProps.accessibilityHint, {\\"\\"})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName CommandNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"CommandNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic CommandNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = CommandNativeComponentProps();
|
||||
@@ -404,10 +338,6 @@ DimensionPropNativeComponentProps::DimensionPropNativeComponentProps(
|
||||
marginBack(convertRawProp(context, rawProps, \\"marginBack\\", sourceProps.marginBack, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName DimensionPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"DimensionPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic DimensionPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = DimensionPropNativeComponentProps();
|
||||
@@ -419,9 +349,6 @@ folly::dynamic DimensionPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (marginBack != oldProps->marginBack) {
|
||||
result[\\"marginBack\\"] = toDynamic(marginBack);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -462,10 +389,6 @@ DoublePropNativeComponentProps::DoublePropNativeComponentProps(
|
||||
blurRadius6(convertRawProp(context, rawProps, \\"blurRadius6\\", sourceProps.blurRadius6, {0.0})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName DoublePropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"DoublePropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic DoublePropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = DoublePropNativeComponentProps();
|
||||
@@ -535,10 +458,6 @@ EventsNestedObjectNativeComponentProps::EventsNestedObjectNativeComponentProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EventsNestedObjectNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EventsNestedObjectNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic EventsNestedObjectNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EventsNestedObjectNativeComponentProps();
|
||||
@@ -588,10 +507,6 @@ EventsNativeComponentProps::EventsNativeComponentProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName EventsNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"EventsNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic EventsNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = EventsNativeComponentProps();
|
||||
@@ -641,10 +556,6 @@ InterfaceOnlyComponentProps::InterfaceOnlyComponentProps(
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName InterfaceOnlyComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"InterfaceOnlyComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic InterfaceOnlyComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = InterfaceOnlyComponentProps();
|
||||
@@ -691,10 +602,6 @@ ExcludedAndroidComponentProps::ExcludedAndroidComponentProps(
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ExcludedAndroidComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ExcludedAndroidComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ExcludedAndroidComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ExcludedAndroidComponentProps();
|
||||
@@ -741,10 +648,6 @@ ExcludedAndroidIosComponentProps::ExcludedAndroidIosComponentProps(
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ExcludedAndroidIosComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ExcludedAndroidIosComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ExcludedAndroidIosComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ExcludedAndroidIosComponentProps();
|
||||
@@ -791,10 +694,6 @@ ExcludedIosComponentProps::ExcludedIosComponentProps(
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ExcludedIosComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ExcludedIosComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ExcludedIosComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ExcludedIosComponentProps();
|
||||
@@ -817,10 +716,6 @@ MultiFileIncludedNativeComponentProps::MultiFileIncludedNativeComponentProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {true})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MultiFileIncludedNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MultiFileIncludedNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic MultiFileIncludedNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MultiFileIncludedNativeComponentProps();
|
||||
@@ -875,10 +770,6 @@ FloatPropNativeComponentProps::FloatPropNativeComponentProps(
|
||||
blurRadius6(convertRawProp(context, rawProps, \\"blurRadius6\\", sourceProps.blurRadius6, {0.0})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName FloatPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"FloatPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic FloatPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = FloatPropNativeComponentProps();
|
||||
@@ -949,10 +840,6 @@ ImagePropNativeComponentProps::ImagePropNativeComponentProps(
|
||||
thumbImage(convertRawProp(context, rawProps, \\"thumbImage\\", sourceProps.thumbImage, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ImagePropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ImagePropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ImagePropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ImagePropNativeComponentProps();
|
||||
@@ -965,7 +852,7 @@ folly::dynamic ImagePropNativeComponentProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1002,10 +889,6 @@ InsetsPropNativeComponentProps::InsetsPropNativeComponentProps(
|
||||
contentInset(convertRawProp(context, rawProps, \\"contentInset\\", sourceProps.contentInset, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName InsetsPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"InsetsPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic InsetsPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = InsetsPropNativeComponentProps();
|
||||
@@ -1017,9 +900,6 @@ folly::dynamic InsetsPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (contentInset != oldProps->contentInset) {
|
||||
result[\\"contentInset\\"] = toDynamic(contentInset);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1055,10 +935,6 @@ Int32EnumPropsNativeComponentProps::Int32EnumPropsNativeComponentProps(
|
||||
maxInterval(convertRawProp(context, rawProps, \\"maxInterval\\", sourceProps.maxInterval, {Int32EnumPropsNativeComponentMaxInterval::MaxInterval0})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName Int32EnumPropsNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"Int32EnumPropsNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic Int32EnumPropsNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = Int32EnumPropsNativeComponentProps();
|
||||
@@ -1070,9 +946,6 @@ folly::dynamic Int32EnumPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (maxInterval != oldProps->maxInterval) {
|
||||
result[\\"maxInterval\\"] = toDynamic(maxInterval);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1110,10 +983,6 @@ IntegerPropNativeComponentProps::IntegerPropNativeComponentProps(
|
||||
progress3(convertRawProp(context, rawProps, \\"progress3\\", sourceProps.progress3, {10})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName IntegerPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"IntegerPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic IntegerPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = IntegerPropNativeComponentProps();
|
||||
@@ -1171,10 +1040,6 @@ InterfaceOnlyComponentProps::InterfaceOnlyComponentProps(
|
||||
accessibilityHint(convertRawProp(context, rawProps, \\"accessibilityHint\\", sourceProps.accessibilityHint, {\\"\\"})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName InterfaceOnlyComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"InterfaceOnlyComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic InterfaceOnlyComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = InterfaceOnlyComponentProps();
|
||||
@@ -1225,10 +1090,6 @@ MixedPropNativeComponentProps::MixedPropNativeComponentProps(
|
||||
mixedProp(convertRawProp(context, rawProps, \\"mixedProp\\", sourceProps.mixedProp, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MixedPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MixedPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic MixedPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MixedPropNativeComponentProps();
|
||||
@@ -1240,9 +1101,6 @@ folly::dynamic MixedPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (mixedProp != oldProps->mixedProp) {
|
||||
result[\\"mixedProp\\"] = mixedProp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1282,10 +1140,6 @@ ImageColorPropNativeComponentProps::ImageColorPropNativeComponentProps(
|
||||
point(convertRawProp(context, rawProps, \\"point\\", sourceProps.point, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ImageColorPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ImageColorPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic ImageColorPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ImageColorPropNativeComponentProps();
|
||||
@@ -1298,7 +1152,7 @@ folly::dynamic ImageColorPropNativeComponentProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
}
|
||||
|
||||
if (color != oldProps->color) {
|
||||
@@ -1310,7 +1164,10 @@ folly::dynamic ImageColorPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
result[\\"point\\"] = toDynamic(point);
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1347,10 +1204,6 @@ NoPropsNoEventsComponentProps::NoPropsNoEventsComponentProps(
|
||||
{}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName NoPropsNoEventsComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"NoPropsNoEventsComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic NoPropsNoEventsComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = NoPropsNoEventsComponentProps();
|
||||
@@ -1398,10 +1251,6 @@ ObjectPropsProps::ObjectPropsProps(
|
||||
objectProp(convertRawProp(context, rawProps, \\"objectProp\\", sourceProps.objectProp, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName ObjectPropsProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"ObjectProps\\";
|
||||
}
|
||||
|
||||
folly::dynamic ObjectPropsProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = ObjectPropsProps();
|
||||
@@ -1413,9 +1262,6 @@ folly::dynamic ObjectPropsProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (objectProp != oldProps->objectProp) {
|
||||
result[\\"objectProp\\"] = toDynamic(objectProp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1451,10 +1297,6 @@ PointPropNativeComponentProps::PointPropNativeComponentProps(
|
||||
startPoint(convertRawProp(context, rawProps, \\"startPoint\\", sourceProps.startPoint, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName PointPropNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"PointPropNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic PointPropNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = PointPropNativeComponentProps();
|
||||
@@ -1467,7 +1309,10 @@ folly::dynamic PointPropNativeComponentProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
result[\\"startPoint\\"] = toDynamic(startPoint);
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1504,10 +1349,6 @@ StringEnumPropsNativeComponentProps::StringEnumPropsNativeComponentProps(
|
||||
alignment(convertRawProp(context, rawProps, \\"alignment\\", sourceProps.alignment, {StringEnumPropsNativeComponentAlignment::Center})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName StringEnumPropsNativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"StringEnumPropsNativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic StringEnumPropsNativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = StringEnumPropsNativeComponentProps();
|
||||
@@ -1519,9 +1360,6 @@ folly::dynamic StringEnumPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (alignment != oldProps->alignment) {
|
||||
result[\\"alignment\\"] = toDynamic(alignment);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1558,10 +1396,6 @@ StringPropComponentProps::StringPropComponentProps(
|
||||
accessibilityRole(convertRawProp(context, rawProps, \\"accessibilityRole\\", sourceProps.accessibilityRole, {})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName StringPropComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"StringPropComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic StringPropComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = StringPropComponentProps();
|
||||
@@ -1615,10 +1449,6 @@ MultiFile1NativeComponentProps::MultiFile1NativeComponentProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MultiFile1NativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MultiFile1NativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic MultiFile1NativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MultiFile1NativeComponentProps();
|
||||
@@ -1644,10 +1474,6 @@ MultiFile2NativeComponentProps::MultiFile2NativeComponentProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {true})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MultiFile2NativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MultiFile2NativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic MultiFile2NativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MultiFile2NativeComponentProps();
|
||||
@@ -1697,10 +1523,6 @@ MultiComponent1NativeComponentProps::MultiComponent1NativeComponentProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MultiComponent1NativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MultiComponent1NativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic MultiComponent1NativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MultiComponent1NativeComponentProps();
|
||||
@@ -1726,10 +1548,6 @@ MultiComponent2NativeComponentProps::MultiComponent2NativeComponentProps(
|
||||
disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {true})) {}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName MultiComponent2NativeComponentProps::getDiffPropsImplementationTarget() const {
|
||||
return \\"MultiComponent2NativeComponent\\";
|
||||
}
|
||||
|
||||
folly::dynamic MultiComponent2NativeComponentProps::getDiffProps(
|
||||
const Props* prevProps) const {
|
||||
static const auto defaultProps = MultiComponent2NativeComponentProps();
|
||||
|
||||
-305
@@ -16,7 +16,6 @@ Map {
|
||||
#include <cinttypes>
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <react/renderer/core/graphicsConversions.h>
|
||||
#include <react/renderer/core/propsConversions.h>
|
||||
#include <react/renderer/graphics/Color.h>
|
||||
#include <react/renderer/graphics/Point.h>
|
||||
@@ -87,16 +86,6 @@ static inline std::string toString(const ArrayPropsNativeComponentSizesMaskWrapp
|
||||
}
|
||||
struct ArrayPropsNativeComponentObjectStruct {
|
||||
std::string stringProp{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentObjectStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"stringProp\\"] = stringProp;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentObjectStruct &result) {
|
||||
@@ -112,12 +101,6 @@ static inline std::string toString(const ArrayPropsNativeComponentObjectStruct &
|
||||
return \\"[Object ArrayPropsNativeComponentObjectStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentObjectStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ArrayPropsNativeComponentObjectStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -130,16 +113,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
|
||||
struct ArrayPropsNativeComponentArrayObjectStruct {
|
||||
std::string stringProp{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentArrayObjectStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"stringProp\\"] = stringProp;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayObjectStruct &result) {
|
||||
@@ -155,12 +128,6 @@ static inline std::string toString(const ArrayPropsNativeComponentArrayObjectStr
|
||||
return \\"[Object ArrayPropsNativeComponentArrayObjectStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentArrayObjectStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ArrayPropsNativeComponentArrayObjectStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -173,16 +140,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
|
||||
struct ArrayPropsNativeComponentArrayStruct {
|
||||
std::vector<ArrayPropsNativeComponentArrayObjectStruct> object{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentArrayStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"object\\"] = ::facebook::react::toDynamic(object);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayStruct &result) {
|
||||
@@ -198,12 +155,6 @@ static inline std::string toString(const ArrayPropsNativeComponentArrayStruct &v
|
||||
return \\"[Object ArrayPropsNativeComponentArrayStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentArrayStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ArrayPropsNativeComponentArrayStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -216,16 +167,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
|
||||
struct ArrayPropsNativeComponentArrayOfArrayOfObjectStruct {
|
||||
std::string stringProp{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentArrayOfArrayOfObjectStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"stringProp\\"] = stringProp;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayOfArrayOfObjectStruct &result) {
|
||||
@@ -241,12 +182,6 @@ static inline std::string toString(const ArrayPropsNativeComponentArrayOfArrayOf
|
||||
return \\"[Object ArrayPropsNativeComponentArrayOfArrayOfObjectStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentArrayOfArrayOfObjectStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<std::vector<ArrayPropsNativeComponentArrayOfArrayOfObjectStruct>> &result) {
|
||||
auto items = (std::vector<std::vector<RawValue>>)value;
|
||||
for (const std::vector<RawValue> &item : items) {
|
||||
@@ -282,8 +217,6 @@ class ArrayPropsNativeComponentProps final : public ViewProps {
|
||||
std::vector<folly::dynamic> arrayOfMixed{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -321,18 +254,6 @@ struct ArrayPropsNativeComponentNativePrimitivesStruct {
|
||||
std::vector<SharedColor> colors{};
|
||||
std::vector<ImageSource> srcs{};
|
||||
std::vector<Point> points{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ArrayPropsNativeComponentNativePrimitivesStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"colors\\"] = ::facebook::react::toDynamic(colors);
|
||||
result[\\"srcs\\"] = ::facebook::react::toDynamic(srcs);
|
||||
result[\\"points\\"] = ::facebook::react::toDynamic(points);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentNativePrimitivesStruct &result) {
|
||||
@@ -356,12 +277,6 @@ static inline std::string toString(const ArrayPropsNativeComponentNativePrimitiv
|
||||
return \\"[Object ArrayPropsNativeComponentNativePrimitivesStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ArrayPropsNativeComponentNativePrimitivesStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ArrayPropsNativeComponentNativePrimitivesStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -381,8 +296,6 @@ class ArrayPropsNativeComponentProps final : public ViewProps {
|
||||
std::vector<ArrayPropsNativeComponentNativePrimitivesStruct> nativePrimitives{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -420,8 +333,6 @@ class BooleanPropNativeComponentProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -460,8 +371,6 @@ class ColorPropNativeComponentProps final : public ViewProps {
|
||||
SharedColor tintColor{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -499,8 +408,6 @@ class CommandNativeComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -538,8 +445,6 @@ class CommandNativeComponentProps final : public ViewProps {
|
||||
std::string accessibilityHint{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -564,7 +469,6 @@ Map {
|
||||
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <react/renderer/core/graphicsConversions.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -579,8 +483,6 @@ class DimensionPropNativeComponentProps final : public ViewProps {
|
||||
YGValue marginBack{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -623,8 +525,6 @@ class DoublePropNativeComponentProps final : public ViewProps {
|
||||
double blurRadius6{0.0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -662,8 +562,6 @@ class EventsNestedObjectNativeComponentProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -701,8 +599,6 @@ class EventsNativeComponentProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -740,8 +636,6 @@ class InterfaceOnlyComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -779,8 +673,6 @@ class ExcludedAndroidComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -818,8 +710,6 @@ class ExcludedAndroidIosComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -857,8 +747,6 @@ class ExcludedIosComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -873,8 +761,6 @@ class MultiFileIncludedNativeComponentProps final : public ViewProps {
|
||||
bool disabled{true};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -917,8 +803,6 @@ class FloatPropNativeComponentProps final : public ViewProps {
|
||||
Float blurRadius6{0.0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -957,8 +841,6 @@ class ImagePropNativeComponentProps final : public ViewProps {
|
||||
ImageSource thumbImage{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -997,8 +879,6 @@ class InsetsPropNativeComponentProps final : public ViewProps {
|
||||
EdgeInsets contentInset{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1053,16 +933,6 @@ static inline std::string toString(const Int32EnumPropsNativeComponentMaxInterva
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const Int32EnumPropsNativeComponentMaxInterval &value) {
|
||||
switch (value) {
|
||||
case Int32EnumPropsNativeComponentMaxInterval::MaxInterval0: return 0;
|
||||
case Int32EnumPropsNativeComponentMaxInterval::MaxInterval1: return 1;
|
||||
case Int32EnumPropsNativeComponentMaxInterval::MaxInterval2: return 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
class Int32EnumPropsNativeComponentProps final : public ViewProps {
|
||||
public:
|
||||
Int32EnumPropsNativeComponentProps() = default;
|
||||
@@ -1073,8 +943,6 @@ class Int32EnumPropsNativeComponentProps final : public ViewProps {
|
||||
Int32EnumPropsNativeComponentMaxInterval maxInterval{Int32EnumPropsNativeComponentMaxInterval::MaxInterval0};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1114,8 +982,6 @@ class IntegerPropNativeComponentProps final : public ViewProps {
|
||||
int progress3{10};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1153,8 +1019,6 @@ class InterfaceOnlyComponentProps final : public ViewProps {
|
||||
std::string accessibilityHint{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1192,8 +1056,6 @@ class MixedPropNativeComponentProps final : public ViewProps {
|
||||
folly::dynamic mixedProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1237,8 +1099,6 @@ class ImageColorPropNativeComponentProps final : public ViewProps {
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1276,8 +1136,6 @@ class NoPropsNoEventsComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1324,12 +1182,6 @@ static inline std::string toString(const ObjectPropsStringEnumProp &value) {
|
||||
case ObjectPropsStringEnumProp::Option1: return \\"option1\\";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsStringEnumProp &value) {
|
||||
return toString(value);
|
||||
}
|
||||
#endif
|
||||
enum class ObjectPropsIntEnumProp { IntEnumProp0 = 0 };
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsIntEnumProp &result) {
|
||||
@@ -1348,26 +1200,8 @@ static inline std::string toString(const ObjectPropsIntEnumProp &value) {
|
||||
case ObjectPropsIntEnumProp::IntEnumProp0: return \\"0\\";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsIntEnumProp &value) {
|
||||
switch (value) {
|
||||
case ObjectPropsIntEnumProp::IntEnumProp0: return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
struct ObjectPropsObjectPropObjectArrayPropStruct {
|
||||
std::vector<std::string> array{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsObjectPropObjectArrayPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"array\\"] = ::facebook::react::toDynamic(array);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropObjectArrayPropStruct &result) {
|
||||
@@ -1383,28 +1217,10 @@ static inline std::string toString(const ObjectPropsObjectPropObjectArrayPropStr
|
||||
return \\"[Object ObjectPropsObjectPropObjectArrayPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsObjectPropObjectArrayPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct {
|
||||
ImageSource image{};
|
||||
SharedColor color{};
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"image\\"] = ::facebook::react::toDynamic(image);
|
||||
result[\\"color\\"] = ::facebook::react::toDynamic(color);
|
||||
result[\\"point\\"] = ::facebook::react::toDynamic(point);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct &result) {
|
||||
@@ -1428,24 +1244,8 @@ static inline std::string toString(const ObjectPropsObjectPropObjectPrimitiveReq
|
||||
return \\"[Object ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsObjectPropNestedPropANestedPropBStruct {
|
||||
std::string nestedPropC{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsObjectPropNestedPropANestedPropBStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"nestedPropC\\"] = nestedPropC;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedPropANestedPropBStruct &result) {
|
||||
@@ -1461,24 +1261,8 @@ static inline std::string toString(const ObjectPropsObjectPropNestedPropANestedP
|
||||
return \\"[Object ObjectPropsObjectPropNestedPropANestedPropBStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsObjectPropNestedPropANestedPropBStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsObjectPropNestedPropAStruct {
|
||||
ObjectPropsObjectPropNestedPropANestedPropBStruct nestedPropB{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsObjectPropNestedPropAStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"nestedPropB\\"] = ::facebook::react::toDynamic(nestedPropB);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedPropAStruct &result) {
|
||||
@@ -1494,24 +1278,8 @@ static inline std::string toString(const ObjectPropsObjectPropNestedPropAStruct
|
||||
return \\"[Object ObjectPropsObjectPropNestedPropAStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsObjectPropNestedPropAStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct {
|
||||
std::string stringProp{\\"\\"};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"stringProp\\"] = stringProp;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct &result) {
|
||||
@@ -1527,12 +1295,6 @@ static inline std::string toString(const ObjectPropsObjectPropNestedArrayAsPrope
|
||||
return \\"[Object ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct> &result) {
|
||||
auto items = (std::vector<RawValue>)value;
|
||||
for (const auto &item : items) {
|
||||
@@ -1545,16 +1307,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
|
||||
struct ObjectPropsObjectPropNestedArrayAsPropertyStruct {
|
||||
std::vector<ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct> arrayProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsObjectPropNestedArrayAsPropertyStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"arrayProp\\"] = ::facebook::react::toDynamic(arrayProp);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedArrayAsPropertyStruct &result) {
|
||||
@@ -1570,12 +1322,6 @@ static inline std::string toString(const ObjectPropsObjectPropNestedArrayAsPrope
|
||||
return \\"[Object ObjectPropsObjectPropNestedArrayAsPropertyStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsObjectPropNestedArrayAsPropertyStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ObjectPropsObjectPropStruct {
|
||||
std::string stringProp{\\"\\"};
|
||||
bool booleanProp{false};
|
||||
@@ -1591,29 +1337,6 @@ struct ObjectPropsObjectPropStruct {
|
||||
ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp{};
|
||||
ObjectPropsObjectPropNestedPropAStruct nestedPropA{};
|
||||
ObjectPropsObjectPropNestedArrayAsPropertyStruct nestedArrayAsProperty{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
bool operator==(const ObjectPropsObjectPropStruct&) const = default;
|
||||
|
||||
folly::dynamic toDynamic() const {
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result[\\"stringProp\\"] = stringProp;
|
||||
result[\\"booleanProp\\"] = booleanProp;
|
||||
result[\\"floatProp\\"] = floatProp;
|
||||
result[\\"intProp\\"] = intProp;
|
||||
result[\\"stringUserDefaultProp\\"] = stringUserDefaultProp;
|
||||
result[\\"booleanUserDefaultProp\\"] = booleanUserDefaultProp;
|
||||
result[\\"floatUserDefaultProp\\"] = floatUserDefaultProp;
|
||||
result[\\"intUserDefaultProp\\"] = intUserDefaultProp;
|
||||
result[\\"stringEnumProp\\"] = ::facebook::react::toDynamic(stringEnumProp);
|
||||
result[\\"intEnumProp\\"] = ::facebook::react::toDynamic(intEnumProp);
|
||||
result[\\"objectArrayProp\\"] = ::facebook::react::toDynamic(objectArrayProp);
|
||||
result[\\"objectPrimitiveRequiredProp\\"] = ::facebook::react::toDynamic(objectPrimitiveRequiredProp);
|
||||
result[\\"nestedPropA\\"] = ::facebook::react::toDynamic(nestedPropA);
|
||||
result[\\"nestedArrayAsProperty\\"] = ::facebook::react::toDynamic(nestedArrayAsProperty);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropStruct &result) {
|
||||
@@ -1680,12 +1403,6 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
|
||||
static inline std::string toString(const ObjectPropsObjectPropStruct &value) {
|
||||
return \\"[Object ObjectPropsObjectPropStruct]\\";
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const ObjectPropsObjectPropStruct &value) {
|
||||
return value.toDynamic();
|
||||
}
|
||||
#endif
|
||||
class ObjectPropsProps final : public ViewProps {
|
||||
public:
|
||||
ObjectPropsProps() = default;
|
||||
@@ -1696,8 +1413,6 @@ class ObjectPropsProps final : public ViewProps {
|
||||
ObjectPropsObjectPropStruct objectProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1736,8 +1451,6 @@ class PointPropNativeComponentProps final : public ViewProps {
|
||||
Point startPoint{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1783,12 +1496,6 @@ static inline std::string toString(const StringEnumPropsNativeComponentAlignment
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
static inline folly::dynamic toDynamic(const StringEnumPropsNativeComponentAlignment &value) {
|
||||
return toString(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
class StringEnumPropsNativeComponentProps final : public ViewProps {
|
||||
public:
|
||||
StringEnumPropsNativeComponentProps() = default;
|
||||
@@ -1799,8 +1506,6 @@ class StringEnumPropsNativeComponentProps final : public ViewProps {
|
||||
StringEnumPropsNativeComponentAlignment alignment{StringEnumPropsNativeComponentAlignment::Center};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1839,8 +1544,6 @@ class StringPropComponentProps final : public ViewProps {
|
||||
std::string accessibilityRole{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1878,8 +1581,6 @@ class MultiFile1NativeComponentProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1894,8 +1595,6 @@ class MultiFile2NativeComponentProps final : public ViewProps {
|
||||
bool disabled{true};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1933,8 +1632,6 @@ class MultiComponent1NativeComponentProps final : public ViewProps {
|
||||
bool disabled{false};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1949,8 +1646,6 @@ class MultiComponent2NativeComponentProps final : public ViewProps {
|
||||
bool disabled{true};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
import type {NativeSyntheticEvent} from '../Types/CoreEventTypes';
|
||||
import type {PlatformConfig} from './AnimatedPlatformConfig';
|
||||
import type {EventMapping} from './NativeAnimatedModule';
|
||||
|
||||
import NativeAnimatedHelper from '../../src/private/animated/NativeAnimatedHelper';
|
||||
import {findNodeHandle} from '../ReactNative/RendererProxy';
|
||||
@@ -38,7 +37,7 @@ export function attachNativeEventImpl(
|
||||
): {detach: () => void} {
|
||||
// Find animated values in `argMapping` and create an array representing their
|
||||
// key path inside the `nativeEvent` object. Ex.: ['contentOffset', 'x'].
|
||||
const eventMappings: Array<EventMapping> = [];
|
||||
const eventMappings = [];
|
||||
|
||||
const traverse = (value: mixed, path: Array<string>) => {
|
||||
if (value instanceof AnimatedValue) {
|
||||
|
||||
@@ -376,7 +376,8 @@ describe('Animated', () => {
|
||||
const anim2 = {start: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
|
||||
const seq = Animated.sequence([anim1 as $FlowFixMe, anim2 as $FlowFixMe]);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const seq = Animated.sequence([anim1, anim2]);
|
||||
|
||||
expect(anim1.start).not.toBeCalled();
|
||||
expect(anim2.start).not.toBeCalled();
|
||||
@@ -401,7 +402,8 @@ describe('Animated', () => {
|
||||
const anim2 = {start: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
|
||||
Animated.sequence([anim1 as $FlowFixMe, anim2 as $FlowFixMe]).start(cb);
|
||||
// $FlowFixMe[prop-missing]
|
||||
Animated.sequence([anim1, anim2]).start(cb);
|
||||
|
||||
anim1.start.mock.calls[0][0]({finished: false});
|
||||
|
||||
@@ -415,7 +417,8 @@ describe('Animated', () => {
|
||||
const anim2 = {start: jest.fn(), stop: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
|
||||
const seq = Animated.sequence([anim1 as $FlowFixMe, anim2 as $FlowFixMe]);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const seq = Animated.sequence([anim1, anim2]);
|
||||
seq.start(cb);
|
||||
seq.stop();
|
||||
|
||||
@@ -433,7 +436,8 @@ describe('Animated', () => {
|
||||
const anim2 = {start: jest.fn(), stop: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
|
||||
const seq = Animated.sequence([anim1 as $FlowFixMe, anim2 as $FlowFixMe]);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const seq = Animated.sequence([anim1, anim2]);
|
||||
|
||||
seq.start(cb);
|
||||
|
||||
@@ -456,7 +460,8 @@ describe('Animated', () => {
|
||||
const anim2 = {start: jest.fn(), stop: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
|
||||
const seq = Animated.sequence([anim1 as $FlowFixMe, anim2 as $FlowFixMe]);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const seq = Animated.sequence([anim1, anim2]);
|
||||
|
||||
seq.start(cb);
|
||||
anim1.start.mock.calls[0][0]({finished: true});
|
||||
@@ -482,7 +487,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
const loop = Animated.loop(animation as $FlowFixMe);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(animation);
|
||||
|
||||
expect(animation.start).not.toBeCalled();
|
||||
|
||||
@@ -513,7 +519,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
const loop = Animated.loop(animation as $FlowFixMe, {iterations: -1});
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(animation, {iterations: -1});
|
||||
|
||||
expect(animation.start).not.toBeCalled();
|
||||
|
||||
@@ -544,10 +551,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
const loop = Animated.loop(
|
||||
animation as $FlowFixMe,
|
||||
{anotherKey: 'value'} as $FlowFixMe,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(animation, {anotherKey: 'value'});
|
||||
|
||||
expect(animation.start).not.toBeCalled();
|
||||
|
||||
@@ -578,7 +583,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
const loop = Animated.loop(animation as $FlowFixMe, {iterations: 3});
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(animation, {iterations: 3});
|
||||
|
||||
expect(animation.start).not.toBeCalled();
|
||||
|
||||
@@ -609,7 +615,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
const loop = Animated.loop(animation as $FlowFixMe, {iterations: 1});
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(animation, {iterations: 1});
|
||||
|
||||
expect(animation.start).not.toBeCalled();
|
||||
|
||||
@@ -630,7 +637,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
const loop = Animated.loop(animation as $FlowFixMe, {iterations: 0});
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(animation, {iterations: 0});
|
||||
|
||||
expect(animation.start).not.toBeCalled();
|
||||
|
||||
@@ -648,7 +656,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
Animated.loop(animation as $FlowFixMe).start(cb);
|
||||
// $FlowFixMe[prop-missing]
|
||||
Animated.loop(animation).start(cb);
|
||||
expect(animation.start).toBeCalled();
|
||||
expect(animation.reset).toHaveBeenCalledTimes(1);
|
||||
expect(cb).not.toBeCalled();
|
||||
@@ -671,7 +680,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
const loop = Animated.loop(animation as $FlowFixMe);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(animation);
|
||||
loop.start(cb);
|
||||
loop.stop();
|
||||
|
||||
@@ -693,10 +703,8 @@ describe('Animated', () => {
|
||||
};
|
||||
const cb = jest.fn();
|
||||
|
||||
const loop = Animated.loop(
|
||||
animation as $FlowFixMe,
|
||||
{resetBeforeIteration: false} as $FlowFixMe,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(animation, {resetBeforeIteration: false});
|
||||
|
||||
expect(animation.start).not.toBeCalled();
|
||||
|
||||
@@ -722,7 +730,8 @@ describe('Animated', () => {
|
||||
it('restarts sequence normally in a loop if resetBeforeIteration is false', () => {
|
||||
const anim1 = {start: jest.fn(), stop: jest.fn()};
|
||||
const anim2 = {start: jest.fn(), stop: jest.fn()};
|
||||
const seq = Animated.sequence([anim1 as $FlowFixMe, anim2 as $FlowFixMe]);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const seq = Animated.sequence([anim1, anim2]);
|
||||
|
||||
// $FlowFixMe[prop-missing]
|
||||
const loop = Animated.loop(seq, {resetBeforeIteration: false});
|
||||
@@ -752,7 +761,9 @@ describe('Animated', () => {
|
||||
it('works with an empty element in array', () => {
|
||||
const anim1 = {start: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
Animated.parallel([null as $FlowFixMe, anim1 as $FlowFixMe]).start(cb);
|
||||
// $FlowFixMe[incompatible-call]
|
||||
// $FlowFixMe[prop-missing]
|
||||
Animated.parallel([null, anim1]).start(cb);
|
||||
|
||||
expect(anim1.start).toBeCalled();
|
||||
anim1.start.mock.calls[0][0]({finished: true});
|
||||
@@ -765,7 +776,9 @@ describe('Animated', () => {
|
||||
const anim2 = {start: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
|
||||
const par = Animated.parallel([anim1 as $FlowFixMe, anim2 as $FlowFixMe]);
|
||||
// $FlowFixMe[prop-missing]
|
||||
// $FlowFixMe[prop-missing]
|
||||
const par = Animated.parallel([anim1, anim2]);
|
||||
|
||||
expect(anim1.start).not.toBeCalled();
|
||||
expect(anim2.start).not.toBeCalled();
|
||||
@@ -788,7 +801,8 @@ describe('Animated', () => {
|
||||
const anim2 = {start: jest.fn(), stop: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
|
||||
const seq = Animated.parallel([anim1 as $FlowFixMe, anim2 as $FlowFixMe]);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const seq = Animated.parallel([anim1, anim2]);
|
||||
seq.start(cb);
|
||||
seq.stop();
|
||||
|
||||
@@ -809,11 +823,8 @@ describe('Animated', () => {
|
||||
const anim3 = {start: jest.fn(), stop: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
|
||||
const seq = Animated.parallel([
|
||||
anim1 as $FlowFixMe,
|
||||
anim2 as $FlowFixMe,
|
||||
anim3 as $FlowFixMe,
|
||||
]);
|
||||
// $FlowFixMe[prop-missing]
|
||||
const seq = Animated.parallel([anim1, anim2, anim3]);
|
||||
seq.start(cb);
|
||||
|
||||
anim1.start.mock.calls[0][0]({finished: false});
|
||||
@@ -840,7 +851,8 @@ describe('Animated', () => {
|
||||
it('should call anim after delay in sequence', () => {
|
||||
const anim = {start: jest.fn(), stop: jest.fn()};
|
||||
const cb = jest.fn();
|
||||
Animated.sequence([Animated.delay(1000), anim as $FlowFixMe]).start(cb);
|
||||
// $FlowFixMe[prop-missing]
|
||||
Animated.sequence([Animated.delay(1000), anim]).start(cb);
|
||||
jest.runAllTimers();
|
||||
expect(anim.start.mock.calls.length).toBe(1);
|
||||
expect(cb).not.toBeCalled();
|
||||
|
||||
@@ -678,9 +678,7 @@ export interface ScrollViewProps
|
||||
* It's implemented using onLayout handler attached to the content container which this ScrollView renders.
|
||||
*
|
||||
*/
|
||||
onContentSizeChange?:
|
||||
| ((contentWidth: number, contentHeight: number) => void)
|
||||
| undefined;
|
||||
onContentSizeChange?: ((w: number, h: number) => void) | undefined;
|
||||
|
||||
/**
|
||||
* Fires at most once per frame during scrolling.
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {NativeSyntheticEvent} from '../../Types/CoreEventTypes';
|
||||
import type {AccessibilityState} from '../View/ViewAccessibility';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
|
||||
import StyleSheet from '../../StyleSheet/StyleSheet';
|
||||
@@ -232,7 +231,7 @@ const Switch: component(
|
||||
const _disabled =
|
||||
disabled != null ? disabled : accessibilityState?.disabled;
|
||||
|
||||
const _accessibilityState: ?AccessibilityState =
|
||||
const _accessibilityState =
|
||||
_disabled !== accessibilityState?.disabled
|
||||
? {...accessibilityState, disabled: _disabled}
|
||||
: accessibilityState;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {AccessibilityState} from '../View/ViewAccessibility';
|
||||
import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
|
||||
|
||||
import View from '../../Components/View/View';
|
||||
@@ -310,7 +309,7 @@ class TouchableHighlightImpl extends React.Component<
|
||||
const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} =
|
||||
this.state.pressability.getEventHandlers();
|
||||
|
||||
const accessibilityState: ?AccessibilityState =
|
||||
const accessibilityState =
|
||||
this.props.disabled != null
|
||||
? {
|
||||
...this.props.accessibilityState,
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import invariant from 'invariant';
|
||||
import * as React from 'react';
|
||||
import {cloneElement} from 'react';
|
||||
|
||||
type TouchableNativeFeedbackTVProps = {
|
||||
type TVProps = {
|
||||
/**
|
||||
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
||||
*
|
||||
@@ -71,7 +71,7 @@ type TouchableNativeFeedbackTVProps = {
|
||||
|
||||
export type TouchableNativeFeedbackProps = $ReadOnly<{
|
||||
...TouchableWithoutFeedbackProps,
|
||||
...TouchableNativeFeedbackTVProps,
|
||||
...TVProps,
|
||||
/**
|
||||
* Determines the type of background drawable that's going to be used to display feedback.
|
||||
* It takes an object with type property and extra data depending on the type.
|
||||
|
||||
@@ -21,7 +21,7 @@ import flattenStyle from '../../StyleSheet/flattenStyle';
|
||||
import Platform from '../../Utilities/Platform';
|
||||
import * as React from 'react';
|
||||
|
||||
export type TouchableOpacityTVProps = $ReadOnly<{
|
||||
export type TVProps = $ReadOnly<{
|
||||
/**
|
||||
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
||||
*
|
||||
@@ -79,7 +79,7 @@ type TouchableOpacityBaseProps = $ReadOnly<{
|
||||
|
||||
export type TouchableOpacityProps = $ReadOnly<{
|
||||
...TouchableWithoutFeedbackProps,
|
||||
...TouchableOpacityTVProps,
|
||||
...TVProps,
|
||||
...TouchableOpacityBaseProps,
|
||||
}>;
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ function reportException(
|
||||
// we feed back into console.error, to make sure any methods that are
|
||||
// monkey patched on top of console.error are called when coming from
|
||||
// handleException
|
||||
console.error(e);
|
||||
console.error(data.message);
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
|
||||
@@ -133,7 +133,7 @@ function runExceptionsManagerTests() {
|
||||
);
|
||||
expect(exceptionData.isFatal).toBe(false);
|
||||
expect(logToConsoleInReact).toBe(false);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
});
|
||||
|
||||
test('does not pop frames off the stack with framesToPop', () => {
|
||||
@@ -163,10 +163,16 @@ function runExceptionsManagerTests() {
|
||||
expect(nativeReportException).toBeCalledTimes(1);
|
||||
exceptionData = nativeReportException.mock.calls[0][0];
|
||||
}
|
||||
const formattedMessage =
|
||||
'Error: ' +
|
||||
error.message +
|
||||
'\n\n' +
|
||||
'This error is located at:' +
|
||||
capturedErrorDefaults.componentStack;
|
||||
expect(getLineFromFrame(exceptionData.stack[0])).toBe(
|
||||
"const error = new Error('Some error happened');",
|
||||
);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
});
|
||||
|
||||
test('wraps string in an Error and sends to handleException', () => {
|
||||
@@ -205,13 +211,7 @@ function runExceptionsManagerTests() {
|
||||
);
|
||||
expect(exceptionData.isFatal).toBe(false);
|
||||
expect(logToConsoleInReact).toBe(false);
|
||||
expect(console.error).toBeCalledTimes(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0]).toBeInstanceOf(
|
||||
ExceptionsManager.SyntheticError,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0].toString()).toBe(message);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
});
|
||||
|
||||
test('reports "Unspecified error" if error is null', () => {
|
||||
@@ -249,15 +249,7 @@ function runExceptionsManagerTests() {
|
||||
);
|
||||
expect(exceptionData.isFatal).toBe(false);
|
||||
expect(logToConsoleInReact).toBe(false);
|
||||
expect(console.error).toBeCalledTimes(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0]).toBeInstanceOf(
|
||||
ExceptionsManager.SyntheticError,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0].toString()).toBe(
|
||||
'Unspecified error',
|
||||
);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
});
|
||||
|
||||
test('works with a frozen error object', () => {
|
||||
@@ -288,7 +280,7 @@ function runExceptionsManagerTests() {
|
||||
// No component stack.
|
||||
const formattedMessage = 'Error: ' + error.message;
|
||||
expect(exceptionData.message).toBe(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
});
|
||||
|
||||
test('does not mutate the message', () => {
|
||||
@@ -320,7 +312,7 @@ function runExceptionsManagerTests() {
|
||||
'This error is located at:' +
|
||||
capturedErrorDefaults.componentStack;
|
||||
expect(exceptionData.message).toBe(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
});
|
||||
|
||||
test('can safely process the same error multiple times', () => {
|
||||
@@ -368,7 +360,7 @@ function runExceptionsManagerTests() {
|
||||
);
|
||||
expect(exceptionData.isFatal).toBe(false);
|
||||
expect(logToConsoleInReact).toBe(false);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -672,7 +664,7 @@ function runExceptionsManagerTests() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toHaveLength(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0]).toBe(error);
|
||||
expect(console.error.mock.calls[0][0]).toBe(formattedMessage);
|
||||
});
|
||||
|
||||
test('handling a non-fatal Error', () => {
|
||||
@@ -705,7 +697,7 @@ function runExceptionsManagerTests() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toHaveLength(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0]).toBe(error);
|
||||
expect(console.error.mock.calls[0][0]).toBe(formattedMessage);
|
||||
});
|
||||
|
||||
test('handling a thrown string', () => {
|
||||
@@ -734,11 +726,7 @@ function runExceptionsManagerTests() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toHaveLength(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0]).toBeInstanceOf(
|
||||
ExceptionsManager.SyntheticError,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0].toString()).toBe(message);
|
||||
expect(console.error.mock.calls[0]).toEqual([message]);
|
||||
});
|
||||
|
||||
test('does not pop frames off the stack with framesToPop', () => {
|
||||
@@ -771,7 +759,9 @@ function runExceptionsManagerTests() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toHaveLength(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0]).toBe(error);
|
||||
expect(console.error.mock.calls[0]).toEqual([
|
||||
'Error: ' + error.message,
|
||||
]);
|
||||
});
|
||||
|
||||
test('logs fatal "warn"-type errors', () => {
|
||||
@@ -793,17 +783,19 @@ function runExceptionsManagerTests() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toHaveLength(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0]).toBe(error);
|
||||
expect(console.error.mock.calls[0]).toEqual([
|
||||
'Error: ' + error.message,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('unstable_setExceptionDecorator', () => {
|
||||
let mockConsoleError;
|
||||
let mockError;
|
||||
beforeEach(() => {
|
||||
// NOTE: We initialise a fresh mock every time using spyOn, above.
|
||||
// We can't use `console._errorOriginal` for this, because that's a bound
|
||||
// (=wrapped) version of the mock and Jest does not approve.
|
||||
mockConsoleError = console.error;
|
||||
mockError = console.error;
|
||||
ExceptionsManager.installConsoleErrorReporter();
|
||||
});
|
||||
|
||||
@@ -869,11 +861,15 @@ function runExceptionsManagerTests() {
|
||||
...beforeDecorator,
|
||||
message: 'decorated: ' + beforeDecorator.message,
|
||||
});
|
||||
expect(mockConsoleError).toBeCalledTimes(2);
|
||||
expect(mockError).toBeCalledTimes(2);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[0][0]).toBe(error);
|
||||
expect(mockError.mock.calls[0][0]).toEqual(
|
||||
'Error: Some error happened',
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[1][0]).toBe(error);
|
||||
expect(mockError.mock.calls[1][0]).toMatch(
|
||||
'decorated: Error: Some error happened',
|
||||
);
|
||||
});
|
||||
|
||||
test('clearing a decorator', () => {
|
||||
@@ -897,9 +893,11 @@ function runExceptionsManagerTests() {
|
||||
expect(logBoxAddException).not.toBeCalled();
|
||||
expect(nativeReportException).toBeCalledTimes(1);
|
||||
}
|
||||
expect(mockConsoleError).toBeCalledTimes(1);
|
||||
expect(mockError).toBeCalledTimes(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[0][0]).toBe(error);
|
||||
expect(mockError.mock.calls[0][0]).toEqual(
|
||||
'Error: Some error happened',
|
||||
);
|
||||
});
|
||||
|
||||
test('prevents decorator recursion from error handler', () => {
|
||||
@@ -930,13 +928,15 @@ function runExceptionsManagerTests() {
|
||||
/decorated: .*Some error happened/,
|
||||
);
|
||||
}
|
||||
expect(mockConsoleError).toBeCalledTimes(2);
|
||||
expect(mockError).toBeCalledTimes(2);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[0][0]).toMatch(
|
||||
expect(mockError.mock.calls[0][0]).toMatch(
|
||||
/Logging an error within the decorator/,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[1][0]).toBe(error);
|
||||
expect(mockError.mock.calls[1][0]).toMatch(
|
||||
/decorated: .*Some error happened/,
|
||||
);
|
||||
});
|
||||
|
||||
test('prevents decorator recursion from console.error', () => {
|
||||
@@ -974,14 +974,14 @@ function runExceptionsManagerTests() {
|
||||
/decorated: .*Some error happened/,
|
||||
);
|
||||
}
|
||||
expect(mockConsoleError).toBeCalledTimes(2);
|
||||
expect(mockError).toBeCalledTimes(2);
|
||||
// console.error calls are chained without exception pre-processing, so decorator doesn't apply
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[0][0].toString()).toMatch(
|
||||
expect(mockError.mock.calls[0][0].toString()).toMatch(
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[1][0]).toMatch(
|
||||
expect(mockError.mock.calls[1][0]).toMatch(
|
||||
/Logging an error within the decorator/,
|
||||
);
|
||||
});
|
||||
@@ -1012,9 +1012,11 @@ function runExceptionsManagerTests() {
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
}
|
||||
expect(mockConsoleError).toBeCalledTimes(1);
|
||||
expect(mockError).toBeCalledTimes(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[0][0]).toBe(error);
|
||||
expect(mockError.mock.calls[0][0]).toMatch(
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
});
|
||||
|
||||
test('can handle throwing decorators recursion when exception is logged', () => {
|
||||
@@ -1042,9 +1044,9 @@ function runExceptionsManagerTests() {
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
}
|
||||
expect(mockConsoleError).toBeCalledTimes(1);
|
||||
expect(mockError).toBeCalledTimes(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockConsoleError.mock.calls[0][0].toString()).toMatch(
|
||||
expect(mockError.mock.calls[0][0].toString()).toMatch(
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
});
|
||||
|
||||
+4
-21
@@ -143,7 +143,10 @@ if (__DEV__) {
|
||||
// Get hostname from development server (packager)
|
||||
const devServer = getDevServer();
|
||||
const host = devServer.bundleLoadedFromServer
|
||||
? guessHostFromDevServerUrl(devServer.url)
|
||||
? devServer.url
|
||||
.replace(/https?:\/\//, '')
|
||||
.replace(/\/$/, '')
|
||||
.split(':')[0]
|
||||
: 'localhost';
|
||||
|
||||
// Read the optional global variable for backward compatibility.
|
||||
@@ -256,23 +259,3 @@ function readReloadAndProfileConfig(
|
||||
onReloadAndProfileFlagsReset,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a bad, no good, broken hack to get the host from a dev server URL for the purposes
|
||||
* of connecting to the legacy React DevTools socket (for the standalone react-devtools package).
|
||||
* It has too many bugs to list. Please don't use it in new code.
|
||||
*
|
||||
* The correct implementation would just be `return new URL(url).host`, but React Native does not
|
||||
* ship with a spec-compliant `URL` class yet. Alternatively, this can be deleted when we delete
|
||||
* `connectToWSBasedReactDevToolsFrontend`.
|
||||
*/
|
||||
function guessHostFromDevServerUrl(url: string): string {
|
||||
const hopefullyHostAndPort = url
|
||||
.replace(/https?:\/\//, '')
|
||||
.replace(/\/$/, '');
|
||||
// IPv6 addresses contain colons, so the split(':') below will return garbage.
|
||||
if (hopefullyHostAndPort.includes(']')) {
|
||||
return hopefullyHostAndPort.split(']')[0] + ']';
|
||||
}
|
||||
return hopefullyHostAndPort.split(':')[0];
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
import type {
|
||||
LayoutAnimationConfig,
|
||||
LayoutAnimationConfig as LayoutAnimationConfig_,
|
||||
LayoutAnimationProperty,
|
||||
LayoutAnimationType,
|
||||
} from '../Renderer/shims/ReactNativeTypes';
|
||||
@@ -29,7 +29,7 @@ export type {
|
||||
} from '../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
// Reexport type
|
||||
export type {LayoutAnimationConfig} from '../Renderer/shims/ReactNativeTypes';
|
||||
export type LayoutAnimationConfig = LayoutAnimationConfig_;
|
||||
|
||||
export type LayoutAnimationTypes = $ReadOnly<{
|
||||
[type in LayoutAnimationType]: type,
|
||||
|
||||
+4
-4
@@ -33,14 +33,14 @@ const invariant = require('invariant');
|
||||
const VirtualizedList = VirtualizedLists.VirtualizedList;
|
||||
const defaultKeyExtractor = VirtualizedLists.keyExtractor;
|
||||
|
||||
type RequiredFlatListProps<ItemT> = {
|
||||
type RequiredProps<ItemT> = {
|
||||
/**
|
||||
* An array (or array-like list) of items to render. Other data types can be
|
||||
* used by targeting VirtualizedList directly.
|
||||
*/
|
||||
data: ?$ReadOnly<$ArrayLike<ItemT>>,
|
||||
};
|
||||
type OptionalFlatListProps<ItemT> = {
|
||||
type OptionalProps<ItemT> = {
|
||||
/**
|
||||
* Takes an item from `data` and renders it into the list. Example usage:
|
||||
*
|
||||
@@ -178,8 +178,8 @@ function isArrayLike(data: mixed): boolean {
|
||||
}
|
||||
|
||||
type FlatListBaseProps<ItemT> = {
|
||||
...RequiredFlatListProps<ItemT>,
|
||||
...OptionalFlatListProps<ItemT>,
|
||||
...RequiredProps<ItemT>,
|
||||
...OptionalProps<ItemT>,
|
||||
};
|
||||
|
||||
export type FlatListProps<ItemT> = {
|
||||
|
||||
+4
-4
@@ -39,7 +39,7 @@ export type {
|
||||
ScrollToLocationParamsType as SectionListScrollParams,
|
||||
};
|
||||
|
||||
type RequiredSectionListProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
type RequiredProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
/**
|
||||
* The actual data to render, akin to the `data` prop in [`<FlatList>`](https://reactnative.dev/docs/flatlist).
|
||||
*
|
||||
@@ -64,7 +64,7 @@ export type SectionListRenderItem<ItemT, SectionT = DefaultSectionT> = (
|
||||
info: SectionListRenderItemInfo<ItemT, SectionT>,
|
||||
) => React.Node | null;
|
||||
|
||||
type OptionalSectionListProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
type OptionalProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
/**
|
||||
* Default renderer for every item in every section. Can be over-ridden on a per-section basis.
|
||||
*/
|
||||
@@ -110,8 +110,8 @@ export type SectionListProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
VirtualizedSectionListProps<ItemT, SectionT>,
|
||||
'getItem' | 'getItemCount' | 'renderItem' | 'keyExtractor',
|
||||
>,
|
||||
...RequiredSectionListProps<ItemT, SectionT>,
|
||||
...OptionalSectionListProps<ItemT, SectionT>,
|
||||
...RequiredProps<ItemT, SectionT>,
|
||||
...OptionalProps<ItemT, SectionT>,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
import VirtualizedLists from '@react-native/virtualized-lists';
|
||||
|
||||
type VirtualizedListType = typeof VirtualizedLists.VirtualizedList;
|
||||
const VirtualizedListComponent: VirtualizedListType =
|
||||
VirtualizedLists.VirtualizedList;
|
||||
const VirtualizedList: VirtualizedListType = VirtualizedLists.VirtualizedList;
|
||||
|
||||
export type {
|
||||
ListRenderItemInfo,
|
||||
@@ -22,4 +21,4 @@ export type {
|
||||
Separators,
|
||||
VirtualizedListProps,
|
||||
} from '@react-native/virtualized-lists';
|
||||
export default VirtualizedListComponent;
|
||||
export default VirtualizedList;
|
||||
|
||||
+6
-6
@@ -9,8 +9,8 @@
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {StackFrame} from '../../../Core/NativeExceptionsManager';
|
||||
import type {ExtendedExceptionData} from '../parseLogBoxLog';
|
||||
|
||||
const {
|
||||
parseLogBoxException,
|
||||
@@ -296,7 +296,7 @@ describe('parseLogBoxLog', () => {
|
||||
});
|
||||
|
||||
it('parses a babel transform syntax error', () => {
|
||||
const error: ExtendedExceptionData = {
|
||||
const error = {
|
||||
message: `
|
||||
|
||||
197 | });
|
||||
@@ -344,7 +344,7 @@ describe('parseLogBoxLog', () => {
|
||||
});
|
||||
|
||||
it('parses an invalid require syntax error', () => {
|
||||
const error: ExtendedExceptionData = {
|
||||
const error = {
|
||||
message: `Unable to resolve module \`ListCellx\` from /path/to/file.js: ListCellx could not be found within the project.
|
||||
|
||||
If you are sure the module exists, try these steps:
|
||||
@@ -414,7 +414,7 @@ If you are sure the module exists, try these steps:
|
||||
});
|
||||
|
||||
it('parses a reference error', () => {
|
||||
const error: ExtendedExceptionData = {
|
||||
const error = {
|
||||
message: `
|
||||
|
||||
197 | });
|
||||
@@ -462,7 +462,7 @@ If you are sure the module exists, try these steps:
|
||||
});
|
||||
|
||||
it('parses a babel codeframe error', () => {
|
||||
const error: ExtendedExceptionData = {
|
||||
const error = {
|
||||
message: `TransformError RKJSModules/Apps/CrashReact/CrashReactApp.js: /path/to/RKJSModules/Apps/CrashReact/CrashReactApp.js: The first argument to \`fbRemoteAsset\` is "null_state_glyphs", but the requested asset is missing from the local metadata. Either the asset does not exist or the metadata is not up-to-date.
|
||||
|
||||
Please follow the instructions at: fburl.com/rn-remote-assets
|
||||
@@ -514,7 +514,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
|
||||
});
|
||||
|
||||
it('parses a babel codeframe error with ansi', () => {
|
||||
const error: ExtendedExceptionData = {
|
||||
const error = {
|
||||
message: `TransformError RKJSModules/Apps/CrashReact/CrashReactApp.js: /path/to/RKJSModules/Apps/CrashReact/CrashReactApp.js: The first argument to \`fbRemoteAsset\` is "null_state_glyphs", but the requested asset is missing from the local metadata. Either the asset does not exist or the metadata is not up-to-date.
|
||||
|
||||
Please follow the instructions at: fburl.com/rn-remote-assets
|
||||
|
||||
@@ -31,7 +31,7 @@ const getUIManagerConstants: ?() => {[viewManagerName: string]: Object} =
|
||||
|
||||
const getUIManagerConstantsCached = (function () {
|
||||
let wasCalledOnce = false;
|
||||
let result: {[viewManagerName: string]: Object} = {};
|
||||
let result = {};
|
||||
return (): {[viewManagerName: string]: Object} => {
|
||||
if (!wasCalledOnce) {
|
||||
result = nullthrows(getUIManagerConstants)();
|
||||
|
||||
packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js
Vendored
+1
-1
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {AttributeConfiguration} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import type {PartialAttributeConfiguration as AttributeConfiguration} from '../../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
import flattenStyle from '../../StyleSheet/flattenStyle';
|
||||
import deepDiffer from '../../Utilities/differ/deepDiffer';
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {AttributeConfiguration} from '../../../Renderer/shims/ReactNativeTypes';
|
||||
import type {PartialAttributeConfiguration as AttributeConfiguration} from '../../../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
const {create, diff} = require('../ReactNativeAttributePayload');
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import typeof {createPublicTextInstance as createPublicTextInstanceT} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
|
||||
import typeof {createPublicTextInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
|
||||
|
||||
export type {
|
||||
HostInstance as PublicInstance,
|
||||
@@ -21,7 +21,7 @@ export type {
|
||||
} from '../../src/private/types/HostInstance';
|
||||
|
||||
export type {PublicRootInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
|
||||
export type PublicTextInstance = ReturnType<createPublicTextInstanceT>;
|
||||
export type PublicTextInstance = ReturnType<createPublicTextInstance>;
|
||||
|
||||
export {default as BatchedBridge} from '../BatchedBridge/BatchedBridge';
|
||||
export {default as ExceptionsManager} from '../Core/ExceptionsManager';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow strict
|
||||
* @generated SignedSource<<6166de7ecbfb5d83e56c11a3b6cde9ba>>
|
||||
* @generated SignedSource<<4216c04f5a8c40a833b0146588fab5fa>>
|
||||
*/
|
||||
|
||||
import type {
|
||||
@@ -35,6 +35,15 @@ export type AttributeType<T, V> =
|
||||
export type AnyAttributeType = AttributeType<$FlowFixMe, $FlowFixMe>;
|
||||
|
||||
export type AttributeConfiguration = $ReadOnly<{
|
||||
[propName: string]: AnyAttributeType,
|
||||
style: $ReadOnly<{
|
||||
[propName: string]: AnyAttributeType,
|
||||
...
|
||||
}>,
|
||||
...
|
||||
}>;
|
||||
|
||||
export type PartialAttributeConfiguration = $ReadOnly<{
|
||||
[propName: string]: AnyAttributeType,
|
||||
style?: $ReadOnly<{
|
||||
[propName: string]: AnyAttributeType,
|
||||
@@ -75,7 +84,7 @@ export type PartialViewConfig = $ReadOnly<{
|
||||
directEventTypes?: ViewConfig['directEventTypes'],
|
||||
supportsRawText?: boolean,
|
||||
uiViewClassName: string,
|
||||
validAttributes?: AttributeConfiguration,
|
||||
validAttributes?: PartialAttributeConfiguration,
|
||||
}>;
|
||||
|
||||
type InspectorDataProps = $ReadOnly<{
|
||||
|
||||
+11
-13
@@ -8,8 +8,6 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {BackgroundImageValue} from '../StyleSheetTypes';
|
||||
|
||||
import processBackgroundImage from '../processBackgroundImage';
|
||||
|
||||
const {OS} = require('../../Utilities/Platform').default;
|
||||
@@ -123,7 +121,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process a linear gradient object style with case-insensitive direction keyword', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: 'To Bottom',
|
||||
@@ -140,7 +138,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process a linear gradient object style with case-insensitive angle', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: '45DEG',
|
||||
@@ -352,7 +350,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process an array of style objects', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: 'to bottom right',
|
||||
@@ -376,7 +374,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process an style object with default direction', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [{color: 'red'}, {color: 'blue'}],
|
||||
@@ -390,7 +388,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process style object with direction enum', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: 'to right',
|
||||
@@ -405,7 +403,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process style object with direction angle', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: '45deg',
|
||||
@@ -420,7 +418,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should fix up stop positions #1', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
@@ -458,7 +456,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process multiple stop positions', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
@@ -495,7 +493,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should fix up stop positions #2', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
@@ -528,7 +526,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should fix up stop positions #3', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
@@ -561,7 +559,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should fix up stop positions #4', () => {
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
const input = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ export type PressRetentionOffset = $ReadOnly<{
|
||||
right: number,
|
||||
}>;
|
||||
|
||||
type TextPointerEventProps = $ReadOnly<{
|
||||
type PointerEventProps = $ReadOnly<{
|
||||
onPointerEnter?: (event: PointerEvent) => void,
|
||||
onPointerLeave?: (event: PointerEvent) => void,
|
||||
onPointerMove?: (event: PointerEvent) => void,
|
||||
@@ -269,7 +269,7 @@ type TextBaseProps = $ReadOnly<{
|
||||
* @see https://reactnative.dev/docs/text#reference
|
||||
*/
|
||||
export type TextProps = $ReadOnly<{
|
||||
...TextPointerEventProps,
|
||||
...PointerEventProps,
|
||||
...TextPropsIOS,
|
||||
...TextPropsAndroid,
|
||||
...TextBaseProps,
|
||||
|
||||
@@ -10,13 +10,11 @@
|
||||
|
||||
const {dispatchCommand} = require('../ReactNative/RendererProxy');
|
||||
|
||||
type NativeCommandsOptions<T = string> = $ReadOnly<{
|
||||
type Options<T = string> = $ReadOnly<{
|
||||
supportedCommands: $ReadOnlyArray<T>,
|
||||
}>;
|
||||
|
||||
function codegenNativeCommands<T: interface {}>(
|
||||
options: NativeCommandsOptions<$Keys<T>>,
|
||||
): T {
|
||||
function codegenNativeCommands<T: interface {}>(options: Options<$Keys<T>>): T {
|
||||
const commandObj: {[$Keys<T>]: (...$ReadOnlyArray<mixed>) => void} = {};
|
||||
|
||||
options.supportedCommands.forEach(command => {
|
||||
|
||||
@@ -16,7 +16,7 @@ import requireNativeComponent from '../../Libraries/ReactNative/requireNativeCom
|
||||
import UIManager from '../ReactNative/UIManager';
|
||||
|
||||
// TODO: import from CodegenSchema once workspaces are enabled
|
||||
type NativeComponentOptions = $ReadOnly<{
|
||||
type Options = $ReadOnly<{
|
||||
interfaceOnly?: boolean,
|
||||
paperComponentName?: string,
|
||||
paperComponentNameDeprecated?: string,
|
||||
@@ -33,7 +33,7 @@ export type NativeComponentType<T: {...}> = HostComponent<T>;
|
||||
// from a file suffixed with NativeComponent.js.
|
||||
function codegenNativeComponent<Props: {...}>(
|
||||
componentName: string,
|
||||
options?: NativeComponentOptions,
|
||||
options?: Options,
|
||||
): NativeComponentType<Props> {
|
||||
if (global.RN$Bridgeless === true && __DEV__) {
|
||||
console.warn(
|
||||
|
||||
@@ -3307,7 +3307,7 @@ declare export default typeof TouchableHighlight;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Components/Touchable/TouchableNativeFeedback.js 1`] = `
|
||||
"type TouchableNativeFeedbackTVProps = {
|
||||
"type TVProps = {
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
nextFocusDown?: ?number,
|
||||
nextFocusForward?: ?number,
|
||||
@@ -3317,7 +3317,7 @@ exports[`public API should not change unintentionally Libraries/Components/Touch
|
||||
};
|
||||
export type TouchableNativeFeedbackProps = $ReadOnly<{
|
||||
...TouchableWithoutFeedbackProps,
|
||||
...TouchableNativeFeedbackTVProps,
|
||||
...TVProps,
|
||||
background?: ?(
|
||||
| $ReadOnly<{
|
||||
type: \\"ThemeAttrAndroid\\",
|
||||
@@ -3377,7 +3377,7 @@ declare export default typeof TouchableNativeFeedback;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Components/Touchable/TouchableOpacity.js 1`] = `
|
||||
"export type TouchableOpacityTVProps = $ReadOnly<{
|
||||
"export type TVProps = $ReadOnly<{
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
nextFocusDown?: ?number,
|
||||
nextFocusForward?: ?number,
|
||||
@@ -3392,7 +3392,7 @@ type TouchableOpacityBaseProps = $ReadOnly<{
|
||||
}>;
|
||||
export type TouchableOpacityProps = $ReadOnly<{
|
||||
...TouchableWithoutFeedbackProps,
|
||||
...TouchableOpacityTVProps,
|
||||
...TVProps,
|
||||
...TouchableOpacityBaseProps,
|
||||
}>;
|
||||
declare const Touchable: component(
|
||||
@@ -4850,7 +4850,7 @@ exports[`public API should not change unintentionally Libraries/LayoutAnimation/
|
||||
LayoutAnimationProperty,
|
||||
LayoutAnimationAnimationConfig as LayoutAnimationAnim,
|
||||
} from \\"../Renderer/shims/ReactNativeTypes\\";
|
||||
export type { LayoutAnimationConfig } from \\"../Renderer/shims/ReactNativeTypes\\";
|
||||
export type LayoutAnimationConfig = LayoutAnimationConfig_;
|
||||
export type LayoutAnimationTypes = $ReadOnly<{
|
||||
[type in LayoutAnimationType]: type,
|
||||
}>;
|
||||
@@ -4940,10 +4940,10 @@ declare export default typeof FillRateHelper;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Lists/FlatList.js 1`] = `
|
||||
"type RequiredFlatListProps<ItemT> = {
|
||||
"type RequiredProps<ItemT> = {
|
||||
data: ?$ReadOnly<$ArrayLike<ItemT>>,
|
||||
};
|
||||
type OptionalFlatListProps<ItemT> = {
|
||||
type OptionalProps<ItemT> = {
|
||||
renderItem?: ?ListRenderItem<ItemT>,
|
||||
columnWrapperStyle?: ViewStyleProp,
|
||||
extraData?: any,
|
||||
@@ -4967,8 +4967,8 @@ type OptionalFlatListProps<ItemT> = {
|
||||
strictMode?: boolean,
|
||||
};
|
||||
type FlatListBaseProps<ItemT> = {
|
||||
...RequiredFlatListProps<ItemT>,
|
||||
...OptionalFlatListProps<ItemT>,
|
||||
...RequiredProps<ItemT>,
|
||||
...OptionalProps<ItemT>,
|
||||
};
|
||||
export type FlatListProps<ItemT> = {
|
||||
...Omit<
|
||||
@@ -5031,7 +5031,7 @@ export type {
|
||||
SectionData as SectionListData,
|
||||
ScrollToLocationParamsType as SectionListScrollParams,
|
||||
};
|
||||
type RequiredSectionListProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
type RequiredProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
sections: $ReadOnlyArray<SectionData<ItemT, SectionT>>,
|
||||
};
|
||||
export type SectionListRenderItemInfo<ItemT, SectionT = DefaultSectionT> = {
|
||||
@@ -5042,7 +5042,7 @@ export type SectionListRenderItemInfo<ItemT, SectionT = DefaultSectionT> = {
|
||||
export type SectionListRenderItem<ItemT, SectionT = DefaultSectionT> = (
|
||||
info: SectionListRenderItemInfo<ItemT, SectionT>
|
||||
) => React.Node | null;
|
||||
type OptionalSectionListProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
type OptionalProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
renderItem?: SectionListRenderItem<ItemT, SectionT>,
|
||||
extraData?: any,
|
||||
initialNumToRender?: ?number,
|
||||
@@ -5056,8 +5056,8 @@ export type SectionListProps<ItemT, SectionT = DefaultSectionT> = {
|
||||
VirtualizedSectionListProps<ItemT, SectionT>,
|
||||
\\"getItem\\" | \\"getItemCount\\" | \\"renderItem\\" | \\"keyExtractor\\",
|
||||
>,
|
||||
...RequiredSectionListProps<ItemT, SectionT>,
|
||||
...OptionalSectionListProps<ItemT, SectionT>,
|
||||
...RequiredProps<ItemT, SectionT>,
|
||||
...OptionalProps<ItemT, SectionT>,
|
||||
};
|
||||
declare export default class SectionList<
|
||||
ItemT = any,
|
||||
@@ -5143,14 +5143,14 @@ declare export const keyExtractor: KeyExtractorType;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Lists/VirtualizedList.js 1`] = `
|
||||
"type VirtualizedListType = typeof VirtualizedLists.VirtualizedList;
|
||||
declare const VirtualizedListComponent: VirtualizedListType;
|
||||
declare const VirtualizedList: VirtualizedListType;
|
||||
export type {
|
||||
ListRenderItemInfo,
|
||||
ListRenderItem,
|
||||
Separators,
|
||||
VirtualizedListProps,
|
||||
} from \\"@react-native/virtualized-lists\\";
|
||||
declare export default typeof VirtualizedListComponent;
|
||||
declare export default typeof VirtualizedList;
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -7841,7 +7841,7 @@ exports[`public API should not change unintentionally Libraries/Text/TextProps.j
|
||||
bottom: number,
|
||||
right: number,
|
||||
}>;
|
||||
type TextPointerEventProps = $ReadOnly<{
|
||||
type PointerEventProps = $ReadOnly<{
|
||||
onPointerEnter?: (event: PointerEvent) => void,
|
||||
onPointerLeave?: (event: PointerEvent) => void,
|
||||
onPointerMove?: (event: PointerEvent) => void,
|
||||
@@ -7902,7 +7902,7 @@ type TextBaseProps = $ReadOnly<{
|
||||
testID?: ?string,
|
||||
}>;
|
||||
export type TextProps = $ReadOnly<{
|
||||
...TextPointerEventProps,
|
||||
...PointerEventProps,
|
||||
...TextPropsIOS,
|
||||
...TextPropsAndroid,
|
||||
...TextBaseProps,
|
||||
@@ -8637,18 +8637,18 @@ declare export default typeof binaryToBase64;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Utilities/codegenNativeCommands.js 1`] = `
|
||||
"type NativeCommandsOptions<T = string> = $ReadOnly<{
|
||||
"type Options<T = string> = $ReadOnly<{
|
||||
supportedCommands: $ReadOnlyArray<T>,
|
||||
}>;
|
||||
declare function codegenNativeCommands<T: interface {}>(
|
||||
options: NativeCommandsOptions<$Keys<T>>
|
||||
options: Options<$Keys<T>>
|
||||
): T;
|
||||
declare export default typeof codegenNativeCommands;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Utilities/codegenNativeComponent.js 1`] = `
|
||||
"type NativeComponentOptions = $ReadOnly<{
|
||||
"type Options = $ReadOnly<{
|
||||
interfaceOnly?: boolean,
|
||||
paperComponentName?: string,
|
||||
paperComponentNameDeprecated?: string,
|
||||
@@ -8657,7 +8657,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/codege
|
||||
export type NativeComponentType<T: { ... }> = HostComponent<T>;
|
||||
declare function codegenNativeComponent<Props: { ... }>(
|
||||
componentName: string,
|
||||
options?: NativeComponentOptions
|
||||
options?: Options
|
||||
): NativeComponentType<Props>;
|
||||
declare export default typeof codegenNativeComponent;
|
||||
"
|
||||
|
||||
-41
@@ -93,7 +93,6 @@ static BOOL CGRectOverlaps(CGRect rect1, CGRect rect2)
|
||||
|
||||
if (!_mode.has_value()) {
|
||||
_mode = newViewProps.initialHidden ? RCTVirtualViewModeHidden : RCTVirtualViewModeVisible;
|
||||
self.hidden = newViewProps.initialHidden && !sIsAccessibilityUsed;
|
||||
}
|
||||
|
||||
// If disabled, `_renderState` will always be `RCTVirtualViewRenderStateUnknown`.
|
||||
@@ -126,42 +125,6 @@ static BOOL CGRectOverlaps(CGRect rect1, CGRect rect2)
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static flag that tracks whether accessibility services are being used.
|
||||
* When accessibility is detected, virtual views will remain visible even when
|
||||
* they would normally be hidden when off-screen, ensuring that accessibility
|
||||
* features will work correctly.
|
||||
*/
|
||||
static BOOL sIsAccessibilityUsed = NO;
|
||||
|
||||
- (void)_unhideIfNeeded
|
||||
{
|
||||
if (!sIsAccessibilityUsed) {
|
||||
// accessibility is detected for the first time. Make views visible.
|
||||
sIsAccessibilityUsed = YES;
|
||||
}
|
||||
|
||||
if (self.hidden) {
|
||||
self.hidden = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSInteger)accessibilityElementCount
|
||||
{
|
||||
// From empirical testing, method `accessibilityElementCount` is called lazily only
|
||||
// when accessibility is used.
|
||||
[self _unhideIfNeeded];
|
||||
return [super accessibilityElementCount];
|
||||
}
|
||||
|
||||
- (NSArray<id<UIFocusItem>> *)focusItemsInRect:(CGRect)rect
|
||||
{
|
||||
// From empirical testing, method `focusItemsInRect:` is called lazily only
|
||||
// when keyboard navigation is used.
|
||||
[self _unhideIfNeeded];
|
||||
return [super focusItemsInRect:rect];
|
||||
}
|
||||
|
||||
- (void)prepareForRecycle
|
||||
{
|
||||
[super prepareForRecycle];
|
||||
@@ -172,7 +135,6 @@ static BOOL sIsAccessibilityUsed = NO;
|
||||
_lastParentScrollViewComponentView == nil,
|
||||
@"_lastParentScrollViewComponentView should already have been cleared in didMoveToWindow.");
|
||||
|
||||
self.hidden = NO;
|
||||
_mode.reset();
|
||||
_targetRect.reset();
|
||||
}
|
||||
@@ -281,7 +243,6 @@ static BOOL sIsAccessibilityUsed = NO;
|
||||
|
||||
switch (newMode) {
|
||||
case RCTVirtualViewModeVisible:
|
||||
self.hidden = NO;
|
||||
if (_renderState == RCTVirtualViewRenderStateUnknown) {
|
||||
// Feature flag is disabled, so use the former logic.
|
||||
[self dispatchSyncModeChange:event];
|
||||
@@ -296,13 +257,11 @@ static BOOL sIsAccessibilityUsed = NO;
|
||||
}
|
||||
break;
|
||||
case RCTVirtualViewModePrerender:
|
||||
self.hidden = !sIsAccessibilityUsed;
|
||||
if (!oldMode.has_value() || oldMode != RCTVirtualViewModeVisible) {
|
||||
[self dispatchAsyncModeChange:event];
|
||||
}
|
||||
break;
|
||||
case RCTVirtualViewModeHidden:
|
||||
self.hidden = YES;
|
||||
[self dispatchAsyncModeChange:event];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4218,11 +4218,10 @@ public abstract interface class com/facebook/react/uimanager/StateWrapper {
|
||||
public abstract fun updateState (Lcom/facebook/react/bridge/WritableMap;)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/uimanager/ThemedReactContext : com/facebook/react/bridge/ReactContext {
|
||||
public class com/facebook/react/uimanager/ThemedReactContext : com/facebook/react/bridge/ReactContext {
|
||||
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Landroid/content/Context;)V
|
||||
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Landroid/content/Context;Ljava/lang/String;)V
|
||||
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Landroid/content/Context;Ljava/lang/String;I)V
|
||||
public synthetic fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Landroid/content/Context;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun addLifecycleEventListener (Lcom/facebook/react/bridge/LifecycleEventListener;)V
|
||||
public fun destroy ()V
|
||||
public fun getCatalystInstance ()Lcom/facebook/react/bridge/CatalystInstance;
|
||||
@@ -4231,14 +4230,14 @@ public final class com/facebook/react/uimanager/ThemedReactContext : com/faceboo
|
||||
public fun getJSCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/CallInvokerHolder;
|
||||
public fun getJSModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/JavaScriptModule;
|
||||
public fun getJavaScriptContextHolder ()Lcom/facebook/react/bridge/JavaScriptContextHolder;
|
||||
public final fun getModuleName ()Ljava/lang/String;
|
||||
public fun getModuleName ()Ljava/lang/String;
|
||||
public fun getNativeModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/NativeModule;
|
||||
public fun getNativeModule (Ljava/lang/String;)Lcom/facebook/react/bridge/NativeModule;
|
||||
public fun getNativeModules ()Ljava/util/Collection;
|
||||
public final fun getReactApplicationContext ()Lcom/facebook/react/bridge/ReactApplicationContext;
|
||||
public fun getReactApplicationContext ()Lcom/facebook/react/bridge/ReactApplicationContext;
|
||||
public fun getSourceURL ()Ljava/lang/String;
|
||||
public final fun getSurfaceID ()Ljava/lang/String;
|
||||
public final fun getSurfaceId ()I
|
||||
public fun getSurfaceID ()Ljava/lang/String;
|
||||
public fun getSurfaceId ()I
|
||||
public fun handleException (Ljava/lang/Exception;)V
|
||||
public fun hasActiveCatalystInstance ()Z
|
||||
public fun hasActiveReactInstance ()Z
|
||||
@@ -6673,8 +6672,3 @@ public class com/facebook/react/views/view/ReactViewManager : com/facebook/react
|
||||
public final class com/facebook/react/views/view/ReactViewManager$Companion {
|
||||
}
|
||||
|
||||
public final class com/facebook/react/views/view/WindowUtilKt {
|
||||
public static final fun isEdgeToEdgeFeatureFlagOn ()Z
|
||||
public static final fun setEdgeToEdgeFeatureFlagOn ()V
|
||||
}
|
||||
|
||||
|
||||
+3
-13
@@ -15,7 +15,6 @@ import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Window;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
@@ -24,7 +23,6 @@ import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
|
||||
import com.facebook.react.interfaces.fabric.ReactSurface;
|
||||
import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags;
|
||||
import com.facebook.react.modules.core.PermissionListener;
|
||||
import com.facebook.react.views.view.WindowUtilKt;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
||||
/**
|
||||
@@ -59,7 +57,7 @@ public class ReactActivityDelegate {
|
||||
|
||||
/**
|
||||
* Public API to populate the launch options that will be passed to React. Here you can customize
|
||||
* the values that will be passed as 'initialProperties' to the Renderer.
|
||||
* the values that will be passed as `initialProperties` to the Renderer.
|
||||
*
|
||||
* @return Either null or a key-value map as a Bundle
|
||||
*/
|
||||
@@ -123,16 +121,8 @@ public class ReactActivityDelegate {
|
||||
() -> {
|
||||
String mainComponentName = getMainComponentName();
|
||||
final Bundle launchOptions = composeLaunchOptions();
|
||||
if (mActivity != null) {
|
||||
Window window = mActivity.getWindow();
|
||||
if (window != null) {
|
||||
if (WindowUtilKt.isEdgeToEdgeFeatureFlagOn()) {
|
||||
WindowUtilKt.enableEdgeToEdge(window);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isWideColorGamutEnabled()) {
|
||||
window.setColorMode(ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT);
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isWideColorGamutEnabled()) {
|
||||
mActivity.getWindow().setColorMode(ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT);
|
||||
}
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
mReactDelegate =
|
||||
|
||||
+4
-2
@@ -105,8 +105,9 @@ public class NativeAnimatedNodesManager(
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
"createAnimatedNode: Animated node [$tag] already exists")
|
||||
}
|
||||
val type = config.getString("type")
|
||||
val node =
|
||||
when (val type = config.getString("type")) {
|
||||
when (type) {
|
||||
"style" -> StyleAnimatedNode(config, this)
|
||||
"value" -> ValueAnimatedNode(config)
|
||||
"color" -> ColorAnimatedNode(config, this, checkNotNull(reactApplicationContext))
|
||||
@@ -238,8 +239,9 @@ public class NativeAnimatedNodesManager(
|
||||
return
|
||||
}
|
||||
|
||||
val type = animationConfig.getString("type")
|
||||
val animation =
|
||||
when (val type = animationConfig.getString("type")) {
|
||||
when (type) {
|
||||
"frames" -> FrameBasedAnimationDriver(animationConfig)
|
||||
"spring" -> SpringAnimation(animationConfig)
|
||||
"decay" -> DecayAnimation(animationConfig)
|
||||
|
||||
+6
-2
@@ -36,7 +36,9 @@ public object JSONArguments {
|
||||
val result = buildReadableMap {
|
||||
while (keys.hasNext()) {
|
||||
val key = keys.next()
|
||||
when (val value = obj.get(key)) {
|
||||
val value = obj.get(key)
|
||||
|
||||
when (value) {
|
||||
is JSONObject -> put(key, fromJSONObject(value))
|
||||
is JSONArray -> put(key, fromJSONArray(value))
|
||||
is String -> put(key, value)
|
||||
@@ -80,7 +82,9 @@ public object JSONArguments {
|
||||
public fun fromJSONArray(arr: JSONArray): ReadableArray {
|
||||
val result = buildReadableArray {
|
||||
repeat(arr.length()) {
|
||||
when (val value = arr.get(it)) {
|
||||
val value = arr.get(it)
|
||||
|
||||
when (value) {
|
||||
is JSONObject -> add(fromJSONObject(value))
|
||||
is JSONArray -> add(fromJSONArray(value))
|
||||
is String -> add(value)
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.app.Activity;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
|
||||
/**
|
||||
* Base class for Catalyst native modules that require access to the {@link ReactContext} instance.
|
||||
*/
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public abstract class ReactContextBaseJavaModule extends BaseJavaModule {
|
||||
|
||||
public ReactContextBaseJavaModule() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
public ReactContextBaseJavaModule(@Nullable ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the activity to which this context is currently attached, or {@code null} if not attached.
|
||||
*
|
||||
* <p>DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSE
|
||||
* MEMORY LEAKS.
|
||||
*
|
||||
* <p>For example, never store the value returned by this method in a member variable. Instead,
|
||||
* call this method whenever you actually need the Activity and make sure to check for {@code
|
||||
* null}.
|
||||
*
|
||||
* @deprecated "Use 'getReactApplicationContext.getCurrentActivity() instead."
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "0.80.0")
|
||||
protected @Nullable final Activity getCurrentActivity() {
|
||||
return getReactApplicationContext().getCurrentActivity();
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +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.bridge
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
/** Base class for Catalyst native modules that require access to the [ReactContext] instance. */
|
||||
public abstract class ReactContextBaseJavaModule : BaseJavaModule {
|
||||
public constructor() : super(null)
|
||||
|
||||
public constructor(reactContext: ReactApplicationContext?) : super(reactContext)
|
||||
|
||||
/**
|
||||
* Get the activity to which this context is currently attached, or `null` if not attached.
|
||||
*
|
||||
* DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSE
|
||||
* MEMORY LEAKS.
|
||||
*
|
||||
* For example, never store the value returned by this method in a member variable. Instead, call
|
||||
* this method whenever you actually need the Activity and make sure to check for `null`.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Deprecated in 0.80.0. Use getReactApplicationContext.getCurrentActivity() instead.",
|
||||
ReplaceWith("reactApplicationContext.currentActivity"))
|
||||
protected fun getCurrentActivity(): Activity? {
|
||||
return reactApplicationContext.currentActivity
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -62,7 +62,7 @@ internal object ReactSoftExceptionLogger {
|
||||
|
||||
@JvmStatic
|
||||
fun logSoftException(@CategoryMode category: String, cause: Throwable): Unit {
|
||||
if (listeners.isNotEmpty()) {
|
||||
if (!listeners.isEmpty()) {
|
||||
for (listener in listeners) {
|
||||
listener.logSoftException(category, cause)
|
||||
}
|
||||
|
||||
+2
-2
@@ -140,9 +140,9 @@ private constructor(
|
||||
var curLen = 0
|
||||
while (curLen < sizeMapBufferList) {
|
||||
val sizeMapBuffer = buffer.getInt(offset + curLen)
|
||||
curLen += Int.SIZE_BYTES
|
||||
curLen = curLen + Int.SIZE_BYTES
|
||||
readMapBufferList.add(cloneWithOffset(offset + curLen))
|
||||
curLen += sizeMapBuffer
|
||||
curLen = curLen + sizeMapBuffer
|
||||
}
|
||||
return readMapBufferList
|
||||
}
|
||||
|
||||
+1
-6
@@ -530,18 +530,13 @@ public class FabricUIManager
|
||||
ReadableMapBuffer paragraphAttributes,
|
||||
float width,
|
||||
float height) {
|
||||
ViewManager textViewManager = mViewManagerRegistry.get(ReactTextViewManager.REACT_CLASS);
|
||||
|
||||
return (NativeArray)
|
||||
TextLayoutManager.measureLines(
|
||||
mReactApplicationContext,
|
||||
attributedString,
|
||||
paragraphAttributes,
|
||||
PixelUtil.toPixelFromDIP(width),
|
||||
PixelUtil.toPixelFromDIP(height),
|
||||
textViewManager instanceof ReactTextViewManagerCallback
|
||||
? (ReactTextViewManagerCallback) textViewManager
|
||||
: null);
|
||||
PixelUtil.toPixelFromDIP(height));
|
||||
}
|
||||
|
||||
public int getColor(int surfaceId, String[] resourcePaths) {
|
||||
|
||||
+1
-13
@@ -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<<697babc37818f427f02fd3ab4c53febd>>
|
||||
* @generated SignedSource<<442cbf571b5654c5d322ca1b5542db7d>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -156,12 +156,6 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun enableIOSViewClipToPaddingBox(): Boolean = accessor.enableIOSViewClipToPaddingBox()
|
||||
|
||||
/**
|
||||
* This is to fix the issue with interop view manager where component descriptor lookup is causing ViewManager to preload.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean = accessor.enableInteropViewManagerClassLookUpOptimizationIOS()
|
||||
|
||||
/**
|
||||
* When enabled, LayoutAnimations API will animate state changes on Android.
|
||||
*/
|
||||
@@ -294,12 +288,6 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun fuseboxNetworkInspectionEnabled(): Boolean = accessor.fuseboxNetworkInspectionEnabled()
|
||||
|
||||
/**
|
||||
* Number cached PreparedLayouts in TextLayoutManager cache
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun preparedTextCacheSize(): Double = accessor.preparedTextCacheSize()
|
||||
|
||||
/**
|
||||
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
|
||||
*/
|
||||
|
||||
+1
-21
@@ -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<<275296a2e051e0ae2a17d80836ae9ee1>>
|
||||
* @generated SignedSource<<166a7cc18f83861c6c4d7f96a55c5843>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
|
||||
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
|
||||
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
|
||||
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
|
||||
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
|
||||
@@ -64,7 +63,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
|
||||
private var fuseboxEnabledReleaseCache: Boolean? = null
|
||||
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
|
||||
private var preparedTextCacheSizeCache: Double? = null
|
||||
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
|
||||
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
|
||||
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
|
||||
@@ -266,15 +264,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean {
|
||||
var cached = enableInteropViewManagerClassLookUpOptimizationIOSCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.enableInteropViewManagerClassLookUpOptimizationIOS()
|
||||
enableInteropViewManagerClassLookUpOptimizationIOSCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableLayoutAnimationsOnAndroid(): Boolean {
|
||||
var cached = enableLayoutAnimationsOnAndroidCache
|
||||
if (cached == null) {
|
||||
@@ -473,15 +462,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun preparedTextCacheSize(): Double {
|
||||
var cached = preparedTextCacheSizeCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.preparedTextCacheSize()
|
||||
preparedTextCacheSizeCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
|
||||
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
|
||||
if (cached == null) {
|
||||
|
||||
+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<<25ee348b038042f2f45efdb526949f1b>>
|
||||
* @generated SignedSource<<27e8fa8139901c1decaba5bfcbced221>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -70,8 +70,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableIOSViewClipToPaddingBox(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnAndroid(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnIOS(): Boolean
|
||||
@@ -116,8 +114,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun fuseboxNetworkInspectionEnabled(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun preparedTextCacheSize(): Double
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
|
||||
|
||||
+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<<a1eb592bf34ec0bd242c44a2f6bb6828>>
|
||||
* @generated SignedSource<<5efae3bf30e8acf69f0682372c39f7b2>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -65,8 +65,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun enableIOSViewClipToPaddingBox(): Boolean = false
|
||||
|
||||
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean = false
|
||||
|
||||
override fun enableLayoutAnimationsOnAndroid(): Boolean = false
|
||||
|
||||
override fun enableLayoutAnimationsOnIOS(): Boolean = true
|
||||
@@ -111,8 +109,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun fuseboxNetworkInspectionEnabled(): Boolean = false
|
||||
|
||||
override fun preparedTextCacheSize(): Double = 200.0
|
||||
|
||||
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false
|
||||
|
||||
override fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean = false
|
||||
|
||||
+1
-23
@@ -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<<cdd5ac40322e76f95cc8831d30012375>>
|
||||
* @generated SignedSource<<498e9a51a9a0d0c0c4eb69c84bb33dd1>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
|
||||
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
|
||||
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
|
||||
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
|
||||
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
|
||||
@@ -68,7 +67,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
|
||||
private var fuseboxEnabledReleaseCache: Boolean? = null
|
||||
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
|
||||
private var preparedTextCacheSizeCache: Double? = null
|
||||
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
|
||||
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
|
||||
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
|
||||
@@ -291,16 +289,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean {
|
||||
var cached = enableInteropViewManagerClassLookUpOptimizationIOSCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.enableInteropViewManagerClassLookUpOptimizationIOS()
|
||||
accessedFeatureFlags.add("enableInteropViewManagerClassLookUpOptimizationIOS")
|
||||
enableInteropViewManagerClassLookUpOptimizationIOSCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableLayoutAnimationsOnAndroid(): Boolean {
|
||||
var cached = enableLayoutAnimationsOnAndroidCache
|
||||
if (cached == null) {
|
||||
@@ -521,16 +509,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun preparedTextCacheSize(): Double {
|
||||
var cached = preparedTextCacheSizeCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.preparedTextCacheSize()
|
||||
accessedFeatureFlags.add("preparedTextCacheSize")
|
||||
preparedTextCacheSizeCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
|
||||
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
|
||||
if (cached == null) {
|
||||
|
||||
+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<<10197755f82d5b7251563ce1517c8fac>>
|
||||
* @generated SignedSource<<fce6841e89beec5be32b76fc0941ef95>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -65,8 +65,6 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun enableIOSViewClipToPaddingBox(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableLayoutAnimationsOnAndroid(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean
|
||||
@@ -111,8 +109,6 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun fuseboxNetworkInspectionEnabled(): Boolean
|
||||
|
||||
@DoNotStrip public fun preparedTextCacheSize(): Double
|
||||
|
||||
@DoNotStrip public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
|
||||
|
||||
@DoNotStrip public fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
|
||||
|
||||
+1
-6
@@ -16,7 +16,6 @@ import com.facebook.react.bridge.ReadableMap
|
||||
import com.facebook.react.module.annotations.ReactModule
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder.getDisplayMetricsWritableMap
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder.initDisplayMetricsIfNotInitialized
|
||||
import com.facebook.react.views.view.isEdgeToEdgeFeatureFlagOn
|
||||
|
||||
/** Module that exposes Android Constants to JS. */
|
||||
@ReactModule(name = NativeDeviceInfoSpec.NAME)
|
||||
@@ -35,11 +34,7 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) :
|
||||
|
||||
// Cache the initial dimensions for later comparison in emitUpdateDimensionsEvent
|
||||
previousDisplayMetrics = displayMetrics.copy()
|
||||
|
||||
return mapOf(
|
||||
"Dimensions" to displayMetrics.toHashMap(),
|
||||
"isEdgeToEdge" to isEdgeToEdgeFeatureFlagOn,
|
||||
)
|
||||
return mapOf("Dimensions" to displayMetrics.toHashMap())
|
||||
}
|
||||
|
||||
override fun onHostResume() {
|
||||
|
||||
-13
@@ -23,7 +23,6 @@ import com.facebook.react.common.ReactConstants
|
||||
import com.facebook.react.module.annotations.ReactModule
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder.getStatusBarHeightPx
|
||||
import com.facebook.react.uimanager.PixelUtil
|
||||
import com.facebook.react.views.view.isEdgeToEdgeFeatureFlagOn
|
||||
import com.facebook.react.views.view.setStatusBarTranslucency
|
||||
import com.facebook.react.views.view.setStatusBarVisibility
|
||||
|
||||
@@ -55,12 +54,6 @@ internal class StatusBarModule(reactContext: ReactApplicationContext?) :
|
||||
"StatusBarModule: Ignored status bar change, current activity is null.")
|
||||
return
|
||||
}
|
||||
if (isEdgeToEdgeFeatureFlagOn) {
|
||||
FLog.w(
|
||||
ReactConstants.TAG,
|
||||
"StatusBarModule: Ignored status bar change, current activity is edge-to-edge.")
|
||||
return
|
||||
}
|
||||
UiThreadUtil.runOnUiThread(
|
||||
object : GuardedRunnable(reactApplicationContext) {
|
||||
override fun runGuarded() {
|
||||
@@ -89,12 +82,6 @@ internal class StatusBarModule(reactContext: ReactApplicationContext?) :
|
||||
"StatusBarModule: Ignored status bar change, current activity is null.")
|
||||
return
|
||||
}
|
||||
if (isEdgeToEdgeFeatureFlagOn) {
|
||||
FLog.w(
|
||||
ReactConstants.TAG,
|
||||
"StatusBarModule: Ignored status bar change, current activity is edge-to-edge.")
|
||||
return
|
||||
}
|
||||
UiThreadUtil.runOnUiThread(
|
||||
object : GuardedRunnable(reactApplicationContext) {
|
||||
override fun runGuarded() {
|
||||
|
||||
+1
-1
@@ -260,7 +260,7 @@ public class Task<TResult> : TaskInterface<TResult> {
|
||||
|
||||
@JvmStatic
|
||||
internal fun <TResult> create(): TaskCompletionSource<TResult> {
|
||||
return TaskCompletionSource()
|
||||
return TaskCompletionSource<TResult>()
|
||||
}
|
||||
|
||||
/** Creates a completed task with the given value. */
|
||||
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* 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 android.app.Activity;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.JavaScriptContextHolder;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Wraps {@link ReactContext} with the base {@link Context} passed into the constructor. It provides
|
||||
* also a way to start activities using the viewContext to which RN native views belong. It
|
||||
* delegates lifecycle listener registration to the original instance of {@link ReactContext} which
|
||||
* is supposed to receive the lifecycle events. At the same time we disallow receiving lifecycle
|
||||
* events for this wrapper instances. TODO: T7538544 Rename ThemedReactContext to be in alignment
|
||||
* with name of ReactApplicationContext
|
||||
*/
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public class ThemedReactContext extends ReactContext {
|
||||
|
||||
private final ReactApplicationContext mReactApplicationContext;
|
||||
@Nullable private final String mModuleName;
|
||||
private final int mSurfaceId;
|
||||
|
||||
@Deprecated
|
||||
public ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base) {
|
||||
this(reactApplicationContext, base, null, -1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ThemedReactContext(
|
||||
ReactApplicationContext reactApplicationContext, Context base, @Nullable String moduleName) {
|
||||
this(reactApplicationContext, base, moduleName, -1);
|
||||
}
|
||||
|
||||
public ThemedReactContext(
|
||||
ReactApplicationContext reactApplicationContext,
|
||||
Context base,
|
||||
@Nullable String moduleName,
|
||||
int surfaceId) {
|
||||
super(base);
|
||||
initializeFromOther(reactApplicationContext);
|
||||
mReactApplicationContext = reactApplicationContext;
|
||||
mModuleName = moduleName;
|
||||
mSurfaceId = surfaceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLifecycleEventListener(LifecycleEventListener listener) {
|
||||
mReactApplicationContext.addLifecycleEventListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLifecycleEventListener(LifecycleEventListener listener) {
|
||||
mReactApplicationContext.removeLifecycleEventListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCurrentActivity() {
|
||||
return mReactApplicationContext.hasCurrentActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Activity getCurrentActivity() {
|
||||
return mReactApplicationContext.getCurrentActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends JavaScriptModule> T getJSModule(Class<T> jsInterface) {
|
||||
return mReactApplicationContext.getJSModule(jsInterface);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends NativeModule> boolean hasNativeModule(Class<T> nativeModuleInterface) {
|
||||
return mReactApplicationContext.hasNativeModule(nativeModuleInterface);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NativeModule> getNativeModules() {
|
||||
return mReactApplicationContext.getNativeModules();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable <T extends NativeModule> T getNativeModule(Class<T> nativeModuleInterface) {
|
||||
return mReactApplicationContext.getNativeModule(nativeModuleInterface);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable NativeModule getNativeModule(String moduleName) {
|
||||
return mReactApplicationContext.getNativeModule(moduleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CatalystInstance getCatalystInstance() {
|
||||
return mReactApplicationContext.getCatalystInstance();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean hasActiveCatalystInstance() {
|
||||
return mReactApplicationContext.hasActiveCatalystInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasActiveReactInstance() {
|
||||
return mReactApplicationContext.hasActiveCatalystInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCatalystInstance() {
|
||||
return mReactApplicationContext.hasCatalystInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasReactInstance() {
|
||||
return mReactApplicationContext.hasReactInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mReactApplicationContext.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is misnamed but has some uses out in the wild. It will be deleted in a future release of
|
||||
* RN.
|
||||
*
|
||||
* @return a {@link String} that represents the module name of the js application that is being
|
||||
* rendered with this {@link ThemedReactContext}
|
||||
*/
|
||||
@Deprecated
|
||||
public @Nullable String getSurfaceID() {
|
||||
return mModuleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a {@link String} that represents the module name of the js application that is being
|
||||
* rendered with this {@link ThemedReactContext}
|
||||
*/
|
||||
public @Nullable String getModuleName() {
|
||||
return mModuleName;
|
||||
}
|
||||
|
||||
public int getSurfaceId() {
|
||||
return mSurfaceId;
|
||||
}
|
||||
|
||||
public ReactApplicationContext getReactApplicationContext() {
|
||||
return mReactApplicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleException(Exception e) {
|
||||
mReactApplicationContext.handleException(e);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean isBridgeless() {
|
||||
return mReactApplicationContext.isBridgeless();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable JavaScriptContextHolder getJavaScriptContextHolder() {
|
||||
return mReactApplicationContext.getJavaScriptContextHolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable CallInvokerHolder getJSCallInvokerHolder() {
|
||||
return mReactApplicationContext.getJSCallInvokerHolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable UIManager getFabricUIManager() {
|
||||
return mReactApplicationContext.getFabricUIManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getSourceURL() {
|
||||
return mReactApplicationContext.getSourceURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerSegment(int segmentId, String path, Callback callback) {
|
||||
mReactApplicationContext.registerSegment(segmentId, path, callback);
|
||||
}
|
||||
}
|
||||
-151
@@ -1,151 +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.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.facebook.react.bridge.Callback
|
||||
import com.facebook.react.bridge.CatalystInstance
|
||||
import com.facebook.react.bridge.JavaScriptContextHolder
|
||||
import com.facebook.react.bridge.JavaScriptModule
|
||||
import com.facebook.react.bridge.LifecycleEventListener
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.bridge.UIManager
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
|
||||
|
||||
/**
|
||||
* Wraps [ReactContext] with the base [Context] passed into the constructor. It provides also a way
|
||||
* to start activities using the viewContext to which RN native views belong. It delegates lifecycle
|
||||
* listener registration to the original instance of [ReactContext] which is supposed to receive the
|
||||
* lifecycle events. At the same time we disallow receiving lifecycle events for this wrapper
|
||||
* instances. TODO: T7538544 Rename ThemedReactContext to be in alignment with name of
|
||||
* ReactApplicationContext
|
||||
*
|
||||
* @property moduleName A [String] that represents the module name of the js application that is
|
||||
* being rendered with this [ThemedReactContext]
|
||||
*/
|
||||
public class ThemedReactContext(
|
||||
public val reactApplicationContext: ReactApplicationContext,
|
||||
base: Context,
|
||||
public val moduleName: String?,
|
||||
public val surfaceId: Int
|
||||
) : ReactContext(base) {
|
||||
|
||||
@Deprecated("This constructor is deprecated and you should not be using it.")
|
||||
public constructor(
|
||||
reactApplicationContext: ReactApplicationContext,
|
||||
base: Context,
|
||||
moduleName: String? = null
|
||||
) : this(reactApplicationContext, base, moduleName, -1)
|
||||
|
||||
@Deprecated("This constructor is deprecated and you should not be using it.")
|
||||
public constructor(
|
||||
reactApplicationContext: ReactApplicationContext,
|
||||
base: Context
|
||||
) : this(reactApplicationContext, base, null, -1)
|
||||
|
||||
init {
|
||||
initializeFromOther(reactApplicationContext)
|
||||
}
|
||||
|
||||
override fun addLifecycleEventListener(listener: LifecycleEventListener) {
|
||||
reactApplicationContext.addLifecycleEventListener(listener)
|
||||
}
|
||||
|
||||
override fun removeLifecycleEventListener(listener: LifecycleEventListener) {
|
||||
reactApplicationContext.removeLifecycleEventListener(listener)
|
||||
}
|
||||
|
||||
override fun hasCurrentActivity(): Boolean = reactApplicationContext.hasCurrentActivity()
|
||||
|
||||
override fun getCurrentActivity(): Activity? = reactApplicationContext.getCurrentActivity()
|
||||
|
||||
override fun <T : JavaScriptModule> getJSModule(jsInterface: Class<T>): T =
|
||||
reactApplicationContext.getJSModule<T>(jsInterface)
|
||||
|
||||
override fun <T : NativeModule> hasNativeModule(nativeModuleInterface: Class<T>): Boolean =
|
||||
reactApplicationContext.hasNativeModule<T>(nativeModuleInterface)
|
||||
|
||||
override fun getNativeModules(): MutableCollection<NativeModule?>? =
|
||||
reactApplicationContext.getNativeModules()
|
||||
|
||||
override fun <T : NativeModule> getNativeModule(nativeModuleInterface: Class<T>): T? =
|
||||
reactApplicationContext.getNativeModule<T>(nativeModuleInterface)
|
||||
|
||||
override fun getNativeModule(moduleName: String): NativeModule? =
|
||||
reactApplicationContext.getNativeModule(moduleName)
|
||||
|
||||
@Deprecated(
|
||||
"This method is deprecated and will be removed once the Legacy Architecture is removed")
|
||||
@LegacyArchitecture
|
||||
override fun getCatalystInstance(): CatalystInstance? =
|
||||
reactApplicationContext.getCatalystInstance()
|
||||
|
||||
@Deprecated(
|
||||
"This API has been deprecated due to naming consideration, please use hasActiveReactInstance() instead",
|
||||
ReplaceWith("hasActiveReactInstance()"))
|
||||
@LegacyArchitecture
|
||||
override fun hasActiveCatalystInstance(): Boolean =
|
||||
reactApplicationContext.hasActiveCatalystInstance()
|
||||
|
||||
override fun hasActiveReactInstance(): Boolean =
|
||||
reactApplicationContext.hasActiveCatalystInstance()
|
||||
|
||||
@Deprecated(
|
||||
"This API has been deprecated due to naming consideration, please use hasReactInstance() instead",
|
||||
ReplaceWith("hasReactInstance()"))
|
||||
@LegacyArchitecture
|
||||
override fun hasCatalystInstance(): Boolean = reactApplicationContext.hasCatalystInstance()
|
||||
|
||||
override fun hasReactInstance(): Boolean = reactApplicationContext.hasReactInstance()
|
||||
|
||||
override fun destroy() {
|
||||
reactApplicationContext.destroy()
|
||||
}
|
||||
|
||||
/**
|
||||
* This is misnamed but has some uses out in the wild. It will be deleted in a future release of
|
||||
* RN.
|
||||
*
|
||||
* @return a [String] that represents the module name of the js application that is being rendered
|
||||
* with this [ThemedReactContext]
|
||||
*/
|
||||
@Deprecated(
|
||||
"Do not depend on this method. It will be removed in a future release of React Native.")
|
||||
public fun getSurfaceID(): String? = moduleName
|
||||
|
||||
override fun handleException(e: Exception?) {
|
||||
reactApplicationContext.handleException(e)
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
"You should not invoke isBridgeless and let your code depend on this check. This function will be removed in the future.")
|
||||
override fun isBridgeless(): Boolean = reactApplicationContext.isBridgeless()
|
||||
|
||||
override fun getJavaScriptContextHolder(): JavaScriptContextHolder? =
|
||||
reactApplicationContext.getJavaScriptContextHolder()
|
||||
|
||||
override fun getJSCallInvokerHolder(): CallInvokerHolder? =
|
||||
reactApplicationContext.getJSCallInvokerHolder()
|
||||
|
||||
@Deprecated(
|
||||
"This method is deprecated, please use UIManagerHelper.getUIManager() instead.",
|
||||
ReplaceWith("UIManagerHelper.getUIManager()"))
|
||||
override fun getFabricUIManager(): UIManager? = reactApplicationContext.getFabricUIManager()
|
||||
|
||||
override fun getSourceURL(): String? = reactApplicationContext.getSourceURL()
|
||||
|
||||
override fun registerSegment(segmentId: Int, path: String?, callback: Callback?) {
|
||||
reactApplicationContext.registerSegment(segmentId, path, callback)
|
||||
}
|
||||
}
|
||||
+6
-19
@@ -53,10 +53,8 @@ import com.facebook.react.uimanager.events.EventDispatcher
|
||||
import com.facebook.react.views.common.ContextUtils
|
||||
import com.facebook.react.views.modal.ReactModalHostView.DialogRootViewGroup
|
||||
import com.facebook.react.views.view.ReactViewGroup
|
||||
import com.facebook.react.views.view.disableEdgeToEdge
|
||||
import com.facebook.react.views.view.enableEdgeToEdge
|
||||
import com.facebook.react.views.view.isEdgeToEdgeFeatureFlagOn
|
||||
import com.facebook.react.views.view.setStatusBarTranslucency
|
||||
import com.facebook.react.views.view.setSystemBarsTranslucency
|
||||
import com.facebook.yoga.annotations.DoNotStrip
|
||||
|
||||
/**
|
||||
@@ -83,19 +81,16 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
||||
public var transparent: Boolean = false
|
||||
public var onShowListener: DialogInterface.OnShowListener? = null
|
||||
public var onRequestCloseListener: OnRequestCloseListener? = null
|
||||
|
||||
public var statusBarTranslucent: Boolean = false
|
||||
get() = field || isEdgeToEdgeFeatureFlagOn
|
||||
set(value) {
|
||||
field = value
|
||||
createNewDialog = !isEdgeToEdgeFeatureFlagOn
|
||||
createNewDialog = true
|
||||
}
|
||||
|
||||
public var navigationBarTranslucent: Boolean = false
|
||||
get() = field || isEdgeToEdgeFeatureFlagOn
|
||||
set(value) {
|
||||
field = value
|
||||
createNewDialog = !isEdgeToEdgeFeatureFlagOn
|
||||
createNewDialog = true
|
||||
}
|
||||
|
||||
public var animationType: String? = null
|
||||
@@ -383,10 +378,9 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
||||
}
|
||||
|
||||
// Navigation bar cannot be translucent without status bar being translucent too
|
||||
if (navigationBarTranslucent) {
|
||||
dialogWindow.enableEdgeToEdge()
|
||||
} else {
|
||||
dialogWindow.disableEdgeToEdge()
|
||||
dialogWindow.setSystemBarsTranslucency(navigationBarTranslucent)
|
||||
|
||||
if (!navigationBarTranslucent) {
|
||||
dialogWindow.setStatusBarTranslucency(statusBarTranslucent)
|
||||
}
|
||||
|
||||
@@ -422,13 +416,6 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
||||
val dialogWindowInsetsController =
|
||||
WindowInsetsControllerCompat(dialogWindow, dialogWindow.decorView)
|
||||
|
||||
if (isEdgeToEdgeFeatureFlagOn) {
|
||||
activityWindowInsetsController.systemBarsBehavior =
|
||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
dialogWindowInsetsController.systemBarsBehavior =
|
||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
}
|
||||
|
||||
dialogWindowInsetsController.isAppearanceLightStatusBars =
|
||||
activityWindowInsetsController.isAppearanceLightStatusBars
|
||||
|
||||
|
||||
+4
-4
@@ -261,7 +261,7 @@ public object ReactScrollViewHelper {
|
||||
// Register the listeners for the fling animator if there isn't any
|
||||
val flingAnimator = scrollView.getFlingAnimator()
|
||||
if (flingAnimator.listeners == null || flingAnimator.listeners.size == 0) {
|
||||
registerFlingAnimator(scrollView)
|
||||
registerFlingAnimator<T>(scrollView)
|
||||
}
|
||||
val scrollState = scrollView.reactScrollViewScrollState
|
||||
scrollState.setFinalAnimatedPositionScroll(x, y)
|
||||
@@ -400,7 +400,7 @@ public object ReactScrollViewHelper {
|
||||
|
||||
override fun onAnimationEnd(animator: Animator) {
|
||||
scrollView.reactScrollViewScrollState.isFinished = true
|
||||
updateFabricScrollState(scrollView)
|
||||
updateFabricScrollState<T>(scrollView)
|
||||
}
|
||||
|
||||
override fun onAnimationCancel(animator: Animator) {
|
||||
@@ -456,9 +456,9 @@ public object ReactScrollViewHelper {
|
||||
val height = scrollView.height - scrollView.paddingBottom - scrollView.paddingTop
|
||||
val finalAnimatedPositionScroll = scrollState.finalAnimatedPositionScroll
|
||||
scroller.fling(
|
||||
getNextFlingStartValue(
|
||||
getNextFlingStartValue<T>(
|
||||
scrollView, scrollView.scrollX, finalAnimatedPositionScroll.x, velocityX), // startX
|
||||
getNextFlingStartValue(
|
||||
getNextFlingStartValue<T>(
|
||||
scrollView, scrollView.scrollY, finalAnimatedPositionScroll.y, velocityY), // startY
|
||||
velocityX, // velocityX
|
||||
velocityY, // velocityY
|
||||
|
||||
+2
-3
@@ -1007,8 +1007,7 @@ internal object TextLayoutManager {
|
||||
attributedString: MapBuffer,
|
||||
paragraphAttributes: MapBuffer,
|
||||
width: Float,
|
||||
height: Float,
|
||||
reactTextViewManagerCallback: ReactTextViewManagerCallback?
|
||||
height: Float
|
||||
): WritableArray {
|
||||
val layout =
|
||||
createLayoutForMeasurement(
|
||||
@@ -1019,7 +1018,7 @@ internal object TextLayoutManager {
|
||||
YogaMeasureMode.EXACTLY,
|
||||
height,
|
||||
YogaMeasureMode.EXACTLY,
|
||||
reactTextViewManagerCallback)
|
||||
null /* TODO T226571550: Fix measureLines with ReactTextViewManagerCallback */)
|
||||
return FontMetricsUtil.getFontMetrics(layout.text, layout, context)
|
||||
}
|
||||
|
||||
|
||||
+40
-76
@@ -13,30 +13,9 @@ import android.view.Window
|
||||
import android.view.WindowManager
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import com.facebook.react.views.common.UiModeUtils
|
||||
|
||||
// The light scrim color used in the platform API 29+
|
||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/com/android/internal/policy/DecorView.java;drc=6ef0f022c333385dba2c294e35b8de544455bf19;l=142
|
||||
internal val LightNavigationBarColor = Color.argb(0xe6, 0xFF, 0xFF, 0xFF)
|
||||
|
||||
// The dark scrim color used in the platform.
|
||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/res/color/system_bar_background_semi_transparent.xml
|
||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/remote_color_resources_res/values/colors.xml;l=67
|
||||
internal val DarkNavigationBarColor = Color.argb(0x80, 0x1b, 0x1b, 0x1b)
|
||||
|
||||
/**
|
||||
* This does not enable or apply edge-to-edge behavior, it simply tracks whether it has been flagged
|
||||
* as enabled elsewhere in the application.
|
||||
*/
|
||||
public var isEdgeToEdgeFeatureFlagOn: Boolean = false
|
||||
private set
|
||||
|
||||
public fun setEdgeToEdgeFeatureFlagOn() {
|
||||
isEdgeToEdgeFeatureFlagOn = true
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
internal fun Window.setStatusBarTranslucency(isTranslucent: Boolean) {
|
||||
// If the status bar is translucent hook into the window insets calculations
|
||||
@@ -66,74 +45,59 @@ internal fun Window.setStatusBarVisibility(isHidden: Boolean) {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun Window.statusBarHide() {
|
||||
if (isEdgeToEdgeFeatureFlagOn) {
|
||||
WindowInsetsControllerCompat(this, decorView).run {
|
||||
systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
hide(WindowInsetsCompat.Type.statusBars())
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// Ensure the content extends into the cutout area
|
||||
attributes.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
setDecorFitsSystemWindows(false)
|
||||
}
|
||||
addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// Ensure the content extends into the cutout area
|
||||
attributes.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
setDecorFitsSystemWindows(false)
|
||||
}
|
||||
addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun Window.statusBarShow() {
|
||||
if (isEdgeToEdgeFeatureFlagOn) {
|
||||
WindowInsetsControllerCompat(this, decorView).run {
|
||||
systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
show(WindowInsetsCompat.Type.statusBars())
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
attributes.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
|
||||
setDecorFitsSystemWindows(true)
|
||||
}
|
||||
addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
|
||||
clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
attributes.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
|
||||
setDecorFitsSystemWindows(true)
|
||||
}
|
||||
addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
|
||||
clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
internal fun Window.enableEdgeToEdge() {
|
||||
WindowCompat.setDecorFitsSystemWindows(this, false)
|
||||
internal fun Window.setSystemBarsTranslucency(isTranslucent: Boolean) {
|
||||
WindowCompat.setDecorFitsSystemWindows(this, !isTranslucent)
|
||||
|
||||
val isDarkMode = UiModeUtils.isDarkMode(context)
|
||||
if (isTranslucent) {
|
||||
val isDarkMode = UiModeUtils.isDarkMode(context)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
isStatusBarContrastEnforced = false
|
||||
isNavigationBarContrastEnforced = true
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
isStatusBarContrastEnforced = false
|
||||
isNavigationBarContrastEnforced = true
|
||||
}
|
||||
|
||||
statusBarColor = Color.TRANSPARENT
|
||||
navigationBarColor =
|
||||
when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> Color.TRANSPARENT
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !isDarkMode -> LightNavigationBarColor
|
||||
else -> DarkNavigationBarColor
|
||||
}
|
||||
|
||||
WindowInsetsControllerCompat(this, decorView).run {
|
||||
isAppearanceLightNavigationBars = !isDarkMode
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
attributes.layoutInDisplayCutoutMode =
|
||||
statusBarColor = Color.TRANSPARENT
|
||||
navigationBarColor =
|
||||
when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R ->
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
||||
else -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> Color.TRANSPARENT
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !isDarkMode ->
|
||||
Color.argb(0xe6, 0xFF, 0xFF, 0xFF)
|
||||
else -> Color.argb(0x80, 0x1b, 0x1b, 0x1b)
|
||||
}
|
||||
|
||||
WindowInsetsControllerCompat(this, this.decorView).run {
|
||||
isAppearanceLightNavigationBars = !isDarkMode
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
attributes.layoutInDisplayCutoutMode =
|
||||
when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R ->
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
||||
else -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Window.disableEdgeToEdge() {
|
||||
WindowCompat.setDecorFitsSystemWindows(this, true)
|
||||
}
|
||||
|
||||
+3
-1
@@ -9,8 +9,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace facebook::gloginit {
|
||||
namespace facebook {
|
||||
namespace gloginit {
|
||||
|
||||
void initialize(const char* tag = "ReactNativeJNI");
|
||||
|
||||
}
|
||||
} // namespace facebook
|
||||
|
||||
+4
-1
@@ -281,7 +281,10 @@ jintArray FabricUIManagerBinding::getRelativeAncestorList(
|
||||
for (auto it = std::next(ancestorList.begin()); it != ancestorList.end();
|
||||
++it) {
|
||||
auto& ancestor = *it;
|
||||
ancestorTags.push_back(ancestor.first.get().getTag());
|
||||
if (ancestor.first.get().getTraits().check(
|
||||
ShadowNodeTraits::Trait::FormsStackingContext)) {
|
||||
ancestorTags.push_back(ancestor.first.get().getTag());
|
||||
}
|
||||
}
|
||||
|
||||
jintArray result = env->NewIntArray(static_cast<jint>(ancestorTags.size()));
|
||||
|
||||
+1
-29
@@ -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<<53e68ed98b80c867e3045902e1618c9b>>
|
||||
* @generated SignedSource<<04d1e45bd61df19a284947523172bf4a>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -165,12 +165,6 @@ class ReactNativeFeatureFlagsJavaProvider
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool enableInteropViewManagerClassLookUpOptimizationIOS() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableInteropViewManagerClassLookUpOptimizationIOS");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool enableLayoutAnimationsOnAndroid() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableLayoutAnimationsOnAndroid");
|
||||
@@ -303,12 +297,6 @@ class ReactNativeFeatureFlagsJavaProvider
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
double preparedTextCacheSize() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jdouble()>("preparedTextCacheSize");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool traceTurboModulePromiseRejectionsOnAndroid() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("traceTurboModulePromiseRejectionsOnAndroid");
|
||||
@@ -484,11 +472,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableIOSViewClipToPaddingBox(
|
||||
return ReactNativeFeatureFlags::enableIOSViewClipToPaddingBox();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::enableInteropViewManagerClassLookUpOptimizationIOS(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::enableInteropViewManagerClassLookUpOptimizationIOS();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnAndroid(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::enableLayoutAnimationsOnAndroid();
|
||||
@@ -599,11 +582,6 @@ bool JReactNativeFeatureFlagsCxxInterop::fuseboxNetworkInspectionEnabled(
|
||||
return ReactNativeFeatureFlags::fuseboxNetworkInspectionEnabled();
|
||||
}
|
||||
|
||||
double JReactNativeFeatureFlagsCxxInterop::preparedTextCacheSize(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::preparedTextCacheSize();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid();
|
||||
@@ -753,9 +731,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"enableIOSViewClipToPaddingBox",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableIOSViewClipToPaddingBox),
|
||||
makeNativeMethod(
|
||||
"enableInteropViewManagerClassLookUpOptimizationIOS",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableInteropViewManagerClassLookUpOptimizationIOS),
|
||||
makeNativeMethod(
|
||||
"enableLayoutAnimationsOnAndroid",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnAndroid),
|
||||
@@ -822,9 +797,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"fuseboxNetworkInspectionEnabled",
|
||||
JReactNativeFeatureFlagsCxxInterop::fuseboxNetworkInspectionEnabled),
|
||||
makeNativeMethod(
|
||||
"preparedTextCacheSize",
|
||||
JReactNativeFeatureFlagsCxxInterop::preparedTextCacheSize),
|
||||
makeNativeMethod(
|
||||
"traceTurboModulePromiseRejectionsOnAndroid",
|
||||
JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid),
|
||||
|
||||
+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<<70de16b94b14f0e7de235f72e1566abe>>
|
||||
* @generated SignedSource<<bdf1914ba3b7ac5e86d028c69f5073be>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -93,9 +93,6 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool enableIOSViewClipToPaddingBox(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool enableInteropViewManagerClassLookUpOptimizationIOS(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool enableLayoutAnimationsOnAndroid(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
@@ -162,9 +159,6 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool fuseboxNetworkInspectionEnabled(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static double preparedTextCacheSize(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool traceTurboModulePromiseRejectionsOnAndroid(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
|
||||
+6
-2
@@ -9,7 +9,9 @@
|
||||
|
||||
#include <hermes/hermes.h>
|
||||
|
||||
namespace facebook::jsi::jni {
|
||||
namespace facebook {
|
||||
namespace jsi {
|
||||
namespace jni {
|
||||
|
||||
void HermesSamplingProfiler::enable(jni::alias_ref<jclass>) {
|
||||
auto* hermesAPI =
|
||||
@@ -41,4 +43,6 @@ void HermesSamplingProfiler::registerNatives() {
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace facebook::jsi::jni
|
||||
} // namespace jni
|
||||
} // namespace jsi
|
||||
} // namespace facebook
|
||||
|
||||
+6
-2
@@ -11,7 +11,9 @@
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <jsi/jsi.h>
|
||||
|
||||
namespace facebook::jsi::jni {
|
||||
namespace facebook {
|
||||
namespace jsi {
|
||||
namespace jni {
|
||||
|
||||
namespace jni = ::facebook::jni;
|
||||
|
||||
@@ -31,6 +33,8 @@ class HermesSamplingProfiler : public jni::JavaClass<HermesSamplingProfiler> {
|
||||
HermesSamplingProfiler();
|
||||
};
|
||||
|
||||
} // namespace facebook::jsi::jni
|
||||
} // namespace jni
|
||||
} // namespace jsi
|
||||
} // namespace facebook
|
||||
|
||||
#endif /* HERMESSAMPLINGPROFILER_H_ */
|
||||
|
||||
@@ -120,7 +120,8 @@ Pod::Spec.new do |s|
|
||||
ss.subspec "view" do |sss|
|
||||
sss.dependency "React-renderercss"
|
||||
sss.dependency "Yoga"
|
||||
sss.source_files = podspec_sources(["react/renderer/components/view/*.{m,mm,cpp,h}", "react/renderer/components/view/platform/cxx/**/*.{m,mm,cpp,h}"], ["react/renderer/components/view/*.{h}", "react/renderer/components/view/platform/cxx/**/*.{h}"])
|
||||
sss.source_files = podspec_sources("react/renderer/components/view/**/*.{m,mm,cpp,h}", "react/renderer/components/view/**/*.{h}")
|
||||
sss.exclude_files = "react/renderer/components/view/tests", "react/renderer/components/view/platform/android", "react/renderer/components/view/platform/windows"
|
||||
sss.header_dir = "react/renderer/components/view"
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
|
||||
namespace facebook::jsc {
|
||||
namespace facebook {
|
||||
namespace jsc {
|
||||
|
||||
namespace detail {
|
||||
class ArgsConverter;
|
||||
@@ -1581,4 +1582,5 @@ std::unique_ptr<jsi::Runtime> makeJSCRuntime() {
|
||||
return std::make_unique<JSCRuntime>();
|
||||
}
|
||||
|
||||
} // namespace facebook::jsc
|
||||
} // namespace jsc
|
||||
} // namespace facebook
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
#include <jsi/jsi.h>
|
||||
#include <memory.h>
|
||||
|
||||
namespace facebook::jsc {
|
||||
namespace facebook {
|
||||
namespace jsc {
|
||||
|
||||
std::unique_ptr<jsi::Runtime> makeJSCRuntime();
|
||||
|
||||
} // namespace facebook::jsc
|
||||
} // namespace jsc
|
||||
} // namespace facebook
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include <jsinspector-modern/RuntimeTarget.h>
|
||||
#include <jsinspector-modern/tracing/PerformanceTracer.h>
|
||||
|
||||
#include <concepts>
|
||||
#include <deque>
|
||||
@@ -325,156 +324,6 @@ void consoleAssert(
|
||||
#include "ForwardingConsoleMethods.def"
|
||||
#undef FORWARDING_CONSOLE_METHOD
|
||||
|
||||
/*
|
||||
* Attempt to call String() on the given value.
|
||||
*/
|
||||
std::optional<std::string> stringifyJsiValue(
|
||||
const jsi::Value& value,
|
||||
jsi::Runtime& runtime) {
|
||||
auto String = runtime.global().getPropertyAsFunction(runtime, "String");
|
||||
return String.call(runtime, value).asString(runtime).utf8(runtime);
|
||||
};
|
||||
|
||||
/**
|
||||
* Call innerFn and forward any arguments to the original console method
|
||||
* named methodName, if possible.
|
||||
*/
|
||||
auto forwardToOriginalConsole(
|
||||
std::shared_ptr<jsi::Object> originalConsole,
|
||||
const char* methodName,
|
||||
CallableAsHostFunction auto innerFn) {
|
||||
return [originalConsole = std::move(originalConsole),
|
||||
innerFn = std::move(innerFn),
|
||||
methodName](
|
||||
jsi::Runtime& runtime,
|
||||
const jsi::Value& thisVal,
|
||||
const jsi::Value* args,
|
||||
size_t count) {
|
||||
jsi::Value retVal = innerFn(runtime, thisVal, args, count);
|
||||
if (originalConsole) {
|
||||
auto val = originalConsole->getProperty(runtime, methodName);
|
||||
if (val.isObject()) {
|
||||
auto obj = val.getObject(runtime);
|
||||
if (obj.isFunction(runtime)) {
|
||||
auto func = obj.getFunction(runtime);
|
||||
func.callWithThis(runtime, *originalConsole, args, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::move(retVal);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Recording a marker on a timeline of the Performance instrumentation.
|
||||
* No actual logging is provided by definition.
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/console/timeStamp_static
|
||||
* https://developer.chrome.com/docs/devtools/performance/extension#inject_your_data_with_consoletimestamp
|
||||
*/
|
||||
void consoleTimeStamp(
|
||||
jsi::Runtime& runtime,
|
||||
const jsi::Value* arguments,
|
||||
size_t argumentsCount) {
|
||||
auto& performanceTracer = tracing::PerformanceTracer::getInstance();
|
||||
if (!performanceTracer.isTracing() || argumentsCount == 0) {
|
||||
// If not tracing, just early return to avoid the cost of parsing.
|
||||
return;
|
||||
}
|
||||
|
||||
const jsi::Value& labelArgument = arguments[0];
|
||||
std::string label;
|
||||
if (labelArgument.isString()) {
|
||||
label = labelArgument.asString(runtime).utf8(runtime);
|
||||
} else {
|
||||
auto maybeStringifiedLabel = stringifyJsiValue(labelArgument, runtime);
|
||||
if (maybeStringifiedLabel) {
|
||||
label = std::move(*maybeStringifiedLabel);
|
||||
} else {
|
||||
// Do not record this entry: unable to reliably stringify the label.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
auto now = HighResTimeStamp::now();
|
||||
std::optional<tracing::ConsoleTimeStampEntry> start;
|
||||
if (argumentsCount >= 2) {
|
||||
const jsi::Value& startArgument = arguments[1];
|
||||
if (startArgument.isNumber()) {
|
||||
start =
|
||||
HighResTimeStamp::fromDOMHighResTimeStamp(startArgument.asNumber());
|
||||
} else if (startArgument.isString()) {
|
||||
start = startArgument.asString(runtime).utf8(runtime);
|
||||
} else if (startArgument.isUndefined()) {
|
||||
start = now;
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<tracing::ConsoleTimeStampEntry> end;
|
||||
if (argumentsCount >= 3) {
|
||||
const jsi::Value& endArgument = arguments[2];
|
||||
if (endArgument.isNumber()) {
|
||||
end = HighResTimeStamp::fromDOMHighResTimeStamp(endArgument.asNumber());
|
||||
} else if (endArgument.isString()) {
|
||||
end = endArgument.asString(runtime).utf8(runtime);
|
||||
} else if (endArgument.isUndefined()) {
|
||||
end = now;
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<std::string> trackName;
|
||||
std::optional<std::string> trackGroup;
|
||||
std::optional<tracing::ConsoleTimeStampColor> color;
|
||||
if (argumentsCount >= 4) {
|
||||
const jsi::Value& trackNameArgument = arguments[3];
|
||||
if (trackNameArgument.isString()) {
|
||||
trackName = trackNameArgument.asString(runtime).utf8(runtime);
|
||||
}
|
||||
}
|
||||
if (argumentsCount >= 5) {
|
||||
const jsi::Value& trackGroupArgument = arguments[4];
|
||||
if (trackGroupArgument.isString()) {
|
||||
trackGroup = trackGroupArgument.asString(runtime).utf8(runtime);
|
||||
}
|
||||
}
|
||||
if (argumentsCount >= 6) {
|
||||
const jsi::Value& colorArgument = arguments[5];
|
||||
if (colorArgument.isString()) {
|
||||
color = tracing::getConsoleTimeStampColorFromString(
|
||||
colorArgument.asString(runtime).utf8(runtime));
|
||||
}
|
||||
}
|
||||
|
||||
performanceTracer.reportTimeStamp(
|
||||
label, start, end, trackName, trackGroup, color);
|
||||
}
|
||||
|
||||
/*
|
||||
* Installs console.timeStamp and manages the forwarding to the original console
|
||||
* object, if available.
|
||||
*/
|
||||
void installConsoleTimeStamp(
|
||||
jsi::Runtime& runtime,
|
||||
std::shared_ptr<jsi::Object> originalConsole,
|
||||
jsi::Object& consoleObject) {
|
||||
consoleObject.setProperty(
|
||||
runtime,
|
||||
"timeStamp",
|
||||
jsi::Function::createFromHostFunction(
|
||||
runtime,
|
||||
jsi::PropNameID::forAscii(runtime, "timeStamp"),
|
||||
0,
|
||||
forwardToOriginalConsole(
|
||||
originalConsole,
|
||||
"timeStamp",
|
||||
[](jsi::Runtime& runtime,
|
||||
const jsi::Value& /*thisVal*/,
|
||||
const jsi::Value* args,
|
||||
size_t count) {
|
||||
consoleTimeStamp(runtime, args, count);
|
||||
return jsi::Value::undefined();
|
||||
})));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void RuntimeTarget::installConsoleHandler() {
|
||||
@@ -519,6 +368,33 @@ void RuntimeTarget::installConsoleHandler() {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call innerFn and forward any arguments to the original console method
|
||||
* named methodName, if possible.
|
||||
*/
|
||||
auto forwardToOriginalConsole = [originalConsole](
|
||||
const char* methodName,
|
||||
CallableAsHostFunction auto innerFn) {
|
||||
return [originalConsole, innerFn = std::move(innerFn), methodName](
|
||||
jsi::Runtime& runtime,
|
||||
const jsi::Value& thisVal,
|
||||
const jsi::Value* args,
|
||||
size_t count) {
|
||||
jsi::Value retVal = innerFn(runtime, thisVal, args, count);
|
||||
if (originalConsole) {
|
||||
auto val = originalConsole->getProperty(runtime, methodName);
|
||||
if (val.isObject()) {
|
||||
auto obj = val.getObject(runtime);
|
||||
if (obj.isFunction(runtime)) {
|
||||
auto func = obj.getFunction(runtime);
|
||||
func.callWithThis(runtime, *originalConsole, args, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Install a console method with the given name and body. The body receives
|
||||
* the usual JSI host function parameters plus a ConsoleState reference, a
|
||||
@@ -537,7 +413,6 @@ void RuntimeTarget::installConsoleHandler() {
|
||||
jsi::PropNameID::forAscii(runtime, methodName),
|
||||
0,
|
||||
forwardToOriginalConsole(
|
||||
originalConsole,
|
||||
methodName,
|
||||
[body = std::move(body), state, delegateExecutorSync](
|
||||
jsi::Runtime& runtime,
|
||||
@@ -591,11 +466,6 @@ void RuntimeTarget::installConsoleHandler() {
|
||||
*/
|
||||
installConsoleMethod("assert", consoleAssert);
|
||||
|
||||
/**
|
||||
* console.timeStamp
|
||||
*/
|
||||
installConsoleTimeStamp(runtime, originalConsole, console);
|
||||
|
||||
// Install forwarding console methods.
|
||||
#define FORWARDING_CONSOLE_METHOD(name, type) \
|
||||
installConsoleMethod(#name, console_##name);
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
# console.timeStamp API
|
||||
|
||||
[🏠 Home](../../../../../README.md)
|
||||
|
||||
The console.timeStamp API provides a way to record markers on the timeline of
|
||||
the Performance instrumentation.
|
||||
|
||||
The idea is to have a highly performant API for instrumenting React Native
|
||||
applications and surfacing the recorded timing data to performance tooling:
|
||||
Performance panel or Perfetto. This API should be explicitly designed to have
|
||||
minimal runtime overhead and expected to be used for instrumenting hot paths and
|
||||
profiling (production) builds.
|
||||
|
||||
See also:
|
||||
|
||||
- https://developer.mozilla.org/en-US/docs/Web/API/console/timeStamp_static
|
||||
- https://developer.chrome.com/docs/devtools/performance/extension#inject_your_data_with_consoletimestamp
|
||||
|
||||
## 🚀 Usage
|
||||
|
||||
The `console.timeStamp()` method can be called with various parameters to record
|
||||
markers on the performance timeline:
|
||||
|
||||
```javascript
|
||||
// Basic usage with just a label
|
||||
console.timeStamp('Click');
|
||||
|
||||
// Advanced usage with start and end markers
|
||||
console.timeStamp('Animation', performance.now(), performance.now() + 500);
|
||||
|
||||
// Full usage with all parameters
|
||||
console.timeStamp(
|
||||
'Animation', // label
|
||||
performance.now(), // start time
|
||||
performance.now() + 500, // end time
|
||||
'UI Animations', // track name
|
||||
'Main Thread', // track group
|
||||
'primary', // color
|
||||
);
|
||||
```
|
||||
|
||||
More examples are available on
|
||||
[Chrome DevTools website](https://developer.chrome.com/docs/devtools/performance/extension#consoletimestamp_api_examples).
|
||||
|
||||
### ⚙️ Parameters
|
||||
|
||||
1. `label` (required): A string label for the timestamp marker
|
||||
2. `start` (optional): A
|
||||
[DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp)
|
||||
or string marker for the start time
|
||||
3. `end` (optional): A
|
||||
[DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp)
|
||||
or string marker for the end time
|
||||
4. `trackName` (optional): A string specifying the track name
|
||||
5. `trackGroup` (optional): A string specifying the track group
|
||||
6. `color` (optional): A string specifying the color of the timestamp marker.
|
||||
Supported values depend on Performance instrumentation, for React Native
|
||||
DevTools, the supported values are listed in ConsoleTimeStamp.h.
|
||||
|
||||
## 📐 Design
|
||||
|
||||
The console.timeStamp API is a JSI Host Function that is installed as part of
|
||||
the Console interface when JavaScript Runtime target is registered with the
|
||||
jsinspector-modern stack.
|
||||
|
||||
To achieve minimal runtime costs:
|
||||
|
||||
- This API will not add or buffer Performance Entries that can be accessed or
|
||||
observed with PerformanceObserver.
|
||||
- This API won’t have any buffering implemented by design. The buffering may be
|
||||
implemented by the performance tooling, if needed.
|
||||
- This API will have limited validation and user feedback. All incorrect timing
|
||||
entries are expected to be ignored.
|
||||
|
||||
## 🩻 Visualization
|
||||
|
||||
With Chrome DevTools Performance panel integration:
|
||||
|
||||
- Marks (only `label` specified) are not reported to custom tracks. They are
|
||||
only reported as `"TimeStamp: <label>"` entries on the Timings track.
|
||||
- Measures (both start and end are defined) are reported to custom tracks, if
|
||||
specified.
|
||||
|
||||
## 🔗 Relationship with other systems
|
||||
|
||||
### Part of
|
||||
|
||||
- jsinspector-modern: The JavaScript debugger stack for React Native DevTools,
|
||||
which controls the lifetime of the Console interface for the targeted
|
||||
JavaScript Runtime.
|
||||
|
||||
### Used by this
|
||||
|
||||
- Performance Tracing System: The console.timeStamp API reports markers to the
|
||||
PerformanceTracer singleton, which is a Trace Event engine responsible for
|
||||
collection, storage and serialization of Performance timeline events.
|
||||
@@ -1,146 +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.
|
||||
*/
|
||||
|
||||
#include <folly/executors/QueuedImmediateExecutor.h>
|
||||
|
||||
#include "JsiIntegrationTest.h"
|
||||
#include "engines/JsiIntegrationTestHermesEngineAdapter.h"
|
||||
|
||||
#include <jsinspector-modern/tracing/PerformanceTracer.h>
|
||||
|
||||
using namespace ::testing;
|
||||
|
||||
namespace facebook::react::jsinspector_modern {
|
||||
|
||||
/**
|
||||
* A test fixture for the console.timeStamp API.
|
||||
*/
|
||||
class ConsoleTimeStampTest : public JsiIntegrationPortableTestBase<
|
||||
JsiIntegrationTestHermesEngineAdapter,
|
||||
folly::QueuedImmediateExecutor> {
|
||||
protected:
|
||||
size_t countNumberOfTimeStampEvents(
|
||||
tracing::PerformanceTracer& performanceTracer) {
|
||||
size_t count = 0;
|
||||
performanceTracer.collectEvents(
|
||||
[&count](const folly::dynamic& chunk) {
|
||||
auto event = chunk[0];
|
||||
if (event["name"] == "TimeStamp") {
|
||||
count++;
|
||||
}
|
||||
},
|
||||
1);
|
||||
return count;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, Installed) {
|
||||
auto result = eval("typeof console.timeStamp");
|
||||
auto& runtime = engineAdapter_->getRuntime();
|
||||
EXPECT_EQ(result.asString(runtime).utf8(runtime), "function");
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, RecordsEntriesWithJustLabel) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_TRUE(tracer.startTracing());
|
||||
|
||||
eval("console.timeStamp('test-label')");
|
||||
|
||||
EXPECT_TRUE(tracer.stopTracing());
|
||||
EXPECT_EQ(countNumberOfTimeStampEvents(tracer), 1);
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, RecordsEntriesWithSpecifiedTimestamps) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_TRUE(tracer.startTracing());
|
||||
|
||||
eval("console.timeStamp('test-range', 100, 200)");
|
||||
|
||||
EXPECT_TRUE(tracer.stopTracing());
|
||||
EXPECT_EQ(countNumberOfTimeStampEvents(tracer), 1);
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, RecordsEntriesWithMarkNames) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_TRUE(tracer.startTracing());
|
||||
|
||||
eval(
|
||||
"console.timeStamp('test-string-timestamps', 'start-marker', 'end-marker')");
|
||||
|
||||
EXPECT_TRUE(tracer.stopTracing());
|
||||
EXPECT_EQ(countNumberOfTimeStampEvents(tracer), 1);
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, KeepsEntriesWithUnknownMarkNames) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_TRUE(tracer.startTracing());
|
||||
|
||||
eval(
|
||||
"console.timeStamp('test-string-timestamps', 'start-marker', 'end-marker')");
|
||||
|
||||
EXPECT_TRUE(tracer.stopTracing());
|
||||
EXPECT_EQ(countNumberOfTimeStampEvents(tracer), 1);
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, DoesNotThrowIfNotTracing) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_FALSE(tracer.stopTracing());
|
||||
|
||||
// Call console.timeStamp - should be a no-op when not tracing
|
||||
eval("console.timeStamp('test-no-tracing')");
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, SurvivesInvalidArguments) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_TRUE(tracer.startTracing());
|
||||
|
||||
// Won't be logged, no label specified.
|
||||
eval("console.timeStamp()");
|
||||
// Will be logged - undefined will be stringified.
|
||||
eval("console.timeStamp(undefined)");
|
||||
// Will be logged - function will be stringified.
|
||||
eval("console.timeStamp(() => {})");
|
||||
// Will be logged - 123 will be stringified.
|
||||
eval("console.timeStamp(123)");
|
||||
// Will be logged - start will default to an empty string.
|
||||
eval("console.timeStamp('label', {})");
|
||||
|
||||
EXPECT_TRUE(tracer.stopTracing());
|
||||
EXPECT_EQ(countNumberOfTimeStampEvents(tracer), 4);
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, InvalidTrackNameIsIgnored) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_TRUE(tracer.startTracing());
|
||||
|
||||
eval("console.timeStamp('label', 0, 1, {})");
|
||||
|
||||
EXPECT_TRUE(tracer.stopTracing());
|
||||
EXPECT_EQ(countNumberOfTimeStampEvents(tracer), 1);
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, InvalidTrackGroupIsIgnored) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_TRUE(tracer.startTracing());
|
||||
|
||||
eval("console.timeStamp('label', 0, 1, 'trackName', {})");
|
||||
|
||||
EXPECT_TRUE(tracer.stopTracing());
|
||||
EXPECT_EQ(countNumberOfTimeStampEvents(tracer), 1);
|
||||
}
|
||||
|
||||
TEST_F(ConsoleTimeStampTest, InvalidColorIsIgnored) {
|
||||
auto& tracer = tracing::PerformanceTracer::getInstance();
|
||||
EXPECT_TRUE(tracer.startTracing());
|
||||
|
||||
eval("console.timeStamp('test', 100, 200, 'FooTrack', 'BarGroup', 'red')");
|
||||
|
||||
EXPECT_TRUE(tracer.stopTracing());
|
||||
EXPECT_EQ(countNumberOfTimeStampEvents(tracer), 1);
|
||||
}
|
||||
|
||||
} // namespace facebook::react::jsinspector_modern
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user