mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
215
Commits
+4
-1
@@ -47,7 +47,10 @@ 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
|
||||
|
||||
emoji=true
|
||||
|
||||
@@ -102,4 +105,4 @@ untyped-import
|
||||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.273.1
|
||||
^0.274.0
|
||||
|
||||
@@ -26,9 +26,6 @@ runs:
|
||||
- name: Lint code
|
||||
shell: bash
|
||||
run: ./.github/workflow-scripts/exec_swallow_error.sh yarn lint --format junit -o ./reports/junit/eslint/results.xml
|
||||
- name: Lint java
|
||||
shell: bash
|
||||
run: ./.github/workflow-scripts/exec_swallow_error.sh yarn lint-java --check
|
||||
- name: Lint file structure
|
||||
shell: bash
|
||||
run: ./.github/workflow-scripts/lint_files.sh
|
||||
|
||||
@@ -13,9 +13,6 @@ export GITHUB_REPO=-react-native
|
||||
|
||||
echo flow
|
||||
npm run flow-check --silent --json
|
||||
|
||||
echo google-java-format
|
||||
node scripts/lint-java.js --diff
|
||||
} | node private/react-native-bots/code-analysis-bot.js
|
||||
|
||||
STATUS=$?
|
||||
|
||||
@@ -140,27 +140,6 @@ jobs:
|
||||
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
|
||||
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
|
||||
|
||||
build_android:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs: [set_release_type]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build Android
|
||||
uses: ./.github/actions/build-android
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
|
||||
build_npm_package:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs:
|
||||
@@ -170,7 +149,6 @@ jobs:
|
||||
build_hermes_macos,
|
||||
build_hermesc_linux,
|
||||
build_hermesc_windows,
|
||||
build_android,
|
||||
prebuild_apple_dependencies,
|
||||
prebuild_react_native_core,
|
||||
]
|
||||
|
||||
@@ -14,8 +14,8 @@ jobs:
|
||||
with:
|
||||
repo-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
days-before-stale: 180
|
||||
stale-issue-message: 'This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
stale-issue-message: 'This issue is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.'
|
||||
stale-pr-message: 'This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.'
|
||||
close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'
|
||||
close-pr-message: 'This PR was closed because it has been stalled for 7 days with no activity.'
|
||||
exempt-issue-labels: 'Help Wanted :octocat:, Good first issue, Never gets stale, Issue: Author Provided Repro'
|
||||
|
||||
@@ -139,7 +139,6 @@ vendor/
|
||||
/packages/react-native/React/FBReactNativeSpec/
|
||||
/packages/react-native-codegen/lib
|
||||
/packages/react-native-codegen/tmp/
|
||||
/packages/react-native/ReactCommon/react/renderer/components/rncore/
|
||||
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
|
||||
/**/RCTThirdPartyFabricComponentsProvider.*
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+260
-5117
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -124,7 +124,7 @@ if (project.findProperty("react.internal.useHermesNightly")?.toString()?.toBoole
|
||||
configurations.all {
|
||||
resolutionStrategy.dependencySubstitution {
|
||||
substitute(project(":packages:react-native:ReactAndroid:hermes-engine"))
|
||||
.using(module("com.facebook.react:hermes-android:0.0.0-+"))
|
||||
.using(module("com.facebook.react:hermes-android:0.+"))
|
||||
.because("Users opted to use hermes from nightly")
|
||||
}
|
||||
}
|
||||
|
||||
+7
-8
@@ -17,7 +17,6 @@
|
||||
"format": "npm run prettier && npm run clang-format",
|
||||
"featureflags": "yarn --cwd packages/react-native featureflags",
|
||||
"lint-ci": "./.github/workflow-scripts/analyze_code.sh && yarn shellcheck",
|
||||
"lint-java": "node ./scripts/lint-java.js",
|
||||
"lint-markdown": "markdownlint-cli2 2>&1",
|
||||
"lint": "eslint --max-warnings 0 .",
|
||||
"prettier": "prettier --write \"./**/*.{js,md,yml,ts,tsx}\"",
|
||||
@@ -55,11 +54,11 @@
|
||||
"@react-native/metro-babel-transformer": "0.80.0-main",
|
||||
"@react-native/metro-config": "0.80.0-main",
|
||||
"@tsconfig/node22": "22.0.2",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react": "^19.1.0",
|
||||
"@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.28.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",
|
||||
@@ -77,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.28.1",
|
||||
"flow-bin": "^0.273.1",
|
||||
"flow-api-translator": "0.29.0",
|
||||
"flow-bin": "^0.274.0",
|
||||
"glob": "^7.1.1",
|
||||
"hermes-eslint": "0.28.1",
|
||||
"hermes-transform": "0.28.1",
|
||||
"hermes-eslint": "0.29.0",
|
||||
"hermes-transform": "0.29.0",
|
||||
"inquirer": "^7.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-config": "^29.7.0",
|
||||
@@ -97,7 +96,7 @@
|
||||
"node-fetch": "^2.2.0",
|
||||
"nullthrows": "^1.1.1",
|
||||
"prettier": "2.8.8",
|
||||
"prettier-plugin-hermes-parser": "0.28.1",
|
||||
"prettier-plugin-hermes-parser": "0.29.0",
|
||||
"react": "19.1.0",
|
||||
"react-test-renderer": "19.1.0",
|
||||
"rimraf": "^3.0.2",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@generated SignedSource<<9ada78dff12dcfc7937c8934261f47f4>>
|
||||
Git revision: 68cfd0ae84acb0ed8e47b421afd64ae3b0b5b727
|
||||
@generated SignedSource<<cf5be4596d1f07e220b710fc286d02fa>>
|
||||
Git revision: d95ac13bf0ab64a5e6c2eb18eb138587063b9c34
|
||||
Built with --nohooks: false
|
||||
Is local checkout: false
|
||||
Remote URL: https://github.com/facebook/react-native-devtools-frontend
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
import type {JsonPagesListResponse} from '../inspector-proxy/types';
|
||||
import type {BrowserLauncher} from '../types/BrowserLauncher';
|
||||
|
||||
import DefaultBrowserLauncher from '../utils/DefaultBrowserLauncher';
|
||||
import {fetchJson, requestLocal} from './FetchUtils';
|
||||
@@ -22,7 +23,7 @@ const PAGES_POLLING_DELAY = 2100;
|
||||
jest.useFakeTimers();
|
||||
|
||||
describe('enableStandaloneFuseboxShell experiment', () => {
|
||||
const BrowserLauncherWithFuseboxShell = {
|
||||
const BrowserLauncherWithFuseboxShell: BrowserLauncher = {
|
||||
...DefaultBrowserLauncher,
|
||||
unstable_showFuseboxShell: () => {
|
||||
throw new Error('Not implemented');
|
||||
|
||||
@@ -81,6 +81,7 @@ export default function createDevMiddleware({
|
||||
projectRoot,
|
||||
serverBaseUrl,
|
||||
logger,
|
||||
// $FlowFixMe[prop-missing]
|
||||
unstable_browserLauncher = DefaultBrowserLauncher,
|
||||
unstable_eventReporter,
|
||||
unstable_experiments: experimentConfig = {},
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"babel-plugin-syntax-hermes-parser": "0.28.1",
|
||||
"hermes-eslint": "0.28.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.28.1",
|
||||
"hermes-eslint": "0.28.1"
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.0",
|
||||
"hermes-eslint": "0.29.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 22.14.0"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.10.1"
|
||||
agp = "8.11.0"
|
||||
gson = "2.8.9"
|
||||
guava = "31.0.1-jre"
|
||||
javapoet = "1.13.0"
|
||||
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 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.tasks.internal
|
||||
|
||||
import javax.inject.Inject
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.CopySpec
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.*
|
||||
|
||||
/**
|
||||
* A task that takes care of extracting gflags from a source folder/zip and preparing it to be
|
||||
* consumed by the NDK. This task will also take care of applying the mapping for gflags parameters.
|
||||
*/
|
||||
abstract class PrepareGflagsTask : DefaultTask() {
|
||||
|
||||
@get:InputFiles abstract val gflagsPath: ConfigurableFileCollection
|
||||
@get:InputDirectory abstract val gflagsThirdPartyPath: DirectoryProperty
|
||||
@get:Input abstract val gflagsVersion: Property<String>
|
||||
|
||||
@get:OutputDirectory abstract val outputDir: DirectoryProperty
|
||||
|
||||
@get:Inject abstract val fs: FileSystemOperations
|
||||
|
||||
@TaskAction
|
||||
fun taskAction() {
|
||||
val commonCopyConfig: (action: CopySpec) -> Unit = { action ->
|
||||
action.from(gflagsPath)
|
||||
action.from(gflagsThirdPartyPath)
|
||||
action.duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
action.includeEmptyDirs = false
|
||||
action.into(outputDir)
|
||||
}
|
||||
|
||||
fs.copy { action ->
|
||||
commonCopyConfig(action)
|
||||
action.include(
|
||||
"gflags-${gflagsVersion.get()}/src/*.h",
|
||||
"gflags-${gflagsVersion.get()}/src/*.cc",
|
||||
"CMakeLists.txt")
|
||||
action.filesMatching("*/src/*") { matchedFile ->
|
||||
matchedFile.path = "gflags/${matchedFile.name}"
|
||||
}
|
||||
}
|
||||
|
||||
fs.copy { action ->
|
||||
commonCopyConfig(action)
|
||||
action.include("gflags-${gflagsVersion.get()}/src/gflags_declare.h.in")
|
||||
action.filesMatching("*/src/*") { matchedFile ->
|
||||
matchedFile.filter { line ->
|
||||
// Replace all placeholders with appropriate values
|
||||
// see https://github.com/gflags/gflags/blob/v2.2.0/src/gflags_declare.h.in
|
||||
line
|
||||
.replace(Regex("@GFLAGS_NAMESPACE@"), "gflags")
|
||||
.replace(
|
||||
Regex(
|
||||
"@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@"),
|
||||
"1")
|
||||
.replace(Regex("@([A-Z0-9_]+)@"), "1")
|
||||
}
|
||||
matchedFile.path = "gflags/${matchedFile.name.removeSuffix(".in")}"
|
||||
}
|
||||
}
|
||||
|
||||
fs.copy { action ->
|
||||
commonCopyConfig(action)
|
||||
action.include("gflags-${gflagsVersion.get()}/src/config.h.in")
|
||||
action.filesMatching("*/src/*") { matchedFile ->
|
||||
matchedFile.filter { line -> line.replace(Regex("^#cmakedefine"), "//cmakedefine") }
|
||||
matchedFile.path = "gflags/${matchedFile.name.removeSuffix(".in")}"
|
||||
}
|
||||
}
|
||||
|
||||
fs.copy { action ->
|
||||
commonCopyConfig(action)
|
||||
action.include("gflags-${gflagsVersion.get()}/src/gflags_ns.h.in")
|
||||
action.filesMatching("*/src/*") { matchedFile ->
|
||||
matchedFile.filter { line ->
|
||||
line.replace(Regex("@ns@"), "google").replace(Regex("@NS@"), "google".uppercase())
|
||||
}
|
||||
matchedFile.path = "gflags/gflags_google.h"
|
||||
}
|
||||
}
|
||||
|
||||
fs.copy { action ->
|
||||
commonCopyConfig(action)
|
||||
action.include("gflags-${gflagsVersion.get()}/src/gflags.h.in")
|
||||
action.filesMatching("*/src/*") { matchedFile ->
|
||||
matchedFile.filter { line ->
|
||||
line
|
||||
.replace(Regex("@GFLAGS_ATTRIBUTE_UNUSED@"), "")
|
||||
.replace(Regex("@INCLUDE_GFLAGS_NS_H@"), "#include \"gflags/gflags_google.h\"")
|
||||
}
|
||||
matchedFile.path = "gflags/${matchedFile.name.removeSuffix(".in")}"
|
||||
}
|
||||
}
|
||||
|
||||
fs.copy { action ->
|
||||
commonCopyConfig(action)
|
||||
action.include("gflags-${gflagsVersion.get()}/src/gflags_completions.h.in")
|
||||
action.filesMatching("*/src/*") { matchedFile ->
|
||||
matchedFile.filter { line -> line.replace(Regex("@GFLAGS_NAMESPACE@"), "gflags") }
|
||||
matchedFile.path = "gflags/${matchedFile.name.removeSuffix(".in")}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -126,6 +126,8 @@ internal object NdkConfiguratorUtils {
|
||||
): Pair<List<String>, List<String>> {
|
||||
val excludes = mutableListOf<String>()
|
||||
val includes = mutableListOf<String>()
|
||||
|
||||
// note: libjsctooling.so is kept here for backward compatibility.
|
||||
when {
|
||||
hermesEnabled -> {
|
||||
excludes.add("**/libjsc.so")
|
||||
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* 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.tasks.internal
|
||||
|
||||
import com.facebook.react.tests.createProject
|
||||
import com.facebook.react.tests.createTestTask
|
||||
import java.io.*
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
|
||||
class PrepareGflagsTaskTest {
|
||||
|
||||
@get:Rule val tempFolder = TemporaryFolder()
|
||||
|
||||
@Test(expected = IllegalStateException::class)
|
||||
fun prepareGflagsTask_withMissingConfiguration_fails() {
|
||||
val task = createTestTask<PrepareGflagsTask>()
|
||||
|
||||
task.taskAction()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun prepareGflagsTask_copiesCMakefile() {
|
||||
val gflagspath = tempFolder.newFolder("gflagspath")
|
||||
val output = tempFolder.newFolder("output")
|
||||
val project = createProject()
|
||||
val gflagsThirdPartyPath = File(project.projectDir, "src/main/jni/third-party/gflags/")
|
||||
val task =
|
||||
createTestTask<PrepareGflagsTask>(project = project) {
|
||||
it.gflagsPath.setFrom(gflagspath)
|
||||
it.gflagsThirdPartyPath.set(gflagsThirdPartyPath)
|
||||
it.gflagsVersion.set("1.0.0")
|
||||
it.outputDir.set(output)
|
||||
}
|
||||
File(gflagsThirdPartyPath, "CMakeLists.txt").apply {
|
||||
parentFile.mkdirs()
|
||||
createNewFile()
|
||||
}
|
||||
task.taskAction()
|
||||
|
||||
assertThat(output.listFiles()!!.any { it.name == "CMakeLists.txt" }).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun prepareGflagsTask_copiesSourceCodeAndHeaders() {
|
||||
val gflagspath = tempFolder.newFolder("gflagspath")
|
||||
val gflagsThirdPartyPath = tempFolder.newFolder("gflagspath/jni")
|
||||
val output = tempFolder.newFolder("output")
|
||||
val task =
|
||||
createTestTask<PrepareGflagsTask> {
|
||||
it.gflagsPath.setFrom(gflagspath)
|
||||
it.gflagsThirdPartyPath.set(gflagsThirdPartyPath)
|
||||
it.gflagsVersion.set("1.0.0")
|
||||
it.outputDir.set(output)
|
||||
}
|
||||
File(gflagspath, "gflags-1.0.0/src/gflags.cc").apply {
|
||||
parentFile.mkdirs()
|
||||
createNewFile()
|
||||
}
|
||||
File(gflagspath, "gflags-1.0.0/src/util.h").apply {
|
||||
parentFile.mkdirs()
|
||||
createNewFile()
|
||||
}
|
||||
|
||||
task.taskAction()
|
||||
|
||||
assertThat(File(output, "gflags/gflags.cc").exists()).isTrue()
|
||||
assertThat(File(output, "gflags/util.h").exists()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun prepareGflagsTask_replacesTokenCorrectly() {
|
||||
val gflagspath = tempFolder.newFolder("gflagspath")
|
||||
val gflagsThirdPartyPath = tempFolder.newFolder("gflagspath/jni")
|
||||
val output = tempFolder.newFolder("output")
|
||||
val task =
|
||||
createTestTask<PrepareGflagsTask> {
|
||||
it.gflagsPath.setFrom(gflagspath)
|
||||
it.gflagsThirdPartyPath.set(gflagsThirdPartyPath)
|
||||
it.gflagsVersion.set("1.0.0")
|
||||
it.outputDir.set(output)
|
||||
}
|
||||
File(gflagspath, "gflags-1.0.0/src/gflags_declare.h.in").apply {
|
||||
parentFile.mkdirs()
|
||||
writeText(
|
||||
"""
|
||||
#define GFLAGS_NAMESPACE @GFLAGS_NAMESPACE@
|
||||
#include <string>
|
||||
#if @HAVE_STDINT_H@
|
||||
# include <stdint.h>
|
||||
#elif @HAVE_SYS_TYPES_H@
|
||||
# include <sys/types.h>
|
||||
#elif @HAVE_INTTYPES_H@
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace GFLAGS_NAMESPACE {
|
||||
|
||||
#if @GFLAGS_INTTYPES_FORMAT_C99@ // C99
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
#elif @GFLAGS_INTTYPES_FORMAT_BSD@ // BSD
|
||||
typedef int32_t int32;
|
||||
typedef u_int32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef u_int64_t uint64;
|
||||
#elif @GFLAGS_INTTYPES_FORMAT_VC7@ // Windows
|
||||
typedef __int32 int32;
|
||||
typedef unsigned __int32 uint32;
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
#else
|
||||
# error Do not know how to define a 32-bit integer quantity on your system
|
||||
#endif
|
||||
|
||||
} // namespace GFLAGS_NAMESPACE
|
||||
""")
|
||||
}
|
||||
File(gflagspath, "gflags-1.0.0/src/config.h.in").apply {
|
||||
parentFile.mkdirs()
|
||||
createNewFile()
|
||||
writeText("#cmakedefine")
|
||||
}
|
||||
File(gflagspath, "gflags-1.0.0/src/gflags_ns.h.in").apply {
|
||||
parentFile.mkdirs()
|
||||
createNewFile()
|
||||
writeText("@ns@ @NS@")
|
||||
}
|
||||
File(gflagspath, "gflags-1.0.0/src/gflags.h.in").apply {
|
||||
parentFile.mkdirs()
|
||||
createNewFile()
|
||||
writeText("@GFLAGS_ATTRIBUTE_UNUSED@\n@INCLUDE_GFLAGS_NS_H@")
|
||||
}
|
||||
File(gflagspath, "gflags-1.0.0/src/gflags_completions.h.in").apply {
|
||||
parentFile.mkdirs()
|
||||
createNewFile()
|
||||
writeText("@GFLAGS_NAMESPACE@")
|
||||
}
|
||||
|
||||
task.taskAction()
|
||||
|
||||
val declareFile = File(output, "gflags/gflags_declare.h")
|
||||
assertThat(declareFile.exists()).isTrue()
|
||||
assertEquals(
|
||||
declareFile.readText(),
|
||||
"""
|
||||
#define GFLAGS_NAMESPACE gflags
|
||||
#include <string>
|
||||
#if 1
|
||||
# include <stdint.h>
|
||||
#elif 1
|
||||
# include <sys/types.h>
|
||||
#elif 1
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace GFLAGS_NAMESPACE {
|
||||
|
||||
#if 1 // C99
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
#elif 1 // BSD
|
||||
typedef int32_t int32;
|
||||
typedef u_int32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef u_int64_t uint64;
|
||||
#elif 1 // Windows
|
||||
typedef __int32 int32;
|
||||
typedef unsigned __int32 uint32;
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
#else
|
||||
# error Do not know how to define a 32-bit integer quantity on your system
|
||||
#endif
|
||||
|
||||
} // namespace GFLAGS_NAMESPACE
|
||||
""")
|
||||
|
||||
val configFile = File(output, "gflags/config.h")
|
||||
assertThat(configFile.exists()).isTrue()
|
||||
assertEquals(configFile.readText(), "//cmakedefine")
|
||||
|
||||
val nsFile = File(output, "gflags/gflags_google.h")
|
||||
assertThat(nsFile.exists()).isTrue()
|
||||
assertEquals(nsFile.readText(), "google GOOGLE")
|
||||
|
||||
val gflagsFile = File(output, "gflags/gflags.h")
|
||||
assertThat(gflagsFile.exists()).isTrue()
|
||||
assertEquals(gflagsFile.readText(), "\n#include \"gflags/gflags_google.h\"")
|
||||
|
||||
val completionsFile = File(output, "gflags/gflags_completions.h")
|
||||
assertThat(completionsFile.exists()).isTrue()
|
||||
assertEquals(completionsFile.readText(), "gflags")
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
],
|
||||
"dependencies": {},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react": "^19.1.0",
|
||||
"react": "*",
|
||||
"react-native": "*"
|
||||
},
|
||||
|
||||
@@ -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.28.1",
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.0",
|
||||
"babel-plugin-transform-flow-enums": "^0.0.2",
|
||||
"react-refresh": "^0.14.0"
|
||||
},
|
||||
|
||||
+2
-1
@@ -15,8 +15,9 @@ const lazyImports = require('./lazy-imports');
|
||||
|
||||
const EXCLUDED_FIRST_PARTY_PATHS = [
|
||||
/[/\\]node_modules[/\\]/,
|
||||
/[/\\]packages[/\\]react-native(?:-fantom)?[/\\]/,
|
||||
/[/\\]packages[/\\]react-native[/\\]/,
|
||||
/[/\\]packages[/\\]virtualized-lists[/\\]/,
|
||||
/[/\\]private[/\\]react-native-fantom[/\\]/,
|
||||
];
|
||||
|
||||
function isTypeScriptSource(fileName) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@react-native/babel-preset": "0.80.0-main",
|
||||
"hermes-parser": "0.28.1",
|
||||
"hermes-parser": "0.29.0",
|
||||
"nullthrows": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
+136
-10
@@ -40,6 +40,10 @@ 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();
|
||||
@@ -51,18 +55,57 @@ 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
|
||||
@@ -99,6 +142,10 @@ 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();
|
||||
@@ -152,6 +199,10 @@ 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();
|
||||
@@ -202,6 +253,10 @@ 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();
|
||||
@@ -213,6 +268,9 @@ folly::dynamic DimensionPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (marginBack != oldProps->marginBack) {
|
||||
result[\\"marginBack\\"] = toDynamic(marginBack);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -248,6 +306,10 @@ 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();
|
||||
@@ -295,6 +357,10 @@ 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();
|
||||
@@ -306,7 +372,13 @@ 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
|
||||
@@ -342,6 +414,10 @@ 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();
|
||||
@@ -391,6 +467,10 @@ 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();
|
||||
@@ -446,6 +526,10 @@ 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();
|
||||
@@ -520,6 +604,10 @@ 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();
|
||||
@@ -532,7 +620,7 @@ folly::dynamic ImagePropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -571,6 +659,10 @@ 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();
|
||||
@@ -628,6 +720,10 @@ 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();
|
||||
@@ -678,6 +774,10 @@ 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();
|
||||
@@ -689,6 +789,9 @@ folly::dynamic MixedPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (mixedProp != oldProps->mixedProp) {
|
||||
result[\\"mixedProp\\"] = mixedProp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -728,6 +831,10 @@ 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();
|
||||
@@ -740,7 +847,7 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
}
|
||||
|
||||
if (color != oldProps->color) {
|
||||
@@ -752,10 +859,7 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
result[\\"point\\"] = toDynamic(point);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -792,6 +896,10 @@ 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();
|
||||
@@ -841,6 +949,10 @@ 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();
|
||||
@@ -852,8 +964,17 @@ 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
|
||||
@@ -889,6 +1010,10 @@ 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();
|
||||
@@ -901,10 +1026,7 @@ folly::dynamic PointPropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
result[\\"startPoint\\"] = toDynamic(startPoint);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -942,6 +1064,10 @@ 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,6 +16,7 @@ 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>
|
||||
@@ -87,6 +88,16 @@ 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) {
|
||||
@@ -102,6 +113,12 @@ 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) {
|
||||
@@ -115,6 +132,17 @@ 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) {
|
||||
@@ -134,6 +162,12 @@ 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) {
|
||||
@@ -165,6 +199,8 @@ 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
|
||||
};
|
||||
@@ -203,6 +239,8 @@ class BooleanPropNativeComponentViewProps final : public ViewProps {
|
||||
bool disabledNullable{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -241,6 +279,8 @@ class ColorPropNativeComponentViewProps final : public ViewProps {
|
||||
SharedColor tintColor{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -265,6 +305,7 @@ 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 {
|
||||
@@ -279,6 +320,8 @@ class DimensionPropNativeComponentViewProps final : public ViewProps {
|
||||
YGValue marginBack{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -316,6 +359,8 @@ class EdgeInsetsPropNativeComponentViewProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -360,6 +405,12 @@ 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) {
|
||||
@@ -391,6 +442,17 @@ 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;
|
||||
@@ -402,6 +464,8 @@ 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
|
||||
};
|
||||
@@ -439,6 +503,8 @@ 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
|
||||
};
|
||||
@@ -476,6 +542,8 @@ 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
|
||||
};
|
||||
@@ -519,6 +587,8 @@ class FloatPropsNativeComponentViewProps final : public ViewProps {
|
||||
Float blurRadiusNullable{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -557,6 +627,8 @@ class ImagePropNativeComponentViewProps final : public ViewProps {
|
||||
ImageSource thumbImage{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -596,6 +668,8 @@ 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
|
||||
};
|
||||
@@ -633,6 +707,8 @@ 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
|
||||
};
|
||||
@@ -670,6 +746,8 @@ 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
|
||||
};
|
||||
@@ -713,6 +791,8 @@ class MultiNativePropNativeComponentViewProps final : public ViewProps {
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -750,6 +830,8 @@ class NoPropsNoEventsNativeComponentViewProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -798,6 +880,12 @@ 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) {
|
||||
@@ -820,6 +908,15 @@ 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};
|
||||
@@ -827,6 +924,21 @@ 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) {
|
||||
@@ -862,8 +974,24 @@ 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) {
|
||||
@@ -879,10 +1007,28 @@ 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) {
|
||||
@@ -905,6 +1051,12 @@ 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;
|
||||
@@ -917,6 +1069,8 @@ class ObjectPropsNativeComponentProps final : public ViewProps {
|
||||
ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -955,6 +1109,8 @@ class PointPropNativeComponentViewProps final : public ViewProps {
|
||||
Point startPoint{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -993,6 +1149,8 @@ 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
|
||||
};
|
||||
|
||||
+136
-10
@@ -40,6 +40,10 @@ 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();
|
||||
@@ -51,18 +55,57 @@ 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
|
||||
@@ -99,6 +142,10 @@ 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();
|
||||
@@ -152,6 +199,10 @@ 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();
|
||||
@@ -202,6 +253,10 @@ 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();
|
||||
@@ -213,6 +268,9 @@ folly::dynamic DimensionPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (marginBack != oldProps->marginBack) {
|
||||
result[\\"marginBack\\"] = toDynamic(marginBack);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -248,6 +306,10 @@ 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();
|
||||
@@ -295,6 +357,10 @@ 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();
|
||||
@@ -306,7 +372,13 @@ 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
|
||||
@@ -342,6 +414,10 @@ 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();
|
||||
@@ -391,6 +467,10 @@ 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();
|
||||
@@ -446,6 +526,10 @@ 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();
|
||||
@@ -520,6 +604,10 @@ 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();
|
||||
@@ -532,7 +620,7 @@ folly::dynamic ImagePropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -571,6 +659,10 @@ 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();
|
||||
@@ -628,6 +720,10 @@ 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();
|
||||
@@ -678,6 +774,10 @@ 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();
|
||||
@@ -689,6 +789,9 @@ folly::dynamic MixedPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (mixedProp != oldProps->mixedProp) {
|
||||
result[\\"mixedProp\\"] = mixedProp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -728,6 +831,10 @@ 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();
|
||||
@@ -740,7 +847,7 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
}
|
||||
|
||||
if (color != oldProps->color) {
|
||||
@@ -752,10 +859,7 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
result[\\"point\\"] = toDynamic(point);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -792,6 +896,10 @@ 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();
|
||||
@@ -841,6 +949,10 @@ 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();
|
||||
@@ -852,8 +964,17 @@ 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
|
||||
@@ -889,6 +1010,10 @@ 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();
|
||||
@@ -901,10 +1026,7 @@ folly::dynamic PointPropNativeComponentViewProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
result[\\"startPoint\\"] = toDynamic(startPoint);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -942,6 +1064,10 @@ 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,6 +16,7 @@ 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>
|
||||
@@ -87,6 +88,16 @@ 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) {
|
||||
@@ -102,6 +113,12 @@ 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) {
|
||||
@@ -115,6 +132,17 @@ 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) {
|
||||
@@ -134,6 +162,12 @@ 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) {
|
||||
@@ -165,6 +199,8 @@ 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
|
||||
};
|
||||
@@ -203,6 +239,8 @@ class BooleanPropNativeComponentViewProps final : public ViewProps {
|
||||
bool disabledNullable{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -241,6 +279,8 @@ class ColorPropNativeComponentViewProps final : public ViewProps {
|
||||
SharedColor tintColor{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -265,6 +305,7 @@ 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 {
|
||||
@@ -279,6 +320,8 @@ class DimensionPropNativeComponentViewProps final : public ViewProps {
|
||||
YGValue marginBack{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -316,6 +359,8 @@ class EdgeInsetsPropNativeComponentViewProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -360,6 +405,12 @@ 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) {
|
||||
@@ -391,6 +442,17 @@ 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;
|
||||
@@ -402,6 +464,8 @@ 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
|
||||
};
|
||||
@@ -439,6 +503,8 @@ 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
|
||||
};
|
||||
@@ -476,6 +542,8 @@ 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
|
||||
};
|
||||
@@ -519,6 +587,8 @@ class FloatPropsNativeComponentViewProps final : public ViewProps {
|
||||
Float blurRadiusNullable{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -557,6 +627,8 @@ class ImagePropNativeComponentViewProps final : public ViewProps {
|
||||
ImageSource thumbImage{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -596,6 +668,8 @@ 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
|
||||
};
|
||||
@@ -633,6 +707,8 @@ 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
|
||||
};
|
||||
@@ -670,6 +746,8 @@ 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
|
||||
};
|
||||
@@ -713,6 +791,8 @@ class MultiNativePropNativeComponentViewProps final : public ViewProps {
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -750,6 +830,8 @@ class NoPropsNoEventsNativeComponentViewProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -798,6 +880,12 @@ 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) {
|
||||
@@ -820,6 +908,15 @@ 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};
|
||||
@@ -827,6 +924,21 @@ 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) {
|
||||
@@ -862,8 +974,24 @@ 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) {
|
||||
@@ -879,10 +1007,28 @@ 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) {
|
||||
@@ -905,6 +1051,12 @@ 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;
|
||||
@@ -917,6 +1069,8 @@ class ObjectPropsNativeComponentProps final : public ViewProps {
|
||||
ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -955,6 +1109,8 @@ class PointPropNativeComponentViewProps final : public ViewProps {
|
||||
Point startPoint{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -993,6 +1149,8 @@ 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.28.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.28.1",
|
||||
"hermes-estree": "0.29.0",
|
||||
"micromatch": "^4.0.4",
|
||||
"prettier": "2.8.8",
|
||||
"rimraf": "^3.0.2"
|
||||
|
||||
@@ -73,9 +73,9 @@ const ALL_GENERATORS = {
|
||||
generateViewConfigJs: generateViewConfigJs.generate,
|
||||
};
|
||||
|
||||
type FilesOutput = Map<string, string>;
|
||||
export type FilesOutput = Map<string, string>;
|
||||
|
||||
type GenerateFunction = (
|
||||
export type GenerateFunction = (
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
packageName?: string,
|
||||
@@ -83,11 +83,11 @@ type GenerateFunction = (
|
||||
headerPrefix?: string,
|
||||
) => FilesOutput;
|
||||
|
||||
type LibraryGeneratorsFunctions = $ReadOnly<{
|
||||
export type LibraryGeneratorsFunctions = $ReadOnly<{
|
||||
[string]: Array<GenerateFunction>,
|
||||
}>;
|
||||
|
||||
type LibraryOptions = $ReadOnly<{
|
||||
export type LibraryOptions = $ReadOnly<{
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
outputDirectory: string,
|
||||
@@ -97,13 +97,13 @@ type LibraryOptions = $ReadOnly<{
|
||||
libraryGenerators?: LibraryGeneratorsFunctions,
|
||||
}>;
|
||||
|
||||
type SchemasOptions = $ReadOnly<{
|
||||
export type SchemasOptions = $ReadOnly<{
|
||||
schemas: {[string]: SchemaType},
|
||||
outputDirectory: string,
|
||||
supportedApplePlatforms?: {[string]: {[string]: boolean}},
|
||||
}>;
|
||||
|
||||
type LibraryGenerators =
|
||||
export type LibraryGenerators =
|
||||
| 'componentsAndroid'
|
||||
| 'componentsIOS'
|
||||
| 'descriptors'
|
||||
@@ -116,14 +116,14 @@ type LibraryGenerators =
|
||||
| 'modulesCxx'
|
||||
| 'modulesIOS';
|
||||
|
||||
type SchemasGenerators = 'providerIOS';
|
||||
export type SchemasGenerators = 'providerIOS';
|
||||
|
||||
type LibraryConfig = $ReadOnly<{
|
||||
export type LibraryConfig = $ReadOnly<{
|
||||
generators: Array<LibraryGenerators>,
|
||||
test?: boolean,
|
||||
}>;
|
||||
|
||||
type SchemasConfig = $ReadOnly<{
|
||||
export type SchemasConfig = $ReadOnly<{
|
||||
generators: Array<SchemasGenerators>,
|
||||
test?: boolean,
|
||||
}>;
|
||||
|
||||
+1
@@ -245,6 +245,7 @@ function getLocalImports(
|
||||
return;
|
||||
case 'DimensionPrimitive':
|
||||
imports.add('#include <yoga/Yoga.h>');
|
||||
imports.add('#include <react/renderer/core/graphicsConversions.h>');
|
||||
return;
|
||||
default:
|
||||
(name: empty);
|
||||
|
||||
+34
-7
@@ -105,7 +105,7 @@ function generatePropsDiffString(
|
||||
case 'ImageSourcePrimitive':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = ${prop.name}.toDynamic();
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
case 'ImageRequestPrimitive':
|
||||
// Shouldn't be used in props
|
||||
@@ -115,24 +115,47 @@ function generatePropsDiffString(
|
||||
case 'PointPrimitive':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult["x"] = ${prop.name}.x;
|
||||
pointResult["y"] = ${prop.name}.y;
|
||||
result["${prop.name}"] = pointResult;
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
case 'EdgeInsetsPrimitive':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
case 'DimensionPrimitive':
|
||||
// TODO: Implement diffProps for complex types
|
||||
return '';
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = toDynamic(${prop.name});
|
||||
}`;
|
||||
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 '';
|
||||
@@ -142,6 +165,10 @@ 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,6 +85,8 @@ class ${className} final${extendClasses} {
|
||||
${props}
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -115,6 +117,12 @@ 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 = ({
|
||||
@@ -122,11 +130,13 @@ const IntEnumTemplate = ({
|
||||
values,
|
||||
fromCases,
|
||||
toCases,
|
||||
toDynamicCases,
|
||||
}: {
|
||||
enumName: string,
|
||||
values: string,
|
||||
fromCases: string,
|
||||
toCases: string,
|
||||
toDynamicCases: string,
|
||||
}) =>
|
||||
`
|
||||
enum class ${enumName} { ${values} };
|
||||
@@ -144,19 +154,39 @@ 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) {
|
||||
@@ -168,6 +198,12 @@ 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 = ({
|
||||
@@ -401,6 +437,16 @@ 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(', ');
|
||||
@@ -410,6 +456,7 @@ function generateIntEnum(
|
||||
values: valueVariables,
|
||||
fromCases,
|
||||
toCases,
|
||||
toDynamicCases,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -701,12 +748,30 @@ 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,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
+192
-10
@@ -40,6 +40,10 @@ 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();
|
||||
@@ -51,18 +55,57 @@ 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
|
||||
@@ -98,6 +141,10 @@ 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();
|
||||
@@ -109,6 +156,9 @@ folly::dynamic ArrayPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (nativePrimitives != oldProps->nativePrimitives) {
|
||||
result[\\"nativePrimitives\\"] = toDynamic(nativePrimitives);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -144,6 +194,10 @@ 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();
|
||||
@@ -193,6 +247,10 @@ 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();
|
||||
@@ -242,6 +300,10 @@ 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();
|
||||
@@ -288,6 +350,10 @@ 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();
|
||||
@@ -338,6 +404,10 @@ 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();
|
||||
@@ -349,6 +419,9 @@ folly::dynamic DimensionPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (marginBack != oldProps->marginBack) {
|
||||
result[\\"marginBack\\"] = toDynamic(marginBack);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -389,6 +462,10 @@ 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();
|
||||
@@ -458,6 +535,10 @@ 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();
|
||||
@@ -507,6 +588,10 @@ 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();
|
||||
@@ -556,6 +641,10 @@ 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();
|
||||
@@ -602,6 +691,10 @@ 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();
|
||||
@@ -648,6 +741,10 @@ 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();
|
||||
@@ -694,6 +791,10 @@ 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();
|
||||
@@ -716,6 +817,10 @@ 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();
|
||||
@@ -770,6 +875,10 @@ 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();
|
||||
@@ -840,6 +949,10 @@ 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();
|
||||
@@ -852,7 +965,7 @@ folly::dynamic ImagePropNativeComponentProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -889,6 +1002,10 @@ 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();
|
||||
@@ -900,6 +1017,9 @@ folly::dynamic InsetsPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (contentInset != oldProps->contentInset) {
|
||||
result[\\"contentInset\\"] = toDynamic(contentInset);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -935,6 +1055,10 @@ 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();
|
||||
@@ -946,6 +1070,9 @@ folly::dynamic Int32EnumPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (maxInterval != oldProps->maxInterval) {
|
||||
result[\\"maxInterval\\"] = toDynamic(maxInterval);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -983,6 +1110,10 @@ 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();
|
||||
@@ -1040,6 +1171,10 @@ 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();
|
||||
@@ -1090,6 +1225,10 @@ 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();
|
||||
@@ -1101,6 +1240,9 @@ folly::dynamic MixedPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (mixedProp != oldProps->mixedProp) {
|
||||
result[\\"mixedProp\\"] = mixedProp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1140,6 +1282,10 @@ 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();
|
||||
@@ -1152,7 +1298,7 @@ folly::dynamic ImageColorPropNativeComponentProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (thumbImage != oldProps->thumbImage) {
|
||||
result[\\"thumbImage\\"] = thumbImage.toDynamic();
|
||||
result[\\"thumbImage\\"] = toDynamic(thumbImage);
|
||||
}
|
||||
|
||||
if (color != oldProps->color) {
|
||||
@@ -1164,10 +1310,7 @@ folly::dynamic ImageColorPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
result[\\"point\\"] = toDynamic(point);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1204,6 +1347,10 @@ 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();
|
||||
@@ -1251,6 +1398,10 @@ 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();
|
||||
@@ -1262,6 +1413,9 @@ folly::dynamic ObjectPropsProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (objectProp != oldProps->objectProp) {
|
||||
result[\\"objectProp\\"] = toDynamic(objectProp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1297,6 +1451,10 @@ 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();
|
||||
@@ -1309,10 +1467,7 @@ folly::dynamic PointPropNativeComponentProps::getDiffProps(
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
result[\\"startPoint\\"] = toDynamic(startPoint);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1349,6 +1504,10 @@ 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();
|
||||
@@ -1360,6 +1519,9 @@ folly::dynamic StringEnumPropsNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (alignment != oldProps->alignment) {
|
||||
result[\\"alignment\\"] = toDynamic(alignment);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1396,6 +1558,10 @@ 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();
|
||||
@@ -1449,6 +1615,10 @@ 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();
|
||||
@@ -1474,6 +1644,10 @@ 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();
|
||||
@@ -1523,6 +1697,10 @@ 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();
|
||||
@@ -1548,6 +1726,10 @@ 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,6 +16,7 @@ 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>
|
||||
@@ -86,6 +87,16 @@ 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) {
|
||||
@@ -101,6 +112,12 @@ 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) {
|
||||
@@ -113,6 +130,16 @@ 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) {
|
||||
@@ -128,6 +155,12 @@ 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) {
|
||||
@@ -140,6 +173,16 @@ 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) {
|
||||
@@ -155,6 +198,12 @@ 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) {
|
||||
@@ -167,6 +216,16 @@ 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) {
|
||||
@@ -182,6 +241,12 @@ 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) {
|
||||
@@ -217,6 +282,8 @@ 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
|
||||
};
|
||||
@@ -254,6 +321,18 @@ 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) {
|
||||
@@ -277,6 +356,12 @@ 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) {
|
||||
@@ -296,6 +381,8 @@ 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
|
||||
};
|
||||
@@ -333,6 +420,8 @@ 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
|
||||
};
|
||||
@@ -371,6 +460,8 @@ class ColorPropNativeComponentProps final : public ViewProps {
|
||||
SharedColor tintColor{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -408,6 +499,8 @@ class CommandNativeComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -445,6 +538,8 @@ 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
|
||||
};
|
||||
@@ -469,6 +564,7 @@ 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 {
|
||||
@@ -483,6 +579,8 @@ class DimensionPropNativeComponentProps final : public ViewProps {
|
||||
YGValue marginBack{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -525,6 +623,8 @@ 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
|
||||
};
|
||||
@@ -562,6 +662,8 @@ 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
|
||||
};
|
||||
@@ -599,6 +701,8 @@ 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
|
||||
};
|
||||
@@ -636,6 +740,8 @@ class InterfaceOnlyComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -673,6 +779,8 @@ class ExcludedAndroidComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -710,6 +818,8 @@ class ExcludedAndroidIosComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -747,6 +857,8 @@ class ExcludedIosComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -761,6 +873,8 @@ 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
|
||||
};
|
||||
@@ -803,6 +917,8 @@ 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
|
||||
};
|
||||
@@ -841,6 +957,8 @@ class ImagePropNativeComponentProps final : public ViewProps {
|
||||
ImageSource thumbImage{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -879,6 +997,8 @@ class InsetsPropNativeComponentProps final : public ViewProps {
|
||||
EdgeInsets contentInset{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -933,6 +1053,16 @@ 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;
|
||||
@@ -943,6 +1073,8 @@ 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
|
||||
};
|
||||
@@ -982,6 +1114,8 @@ 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
|
||||
};
|
||||
@@ -1019,6 +1153,8 @@ 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
|
||||
};
|
||||
@@ -1056,6 +1192,8 @@ 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
|
||||
};
|
||||
@@ -1099,6 +1237,8 @@ class ImageColorPropNativeComponentProps final : public ViewProps {
|
||||
Point point{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1136,6 +1276,8 @@ class NoPropsNoEventsComponentProps final : public ViewProps {
|
||||
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1182,6 +1324,12 @@ 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) {
|
||||
@@ -1200,8 +1348,26 @@ 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) {
|
||||
@@ -1217,10 +1383,28 @@ 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) {
|
||||
@@ -1244,8 +1428,24 @@ 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) {
|
||||
@@ -1261,8 +1461,24 @@ 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) {
|
||||
@@ -1278,8 +1494,24 @@ 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) {
|
||||
@@ -1295,6 +1527,12 @@ 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) {
|
||||
@@ -1307,6 +1545,16 @@ 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) {
|
||||
@@ -1322,6 +1570,12 @@ 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};
|
||||
@@ -1337,6 +1591,29 @@ 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) {
|
||||
@@ -1403,6 +1680,12 @@ 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;
|
||||
@@ -1413,6 +1696,8 @@ class ObjectPropsProps final : public ViewProps {
|
||||
ObjectPropsObjectPropStruct objectProp{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1451,6 +1736,8 @@ class PointPropNativeComponentProps final : public ViewProps {
|
||||
Point startPoint{};
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ComponentName getDiffPropsImplementationTarget() const override;
|
||||
|
||||
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
||||
#endif
|
||||
};
|
||||
@@ -1496,6 +1783,12 @@ 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;
|
||||
@@ -1506,6 +1799,8 @@ 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
|
||||
};
|
||||
@@ -1544,6 +1839,8 @@ 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
|
||||
};
|
||||
@@ -1581,6 +1878,8 @@ 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
|
||||
};
|
||||
@@ -1595,6 +1894,8 @@ 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
|
||||
};
|
||||
@@ -1632,6 +1933,8 @@ 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
|
||||
};
|
||||
@@ -1646,6 +1949,8 @@ 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
|
||||
};
|
||||
|
||||
+4
-1
@@ -18,7 +18,10 @@ const flowFixtures = require('../../flow/modules/__test_fixtures__/fixtures.js')
|
||||
const tsFixtures = require('../../typescript/modules/__test_fixtures__/fixtures.js');
|
||||
const {compareSnaps, compareTsArraySnaps} = require('../compareSnaps.js');
|
||||
|
||||
const flowExtraCases = ['PROMISE_WITH_COMMONLY_USED_TYPES'];
|
||||
const flowExtraCases = [
|
||||
'NATIVE_MODULE_WITH_OPAQUE_TYPES',
|
||||
'PROMISE_WITH_COMMONLY_USED_TYPES',
|
||||
];
|
||||
const tsExtraCases = [
|
||||
'NATIVE_MODULE_WITH_ARRAY2_WITH_ALIAS',
|
||||
'NATIVE_MODULE_WITH_ARRAY2_WITH_UNION_AND_TOUPLE',
|
||||
|
||||
+32
@@ -691,6 +691,37 @@ export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
|
||||
`;
|
||||
|
||||
const NATIVE_MODULE_WITH_OPAQUE_TYPES = `
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {TurboModule} from '../RCTExport';
|
||||
import * as TurboModuleRegistry from '../TurboModuleRegistry';
|
||||
|
||||
export opaque type Task = mixed;
|
||||
export opaque type TimeoutID = number;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+createTask: (callback: () => void) => Task;
|
||||
+cancelTask: (task: Task) => void;
|
||||
|
||||
+setTimeout: (callback: () => void) => TimeoutID;
|
||||
+clearTimeout: (timeoutID: TimeoutID) => void;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
|
||||
`;
|
||||
|
||||
const ANDROID_ONLY_NATIVE_MODULE = `
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
@@ -976,6 +1007,7 @@ module.exports = {
|
||||
NATIVE_MODULE_WITH_UNION,
|
||||
NATIVE_MODULE_WITH_UNION_RETURN_TYPES,
|
||||
NATIVE_MODULE_WITH_EVENT_EMITTERS,
|
||||
NATIVE_MODULE_WITH_OPAQUE_TYPES,
|
||||
EMPTY_NATIVE_MODULE,
|
||||
ANDROID_ONLY_NATIVE_MODULE,
|
||||
IOS_ONLY_NATIVE_MODULE,
|
||||
|
||||
+102
@@ -2187,6 +2187,108 @@ exports[`RN Codegen Flow Parser can generate fixture NATIVE_MODULE_WITH_OBJECT_W
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`RN Codegen Flow Parser can generate fixture NATIVE_MODULE_WITH_OPAQUE_TYPES 1`] = `
|
||||
"{
|
||||
'modules': {
|
||||
'NativeSampleTurboModule': {
|
||||
'type': 'NativeModule',
|
||||
'aliasMap': {},
|
||||
'enumMap': {},
|
||||
'spec': {
|
||||
'eventEmitters': [],
|
||||
'methods': [
|
||||
{
|
||||
'name': 'createTask',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'FunctionTypeAnnotation',
|
||||
'returnTypeAnnotation': {
|
||||
'type': 'GenericObjectTypeAnnotation'
|
||||
},
|
||||
'params': [
|
||||
{
|
||||
'name': 'callback',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'FunctionTypeAnnotation',
|
||||
'returnTypeAnnotation': {
|
||||
'type': 'VoidTypeAnnotation'
|
||||
},
|
||||
'params': []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'cancelTask',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'FunctionTypeAnnotation',
|
||||
'returnTypeAnnotation': {
|
||||
'type': 'VoidTypeAnnotation'
|
||||
},
|
||||
'params': [
|
||||
{
|
||||
'name': 'task',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'GenericObjectTypeAnnotation'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'setTimeout',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'FunctionTypeAnnotation',
|
||||
'returnTypeAnnotation': {
|
||||
'type': 'NumberTypeAnnotation'
|
||||
},
|
||||
'params': [
|
||||
{
|
||||
'name': 'callback',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'FunctionTypeAnnotation',
|
||||
'returnTypeAnnotation': {
|
||||
'type': 'VoidTypeAnnotation'
|
||||
},
|
||||
'params': []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'clearTimeout',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'FunctionTypeAnnotation',
|
||||
'returnTypeAnnotation': {
|
||||
'type': 'VoidTypeAnnotation'
|
||||
},
|
||||
'params': [
|
||||
{
|
||||
'name': 'timeoutID',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'NumberTypeAnnotation'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
'moduleName': 'SampleTurboModule'
|
||||
}
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`RN Codegen Flow Parser can generate fixture NATIVE_MODULE_WITH_PARTIALS 1`] = `
|
||||
"{
|
||||
'modules': {
|
||||
|
||||
@@ -296,6 +296,7 @@ class FlowParser implements Parser {
|
||||
if (
|
||||
node.declaration != null &&
|
||||
(node.declaration.type === 'TypeAlias' ||
|
||||
node.declaration.type === 'OpaqueType' ||
|
||||
node.declaration.type === 'InterfaceDeclaration')
|
||||
) {
|
||||
types[node.declaration.id.name] = node.declaration;
|
||||
@@ -309,6 +310,7 @@ class FlowParser implements Parser {
|
||||
types[node.declaration.id.name] = node.declaration;
|
||||
} else if (
|
||||
node.type === 'TypeAlias' ||
|
||||
node.type === 'OpaqueType' ||
|
||||
node.type === 'InterfaceDeclaration' ||
|
||||
node.type === 'EnumDeclaration'
|
||||
) {
|
||||
@@ -543,6 +545,10 @@ class FlowParser implements Parser {
|
||||
}
|
||||
|
||||
nextNodeForTypeAlias(typeAnnotation: $FlowFixMe): $FlowFixMe {
|
||||
if (typeAnnotation.type === 'OpaqueType') {
|
||||
return typeAnnotation.impltype;
|
||||
}
|
||||
|
||||
return typeAnnotation.right;
|
||||
}
|
||||
|
||||
|
||||
@@ -1233,7 +1233,8 @@ function handleGenericTypeAnnotation(
|
||||
let node;
|
||||
|
||||
switch (resolvedTypeAnnotation.type) {
|
||||
case parser.typeAlias: {
|
||||
case parser.typeAlias:
|
||||
case 'OpaqueType': {
|
||||
typeResolutionStatus = getTypeResolutionStatus(
|
||||
'alias',
|
||||
typeAnnotation,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@react-native/codegen": "0.80.0-main"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react": "^19.1.0",
|
||||
"react": "*",
|
||||
"react-native": "*"
|
||||
},
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#import <React/RCTUIManager.h>
|
||||
#import <React/RCTViewManager.h>
|
||||
|
||||
#import <string>
|
||||
|
||||
static UIColor *UIColorFromHexString(const std::string hexString)
|
||||
{
|
||||
unsigned rgbValue = 0;
|
||||
|
||||
@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = min_supported_versions
|
||||
s.source = source
|
||||
s.source_files = "*.{m}"
|
||||
s.source_files = podspec_sources("*.{m}", "")
|
||||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
||||
s.header_dir = "RCTActionSheet"
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export type EventConfig<T> = {
|
||||
platformConfig?: PlatformConfig,
|
||||
};
|
||||
|
||||
export function attachNativeEvent(
|
||||
export function attachNativeEventImpl(
|
||||
viewRef: any,
|
||||
eventName: string,
|
||||
argMapping: $ReadOnlyArray<?Mapping>,
|
||||
@@ -181,7 +181,7 @@ export class AnimatedEvent {
|
||||
'Only native driven events need to be attached.',
|
||||
);
|
||||
|
||||
this._attachedEvent = attachNativeEvent(
|
||||
this._attachedEvent = attachNativeEventImpl(
|
||||
viewRef,
|
||||
eventName,
|
||||
this._argMapping,
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
|
||||
import AnimatedImplementation from './AnimatedImplementation';
|
||||
|
||||
export type {DecayAnimationConfig} from './animations/DecayAnimation';
|
||||
export type {SpringAnimationConfig} from './animations/SpringAnimation';
|
||||
export type {TimingAnimationConfig} from './animations/TimingAnimation';
|
||||
|
||||
export {default as FlatList} from './components/AnimatedFlatList';
|
||||
export {default as Image} from './components/AnimatedImage';
|
||||
export {default as ScrollView} from './components/AnimatedScrollView';
|
||||
@@ -33,6 +37,7 @@ export type {default as AnimatedNode} from './nodes/AnimatedNode';
|
||||
export type {default as AnimatedAddition} from './nodes/AnimatedAddition';
|
||||
export type {default as AnimatedDiffClamp} from './nodes/AnimatedDiffClamp';
|
||||
export type {default as AnimatedDivision} from './nodes/AnimatedDivision';
|
||||
export type {InterpolationConfigType as InterpolationConfig} from './nodes/AnimatedInterpolation';
|
||||
export type {default as AnimatedModulo} from './nodes/AnimatedModulo';
|
||||
export type {default as AnimatedMultiplication} from './nodes/AnimatedMultiplication';
|
||||
export type {default as AnimatedSubtraction} from './nodes/AnimatedSubtraction';
|
||||
|
||||
@@ -20,7 +20,7 @@ import type {DecayAnimationConfig} from './animations/DecayAnimation';
|
||||
import type {SpringAnimationConfig} from './animations/SpringAnimation';
|
||||
import type {TimingAnimationConfig} from './animations/TimingAnimation';
|
||||
|
||||
import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent';
|
||||
import {AnimatedEvent, attachNativeEventImpl} from './AnimatedEvent';
|
||||
import DecayAnimation from './animations/DecayAnimation';
|
||||
import SpringAnimation from './animations/SpringAnimation';
|
||||
import TimingAnimation from './animations/TimingAnimation';
|
||||
@@ -47,39 +47,39 @@ export type CompositeAnimation = {
|
||||
...
|
||||
};
|
||||
|
||||
const add = function (
|
||||
const addImpl = function (
|
||||
a: AnimatedNode | number,
|
||||
b: AnimatedNode | number,
|
||||
): AnimatedAddition {
|
||||
return new AnimatedAddition(a, b);
|
||||
};
|
||||
|
||||
const subtract = function (
|
||||
const subtractImpl = function (
|
||||
a: AnimatedNode | number,
|
||||
b: AnimatedNode | number,
|
||||
): AnimatedSubtraction {
|
||||
return new AnimatedSubtraction(a, b);
|
||||
};
|
||||
|
||||
const divide = function (
|
||||
const divideImpl = function (
|
||||
a: AnimatedNode | number,
|
||||
b: AnimatedNode | number,
|
||||
): AnimatedDivision {
|
||||
return new AnimatedDivision(a, b);
|
||||
};
|
||||
|
||||
const multiply = function (
|
||||
const multiplyImpl = function (
|
||||
a: AnimatedNode | number,
|
||||
b: AnimatedNode | number,
|
||||
): AnimatedMultiplication {
|
||||
return new AnimatedMultiplication(a, b);
|
||||
};
|
||||
|
||||
const modulo = function (a: AnimatedNode, modulus: number): AnimatedModulo {
|
||||
const moduloImpl = function (a: AnimatedNode, modulus: number): AnimatedModulo {
|
||||
return new AnimatedModulo(a, modulus);
|
||||
};
|
||||
|
||||
const diffClamp = function (
|
||||
const diffClampImpl = function (
|
||||
a: AnimatedNode,
|
||||
min: number,
|
||||
max: number,
|
||||
@@ -120,7 +120,7 @@ const maybeVectorAnim = function (
|
||||
const aY = anim((value: AnimatedValueXY).y, configY);
|
||||
// We use `stopTogether: false` here because otherwise tracking will break
|
||||
// because the second animation will get stopped before it can update.
|
||||
return parallel([aX, aY], {stopTogether: false});
|
||||
return parallelImpl([aX, aY], {stopTogether: false});
|
||||
} else if (value instanceof AnimatedColor) {
|
||||
const configR = {...config};
|
||||
const configG = {...config};
|
||||
@@ -146,12 +146,12 @@ const maybeVectorAnim = function (
|
||||
const aA = anim((value: AnimatedColor).a, configA);
|
||||
// We use `stopTogether: false` here because otherwise tracking will break
|
||||
// because the second animation will get stopped before it can update.
|
||||
return parallel([aR, aG, aB, aA], {stopTogether: false});
|
||||
return parallelImpl([aR, aG, aB, aA], {stopTogether: false});
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const spring = function (
|
||||
const springImpl = function (
|
||||
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
||||
config: SpringAnimationConfig,
|
||||
): CompositeAnimation {
|
||||
@@ -179,7 +179,7 @@ const spring = function (
|
||||
}
|
||||
};
|
||||
return (
|
||||
maybeVectorAnim(value, config, spring) || {
|
||||
maybeVectorAnim(value, config, springImpl) || {
|
||||
start: function (callback?: ?EndCallback): void {
|
||||
start(value, config, callback);
|
||||
},
|
||||
@@ -204,7 +204,7 @@ const spring = function (
|
||||
);
|
||||
};
|
||||
|
||||
const timing = function (
|
||||
const timingImpl = function (
|
||||
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
||||
config: TimingAnimationConfig,
|
||||
): CompositeAnimation {
|
||||
@@ -233,7 +233,7 @@ const timing = function (
|
||||
};
|
||||
|
||||
return (
|
||||
maybeVectorAnim(value, config, timing) || {
|
||||
maybeVectorAnim(value, config, timingImpl) || {
|
||||
start: function (callback?: ?EndCallback, isLooping?: boolean): void {
|
||||
start(value, {...config, isLooping}, callback);
|
||||
},
|
||||
@@ -258,7 +258,7 @@ const timing = function (
|
||||
);
|
||||
};
|
||||
|
||||
const decay = function (
|
||||
const decayImpl = function (
|
||||
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
||||
config: DecayAnimationConfig,
|
||||
): CompositeAnimation {
|
||||
@@ -275,7 +275,7 @@ const decay = function (
|
||||
};
|
||||
|
||||
return (
|
||||
maybeVectorAnim(value, config, decay) || {
|
||||
maybeVectorAnim(value, config, decayImpl) || {
|
||||
start: function (callback?: ?EndCallback): void {
|
||||
start(value, config, callback);
|
||||
},
|
||||
@@ -300,7 +300,7 @@ const decay = function (
|
||||
);
|
||||
};
|
||||
|
||||
const sequence = function (
|
||||
const sequenceImpl = function (
|
||||
animations: Array<CompositeAnimation>,
|
||||
): CompositeAnimation {
|
||||
let current = 0;
|
||||
@@ -363,7 +363,7 @@ type ParallelConfig = {
|
||||
stopTogether?: boolean,
|
||||
...
|
||||
};
|
||||
const parallel = function (
|
||||
const parallelImpl = function (
|
||||
animations: Array<CompositeAnimation>,
|
||||
config?: ?ParallelConfig,
|
||||
): CompositeAnimation {
|
||||
@@ -431,9 +431,9 @@ const parallel = function (
|
||||
return result;
|
||||
};
|
||||
|
||||
const delay = function (time: number): CompositeAnimation {
|
||||
const delayImpl = function (time: number): CompositeAnimation {
|
||||
// Would be nice to make a specialized implementation
|
||||
return timing(new AnimatedValue(0), {
|
||||
return timingImpl(new AnimatedValue(0), {
|
||||
toValue: 0,
|
||||
delay: time,
|
||||
duration: 0,
|
||||
@@ -441,13 +441,13 @@ const delay = function (time: number): CompositeAnimation {
|
||||
});
|
||||
};
|
||||
|
||||
const stagger = function (
|
||||
const staggerImpl = function (
|
||||
time: number,
|
||||
animations: Array<CompositeAnimation>,
|
||||
): CompositeAnimation {
|
||||
return parallel(
|
||||
return parallelImpl(
|
||||
animations.map((animation, i) => {
|
||||
return sequence([delay(time * i), animation]);
|
||||
return sequenceImpl([delayImpl(time * i), animation]);
|
||||
}),
|
||||
);
|
||||
};
|
||||
@@ -458,7 +458,7 @@ type LoopAnimationConfig = {
|
||||
...
|
||||
};
|
||||
|
||||
const loop = function (
|
||||
const loopImpl = function (
|
||||
animation: CompositeAnimation,
|
||||
// $FlowFixMe[prop-missing]
|
||||
{iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = {},
|
||||
@@ -514,7 +514,7 @@ const loop = function (
|
||||
};
|
||||
};
|
||||
|
||||
function forkEvent(
|
||||
function forkEventImpl(
|
||||
event: ?AnimatedEvent | ?Function,
|
||||
listener: Function,
|
||||
): AnimatedEvent | Function {
|
||||
@@ -531,7 +531,7 @@ function forkEvent(
|
||||
}
|
||||
}
|
||||
|
||||
function unforkEvent(
|
||||
function unforkEventImpl(
|
||||
event: ?AnimatedEvent | ?Function,
|
||||
listener: Function,
|
||||
): void {
|
||||
@@ -540,7 +540,7 @@ function unforkEvent(
|
||||
}
|
||||
}
|
||||
|
||||
const event = function <T>(
|
||||
const eventImpl = function <T>(
|
||||
argMapping: $ReadOnlyArray<?Mapping>,
|
||||
config: EventConfig<T>,
|
||||
): any {
|
||||
@@ -606,25 +606,25 @@ export default {
|
||||
* See https://reactnative.dev/docs/animated#node
|
||||
*/
|
||||
Node: AnimatedNode,
|
||||
decay,
|
||||
timing,
|
||||
spring,
|
||||
add,
|
||||
subtract,
|
||||
divide,
|
||||
multiply,
|
||||
modulo,
|
||||
diffClamp,
|
||||
delay,
|
||||
sequence,
|
||||
parallel,
|
||||
stagger,
|
||||
loop,
|
||||
event,
|
||||
decay: decayImpl,
|
||||
timing: timingImpl,
|
||||
spring: springImpl,
|
||||
add: addImpl,
|
||||
subtract: subtractImpl,
|
||||
divide: divideImpl,
|
||||
multiply: multiplyImpl,
|
||||
modulo: moduloImpl,
|
||||
diffClamp: diffClampImpl,
|
||||
delay: delayImpl,
|
||||
sequence: sequenceImpl,
|
||||
parallel: parallelImpl,
|
||||
stagger: staggerImpl,
|
||||
loop: loopImpl,
|
||||
event: eventImpl,
|
||||
createAnimatedComponent,
|
||||
attachNativeEvent,
|
||||
forkEvent,
|
||||
unforkEvent,
|
||||
attachNativeEvent: attachNativeEventImpl,
|
||||
forkEvent: forkEventImpl,
|
||||
unforkEvent: unforkEventImpl,
|
||||
|
||||
/**
|
||||
* Expose Event class, so it can be used as a type for type checkers.
|
||||
|
||||
@@ -17,7 +17,7 @@ import type {DecayAnimationConfig} from './animations/DecayAnimation';
|
||||
import type {SpringAnimationConfig} from './animations/SpringAnimation';
|
||||
import type {TimingAnimationConfig} from './animations/TimingAnimation';
|
||||
|
||||
import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent';
|
||||
import {AnimatedEvent, attachNativeEventImpl} from './AnimatedEvent';
|
||||
import AnimatedImplementation from './AnimatedImplementation';
|
||||
import createAnimatedComponent from './createAnimatedComponent';
|
||||
import AnimatedColor from './nodes/AnimatedColor';
|
||||
@@ -188,7 +188,7 @@ export default {
|
||||
loop,
|
||||
event: AnimatedImplementation.event,
|
||||
createAnimatedComponent,
|
||||
attachNativeEvent,
|
||||
attachNativeEvent: attachNativeEventImpl,
|
||||
forkEvent: AnimatedImplementation.forkEvent,
|
||||
unforkEvent: AnimatedImplementation.unforkEvent,
|
||||
Event: AnimatedEvent,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @fantom_flags cxxNativeAnimatedRemoveJsSync:*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
@@ -16,6 +17,8 @@ import ensureInstance from '../../../src/private/__tests__/utilities/ensureInsta
|
||||
import * as Fantom from '@react-native/fantom';
|
||||
import {createRef} from 'react';
|
||||
import {Animated, View, useAnimatedValue} from 'react-native';
|
||||
import {allowStyleProp} from 'react-native/Libraries/Animated/NativeAnimatedAllowlist';
|
||||
import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags';
|
||||
import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
|
||||
test('moving box by 100 points', () => {
|
||||
@@ -32,11 +35,9 @@ test('moving box by 100 points', () => {
|
||||
{
|
||||
width: 100,
|
||||
height: 100,
|
||||
backgroundColor: 'red',
|
||||
},
|
||||
{transform: [{translateX}]},
|
||||
]}
|
||||
testID="box"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -75,11 +76,15 @@ test('moving box by 100 points', () => {
|
||||
Fantom.unstable_produceFramesForDuration(500);
|
||||
|
||||
// Animation is completed now. C++ Animated will commit the final position to the shadow tree.
|
||||
expect(viewElement.getBoundingClientRect().x).toBe(100);
|
||||
if (ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()) {
|
||||
expect(viewElement.getBoundingClientRect().x).toBe(100);
|
||||
// TODO(T223344928): this shouldn't be neccessary
|
||||
Fantom.runWorkLoop();
|
||||
} else {
|
||||
expect(viewElement.getBoundingClientRect().x).toBe(0);
|
||||
Fantom.runWorkLoop(); // Animated still schedules a React state update for synchronisation to shadow tree
|
||||
}
|
||||
|
||||
// TODO: this shouldn't be needed but C++ Animated still schedules a React state update
|
||||
// for synchronisation, even though it doesn't need to.
|
||||
Fantom.runWorkLoop();
|
||||
expect(viewElement.getBoundingClientRect().x).toBe(100);
|
||||
});
|
||||
|
||||
@@ -143,6 +148,392 @@ test('animation driven by onScroll event', () => {
|
||||
|
||||
expect(transform.translateY).toBeCloseTo(100, 0.001);
|
||||
|
||||
// TODO(T226364699): this should `toBe(100)` but we are not syncing shadow tree yet.
|
||||
expect(viewElement.getBoundingClientRect().y).toBe(0);
|
||||
expect(viewElement.getBoundingClientRect().y).toBe(100);
|
||||
});
|
||||
|
||||
test('animated opacity', () => {
|
||||
let _opacity;
|
||||
let _opacityAnimation;
|
||||
const viewRef = createRef<HostInstance>();
|
||||
|
||||
function MyApp() {
|
||||
const opacity = useAnimatedValue(1);
|
||||
_opacity = opacity;
|
||||
return (
|
||||
<Animated.View
|
||||
ref={viewRef}
|
||||
style={[
|
||||
{
|
||||
width: 100,
|
||||
height: 100,
|
||||
opacity: opacity,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const root = Fantom.createRoot();
|
||||
|
||||
Fantom.runTask(() => {
|
||||
root.render(<MyApp />);
|
||||
});
|
||||
|
||||
const viewElement = ensureInstance(viewRef.current, ReactNativeElement);
|
||||
|
||||
expect(viewElement.getBoundingClientRect().x).toBe(0);
|
||||
|
||||
Fantom.runTask(() => {
|
||||
_opacityAnimation = Animated.timing(_opacity, {
|
||||
toValue: 0,
|
||||
duration: 30,
|
||||
useNativeDriver: true,
|
||||
}).start();
|
||||
});
|
||||
|
||||
Fantom.unstable_produceFramesForDuration(30);
|
||||
expect(Fantom.unstable_getDirectManipulationProps(viewElement).opacity).toBe(
|
||||
0,
|
||||
);
|
||||
|
||||
// TODO: this shouldn't be neccessary since animation should be stopped after duration
|
||||
Fantom.runTask(() => {
|
||||
_opacityAnimation?.stop();
|
||||
});
|
||||
|
||||
expect(root.getRenderedOutput({props: ['opacity']}).toJSX()).toEqual(
|
||||
<rn-view opacity="0" />,
|
||||
);
|
||||
});
|
||||
|
||||
test('moving box by 50 points with offset 10', () => {
|
||||
let _translateX;
|
||||
const viewRef = createRef<HostInstance>();
|
||||
|
||||
function MyApp() {
|
||||
const translateX = useAnimatedValue(0);
|
||||
_translateX = translateX;
|
||||
return (
|
||||
<Animated.View
|
||||
ref={viewRef}
|
||||
style={[
|
||||
{
|
||||
width: 100,
|
||||
height: 100,
|
||||
},
|
||||
{transform: [{translateX}]},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const root = Fantom.createRoot();
|
||||
|
||||
Fantom.runTask(() => {
|
||||
root.render(<MyApp />);
|
||||
});
|
||||
|
||||
const viewElement = ensureInstance(viewRef.current, ReactNativeElement);
|
||||
|
||||
expect(viewElement.getBoundingClientRect().x).toBe(0);
|
||||
|
||||
let finishValue = null;
|
||||
|
||||
Fantom.runTask(() => {
|
||||
Animated.timing(_translateX, {
|
||||
toValue: 50,
|
||||
duration: 1000, // 1 second
|
||||
useNativeDriver: true,
|
||||
}).start(result => {
|
||||
finishValue = result;
|
||||
});
|
||||
});
|
||||
|
||||
Fantom.runTask(() => {
|
||||
_translateX.setOffset(10);
|
||||
});
|
||||
|
||||
Fantom.unstable_produceFramesForDuration(500);
|
||||
|
||||
// shadow tree is not synchronised yet, position X is still 0.
|
||||
expect(viewElement.getBoundingClientRect().x).toBe(0);
|
||||
|
||||
expect(
|
||||
// $FlowFixMe[incompatible-use]
|
||||
Fantom.unstable_getDirectManipulationProps(viewElement).transform[0]
|
||||
.translateX,
|
||||
).toBeCloseTo(35, 0.001);
|
||||
|
||||
Fantom.unstable_produceFramesForDuration(500);
|
||||
|
||||
expect(
|
||||
// $FlowFixMe[incompatible-use]
|
||||
Fantom.unstable_getDirectManipulationProps(viewElement).transform[0]
|
||||
.translateX,
|
||||
).toBeCloseTo(60, 0.001);
|
||||
|
||||
if (ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()) {
|
||||
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
|
||||
<rn-view transform='[{"translateX": 60.000000}]' />,
|
||||
);
|
||||
// TODO(T223344928): this shouldn't be neccessary
|
||||
Fantom.runWorkLoop();
|
||||
} else {
|
||||
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
|
||||
<rn-view transform="[]" />,
|
||||
);
|
||||
Fantom.runWorkLoop(); // Animated still schedules a React state update for synchronisation to shadow tree
|
||||
}
|
||||
|
||||
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
|
||||
<rn-view transform='[{"translateX": 60.000000}]' />, // // must include offset.
|
||||
);
|
||||
|
||||
expect(finishValue?.finished).toBe(true);
|
||||
expect(finishValue?.value).toBe(50); // must not include offset.
|
||||
expect(finishValue?.offset).toBe(10);
|
||||
});
|
||||
|
||||
describe('Value.flattenOffset', () => {
|
||||
it('accumulates offset with onScroll value', () => {
|
||||
const scrollViewRef = createRef<HostInstance>();
|
||||
const viewRef = createRef<HostInstance>();
|
||||
let _onScroll;
|
||||
|
||||
function PressableWithNativeDriver() {
|
||||
_onScroll = useAnimatedValue(0);
|
||||
|
||||
return (
|
||||
<View style={{flex: 1}}>
|
||||
<Animated.View
|
||||
ref={viewRef}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
width: 10,
|
||||
height: 10,
|
||||
transform: [{translateY: _onScroll}],
|
||||
}}
|
||||
/>
|
||||
<Animated.ScrollView
|
||||
ref={scrollViewRef}
|
||||
onScroll={Animated.event(
|
||||
[
|
||||
{
|
||||
nativeEvent: {
|
||||
contentOffset: {
|
||||
y: _onScroll,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
{useNativeDriver: true},
|
||||
)}>
|
||||
<View style={{height: 1000, width: 100}} />
|
||||
</Animated.ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const root = Fantom.createRoot();
|
||||
Fantom.runTask(() => {
|
||||
root.render(<PressableWithNativeDriver />);
|
||||
});
|
||||
|
||||
const fn = jest.fn();
|
||||
Fantom.runTask(() => {
|
||||
_onScroll.addListener(fn);
|
||||
});
|
||||
|
||||
const scrollViewelement = ensureInstance(
|
||||
scrollViewRef.current,
|
||||
ReactNativeElement,
|
||||
);
|
||||
const viewElement = ensureInstance(viewRef.current, ReactNativeElement);
|
||||
|
||||
Fantom.scrollTo(scrollViewelement, {
|
||||
x: 0,
|
||||
y: 10,
|
||||
});
|
||||
|
||||
expect(fn).toBeCalledWith({value: 10});
|
||||
|
||||
Fantom.runTask(() => {
|
||||
_onScroll.setOffset(15);
|
||||
_onScroll.flattenOffset();
|
||||
});
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
|
||||
Fantom.runTask(() => {
|
||||
_onScroll.setOffset(15);
|
||||
});
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
|
||||
let transform =
|
||||
// $FlowFixMe[incompatible-use]
|
||||
Fantom.unstable_getDirectManipulationProps(viewElement).transform[0];
|
||||
|
||||
expect(transform.translateY).toBeCloseTo(40, 0.001);
|
||||
|
||||
// TODO(T223344928): this shouldn't be neccessary with cxxNativeAnimatedRemoveJsSync:true
|
||||
Fantom.runWorkLoop();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Value.extractOffset', () => {
|
||||
it('sets the offset value to the base value and resets the base value to zero', () => {
|
||||
const scrollViewRef = createRef<HostInstance>();
|
||||
const viewRef = createRef<HostInstance>();
|
||||
let _onScroll;
|
||||
|
||||
function PressableWithNativeDriver() {
|
||||
_onScroll = useAnimatedValue(0);
|
||||
|
||||
return (
|
||||
<View style={{flex: 1}}>
|
||||
<Animated.View
|
||||
ref={viewRef}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
width: 10,
|
||||
height: 10,
|
||||
transform: [{translateY: _onScroll}],
|
||||
}}
|
||||
/>
|
||||
<Animated.ScrollView
|
||||
ref={scrollViewRef}
|
||||
onScroll={Animated.event(
|
||||
[
|
||||
{
|
||||
nativeEvent: {
|
||||
contentOffset: {
|
||||
y: _onScroll,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
{useNativeDriver: true},
|
||||
)}>
|
||||
<View style={{height: 1000, width: 100}} />
|
||||
</Animated.ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const root = Fantom.createRoot();
|
||||
Fantom.runTask(() => {
|
||||
root.render(<PressableWithNativeDriver />);
|
||||
});
|
||||
|
||||
const fn = jest.fn();
|
||||
Fantom.runTask(() => {
|
||||
_onScroll.addListener(fn);
|
||||
});
|
||||
|
||||
const scrollViewelement = ensureInstance(
|
||||
scrollViewRef.current,
|
||||
ReactNativeElement,
|
||||
);
|
||||
const viewElement = ensureInstance(viewRef.current, ReactNativeElement);
|
||||
|
||||
Fantom.scrollTo(scrollViewelement, {
|
||||
x: 0,
|
||||
y: 10,
|
||||
});
|
||||
|
||||
expect(fn).toBeCalledWith({value: 10});
|
||||
|
||||
Fantom.runTask(() => {
|
||||
_onScroll.setOffset(15);
|
||||
// Sets offset to be 15 + 10 = 25 (this is not observable from JS).
|
||||
_onScroll.extractOffset();
|
||||
});
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
|
||||
let transform =
|
||||
// $FlowFixMe[incompatible-use]
|
||||
Fantom.unstable_getDirectManipulationProps(viewElement).transform[0];
|
||||
|
||||
// Animated value is now 0 but offset is 25. The final value is 25.
|
||||
expect(transform.translateY).toBeCloseTo(25, 0.001);
|
||||
|
||||
Fantom.runTask(() => {
|
||||
// Sets offset 35, overriding the previous `setOffset`.
|
||||
// Due to `extractOffset`, base value was restarted to 0.
|
||||
_onScroll.setOffset(35);
|
||||
});
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
|
||||
transform =
|
||||
// $FlowFixMe[incompatible-use]
|
||||
Fantom.unstable_getDirectManipulationProps(viewElement).transform[0];
|
||||
|
||||
// `extractOffset` resets value back to 0.
|
||||
// Previously we set offset to 35. The final value is 35.
|
||||
expect(transform.translateY).toBeCloseTo(35, 0.001);
|
||||
|
||||
// TODO(T223344928): this shouldn't be neccessary with cxxNativeAnimatedRemoveJsSync:true
|
||||
Fantom.runWorkLoop();
|
||||
});
|
||||
});
|
||||
|
||||
test('animate layout props', () => {
|
||||
const viewRef = createRef<HostInstance>();
|
||||
allowStyleProp('height');
|
||||
|
||||
let _animatedHeight;
|
||||
let _heightAnimation;
|
||||
|
||||
function MyApp() {
|
||||
const animatedHeight = useAnimatedValue(0);
|
||||
_animatedHeight = animatedHeight;
|
||||
return (
|
||||
<Animated.View
|
||||
ref={viewRef}
|
||||
style={[
|
||||
{
|
||||
width: 100,
|
||||
height: animatedHeight,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const root = Fantom.createRoot();
|
||||
|
||||
Fantom.runTask(() => {
|
||||
root.render(<MyApp />);
|
||||
});
|
||||
|
||||
const viewElement = ensureInstance(viewRef.current, ReactNativeElement);
|
||||
|
||||
Fantom.runTask(() => {
|
||||
_heightAnimation = Animated.timing(_animatedHeight, {
|
||||
toValue: 100,
|
||||
duration: 10,
|
||||
useNativeDriver: true,
|
||||
}).start();
|
||||
});
|
||||
|
||||
Fantom.unstable_produceFramesForDuration(10);
|
||||
|
||||
// TODO: this shouldn't be neccessary since animation should be stopped after duration
|
||||
Fantom.runTask(() => {
|
||||
_heightAnimation?.stop();
|
||||
});
|
||||
|
||||
// $FlowFixMe[incompatible-use]
|
||||
expect(Fantom.unstable_getDirectManipulationProps(viewElement).height).toBe(
|
||||
100,
|
||||
);
|
||||
|
||||
expect(Fantom.unstable_getFabricUpdateProps(viewElement).height).toBe(100);
|
||||
|
||||
expect(root.getRenderedOutput({props: ['height']}).toJSX()).toEqual(
|
||||
<rn-view height="100.000000" />,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -13,6 +13,7 @@ import type AnimatedNode from '../nodes/AnimatedNode';
|
||||
import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
|
||||
import AnimatedProps from '../nodes/AnimatedProps';
|
||||
|
||||
export type EndResult = {
|
||||
@@ -149,8 +150,15 @@ export default class Animation {
|
||||
if (value != null) {
|
||||
animatedValue.__onAnimatedValueUpdateReceived(value, offset);
|
||||
|
||||
if (this.__isLooping === true) {
|
||||
return;
|
||||
if (
|
||||
!(
|
||||
ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() &&
|
||||
ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()
|
||||
)
|
||||
) {
|
||||
if (this.__isLooping === true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Once the JS side node is synced with the updated values, trigger an
|
||||
|
||||
@@ -15,7 +15,9 @@ import type {
|
||||
} from '../createAnimatedComponent';
|
||||
|
||||
import RefreshControl from '../../Components/RefreshControl/RefreshControl';
|
||||
import ScrollView from '../../Components/ScrollView/ScrollView';
|
||||
import ScrollView, {
|
||||
type ScrollViewProps,
|
||||
} from '../../Components/ScrollView/ScrollView';
|
||||
import flattenStyle from '../../StyleSheet/flattenStyle';
|
||||
import splitLayoutProps from '../../StyleSheet/splitLayoutProps';
|
||||
import StyleSheet from '../../StyleSheet/StyleSheet';
|
||||
@@ -26,21 +28,20 @@ import useAnimatedProps from '../useAnimatedProps';
|
||||
import * as React from 'react';
|
||||
import {cloneElement, useMemo} from 'react';
|
||||
|
||||
type AnimatedScrollViewProps = React.ElementConfig<typeof ScrollView>;
|
||||
type AnimatedScrollViewInstance = React.ElementRef<typeof ScrollView>;
|
||||
|
||||
/**
|
||||
* @see https://github.com/facebook/react-native/commit/b8c8562
|
||||
*/
|
||||
const AnimatedScrollView: AnimatedComponentType<
|
||||
AnimatedScrollViewProps,
|
||||
ScrollViewProps,
|
||||
AnimatedScrollViewInstance,
|
||||
> = function AnimatedScrollViewWithOrWithoutInvertedRefreshControl({
|
||||
ref: forwardedRef,
|
||||
...props
|
||||
}: {
|
||||
ref?: React.RefSetter<AnimatedScrollViewInstance>,
|
||||
...AnimatedProps<AnimatedScrollViewProps>,
|
||||
...AnimatedProps<ScrollViewProps>,
|
||||
}) {
|
||||
// (Android only) When a ScrollView has a RefreshControl and
|
||||
// any `style` property set with an Animated.Value, the CSS
|
||||
@@ -111,7 +112,7 @@ const AnimatedScrollViewWithInvertedRefreshControl =
|
||||
|
||||
// Handle animated props on `NativeDirectionalScrollView`.
|
||||
const [scrollViewAnimatedProps, scrollViewRef] = useAnimatedProps<
|
||||
AnimatedScrollViewProps,
|
||||
ScrollViewProps,
|
||||
AnimatedScrollViewInstance,
|
||||
>(intermediatePropsForScrollView);
|
||||
const ref = useMergeRefs<AnimatedScrollViewInstance>(
|
||||
|
||||
@@ -10,13 +10,10 @@
|
||||
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
import Text from '../../Text/Text';
|
||||
import Text, {type TextProps} from '../../Text/Text';
|
||||
import createAnimatedComponent from '../createAnimatedComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
export default (createAnimatedComponent(
|
||||
(Text: $FlowFixMe),
|
||||
): AnimatedComponentType<
|
||||
React.ElementConfig<typeof Text>,
|
||||
React.ElementRef<typeof Text>,
|
||||
>);
|
||||
): AnimatedComponentType<TextProps, React.ElementRef<typeof Text>>);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {ViewProps} from '../../Components/View/ViewPropTypes';
|
||||
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
||||
|
||||
import View from '../../Components/View/View';
|
||||
@@ -15,6 +16,6 @@ import createAnimatedComponent from '../createAnimatedComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
export default (createAnimatedComponent(View): AnimatedComponentType<
|
||||
React.ElementConfig<typeof View>,
|
||||
ViewProps,
|
||||
React.ElementRef<typeof View>,
|
||||
>);
|
||||
|
||||
@@ -21,7 +21,7 @@ import type AnimatedValue from './nodes/AnimatedValue';
|
||||
|
||||
import createAnimatedPropsHook from '../../src/private/animated/createAnimatedPropsHook';
|
||||
import composeStyles from '../../src/private/styles/composeStyles';
|
||||
import View from '../Components/View/View';
|
||||
import {type ViewProps} from '../Components/View/ViewPropTypes';
|
||||
import useMergeRefs from '../Utilities/useMergeRefs';
|
||||
import * as React from 'react';
|
||||
import {useMemo} from 'react';
|
||||
@@ -60,9 +60,7 @@ type NonAnimatedProps =
|
||||
| 'disabled'
|
||||
| 'accessibilityLabel';
|
||||
type PassThroughProps = $ReadOnly<{
|
||||
passthroughAnimatedPropExplicitValues?: React.ElementConfig<
|
||||
typeof View,
|
||||
> | null,
|
||||
passthroughAnimatedPropExplicitValues?: ViewProps | null,
|
||||
}>;
|
||||
|
||||
export type AnimatedProps<Props: {...}> = {
|
||||
|
||||
@@ -14,12 +14,8 @@
|
||||
#import <memory>
|
||||
|
||||
#if USE_THIRD_PARTY_JSC != 1
|
||||
#if __has_include(<jsireact/HermesExecutorFactory.h>)
|
||||
#import <jsireact/HermesExecutorFactory.h>
|
||||
#elif __has_include(<reacthermes/HermesExecutorFactory.h>)
|
||||
#import <reacthermes/HermesExecutorFactory.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import <ReactCommon/RCTTurboModuleManager.h>
|
||||
#import <jsireact/JSIExecutor.h>
|
||||
|
||||
@@ -42,7 +42,7 @@ Pod::Spec.new do |s|
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = min_supported_versions
|
||||
s.source = source
|
||||
s.source_files = "**/*.{c,h,m,mm,S,cpp}"
|
||||
s.source_files = podspec_sources("**/*.{c,h,m,mm,S,cpp}", "**/*.h")
|
||||
|
||||
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
||||
s.compiler_flags = other_cflags
|
||||
|
||||
@@ -30,7 +30,7 @@ Pod::Spec.new do |s|
|
||||
s.platforms = min_supported_versions
|
||||
s.compiler_flags = '-Wno-nullability-completeness'
|
||||
s.source = source
|
||||
s.source_files = "*.{h,m,mm}"
|
||||
s.source_files = podspec_sources("*.{h,m,mm}", "**/*.h")
|
||||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
||||
s.header_dir = "RCTBlob"
|
||||
s.pod_target_xcconfig = {
|
||||
|
||||
+7
-4
@@ -63,6 +63,7 @@ export type ButtonProps = $ReadOnly<{
|
||||
@platform tv
|
||||
|
||||
@default false
|
||||
@deprecated Use `focusable` instead
|
||||
*/
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
|
||||
@@ -280,10 +281,12 @@ export type ButtonProps = $ReadOnly<{
|
||||
```
|
||||
*/
|
||||
|
||||
const Touchable: typeof TouchableNativeFeedback | typeof TouchableOpacity =
|
||||
const NativeTouchable:
|
||||
| typeof TouchableNativeFeedback
|
||||
| typeof TouchableOpacity =
|
||||
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
|
||||
|
||||
type ButtonRef = React.ElementRef<typeof Touchable>;
|
||||
type ButtonRef = React.ElementRef<typeof NativeTouchable>;
|
||||
|
||||
const Button: component(
|
||||
ref?: React.RefSetter<ButtonRef>,
|
||||
@@ -361,7 +364,7 @@ const Button: component(
|
||||
: importantForAccessibility;
|
||||
|
||||
return (
|
||||
<Touchable
|
||||
<NativeTouchable
|
||||
accessible={accessible}
|
||||
accessibilityActions={accessibilityActions}
|
||||
onAccessibilityAction={onAccessibilityAction}
|
||||
@@ -390,7 +393,7 @@ const Button: component(
|
||||
{formattedTitle}
|
||||
</Text>
|
||||
</View>
|
||||
</Touchable>
|
||||
</NativeTouchable>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
||||
import type {
|
||||
GestureResponderEvent,
|
||||
LayoutChangeEvent,
|
||||
@@ -26,8 +27,6 @@ import useAndroidRippleForView, {
|
||||
import * as React from 'react';
|
||||
import {memo, useMemo, useRef, useState} from 'react';
|
||||
|
||||
type ViewStyleProp = React.ElementConfig<typeof View>['style'];
|
||||
|
||||
export type {PressableAndroidRippleConfig};
|
||||
|
||||
export type PressableStateCallbackType = $ReadOnly<{
|
||||
|
||||
@@ -13,12 +13,21 @@ import {NativeMethods} from '../../../types/public/ReactNativeTypes';
|
||||
import {ViewProps} from '../View/ViewPropTypes';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use `react-native-safe-area-context` instead. This component is deprecated and will be removed in a future release.
|
||||
*
|
||||
* Renders nested content and automatically applies paddings reflect the portion of the view
|
||||
* that is not covered by navigation bars, tab bars, toolbars, and other ancestor views.
|
||||
* Moreover, and most importantly, Safe Area's paddings reflect physical limitation of the screen,
|
||||
* such as rounded corners or camera notches (aka sensor housing area on iPhone X).
|
||||
*/
|
||||
declare class SafeAreaViewComponent extends React.Component<ViewProps> {}
|
||||
|
||||
declare const SafeAreaViewBase: Constructor<NativeMethods> &
|
||||
typeof SafeAreaViewComponent;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use `react-native-safe-area-context` instead. This component is deprecated and will be removed in a future release.
|
||||
*/
|
||||
export class SafeAreaView extends SafeAreaViewBase {}
|
||||
|
||||
@@ -22,8 +22,9 @@ import * as React from 'react';
|
||||
* Moreover, and most importantly, Safe Area's paddings reflect physical
|
||||
* limitation of the screen, such as rounded corners or camera notches (aka
|
||||
* sensor housing area on iPhone X).
|
||||
* @deprecated Use `react-native-safe-area-context` instead. This component will be removed in a future release.
|
||||
*/
|
||||
const exported: component(
|
||||
const SafeAreaView: component(
|
||||
ref?: React.RefSetter<React.ElementRef<typeof View>>,
|
||||
...props: ViewProps
|
||||
) = Platform.select({
|
||||
@@ -31,4 +32,4 @@ const exported: component(
|
||||
default: View,
|
||||
});
|
||||
|
||||
export default exported;
|
||||
export default SafeAreaView;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import type * as React from 'react';
|
||||
import {Constructor} from '../../../types/private/Utilities';
|
||||
import {Insets} from '../../../types/public/Insets';
|
||||
import {HostInstance} from '../../../types/public/ReactNativeTypes';
|
||||
import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
|
||||
import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
|
||||
import {
|
||||
@@ -878,6 +879,12 @@ export class ScrollView extends ScrollViewBase {
|
||||
// Undocumented
|
||||
getInnerViewNode(): any;
|
||||
|
||||
/**
|
||||
* Returns a reference to the underlying native scroll view, or null if the
|
||||
* native instance is not mounted.
|
||||
*/
|
||||
getNativeScrollRef: () => HostInstance | null;
|
||||
|
||||
/**
|
||||
* @deprecated Use scrollTo instead
|
||||
*/
|
||||
|
||||
@@ -1480,6 +1480,7 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
|
||||
// then the second tap goes to the actual interior view)
|
||||
const {keyboardShouldPersistTaps} = this.props;
|
||||
const keyboardNeverPersistTaps =
|
||||
// $FlowFixMe[sketchy-null-bool]
|
||||
!keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
|
||||
|
||||
if (typeof e.target === 'number') {
|
||||
@@ -1562,6 +1563,7 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
|
||||
|
||||
const {keyboardShouldPersistTaps} = this.props;
|
||||
const keyboardNeverPersistsTaps =
|
||||
// $FlowFixMe[sketchy-null-bool]
|
||||
!keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
|
||||
|
||||
// Dismiss the keyboard now if we didn't become responder in capture phase
|
||||
|
||||
@@ -35,6 +35,8 @@ export interface StatusBarPropsAndroid {
|
||||
/**
|
||||
* The background color of the status bar.
|
||||
*
|
||||
* Please note that this prop has no effect on Android 15+
|
||||
*
|
||||
* @platform android
|
||||
*/
|
||||
backgroundColor?: ColorValue | undefined;
|
||||
@@ -44,6 +46,8 @@ export interface StatusBarPropsAndroid {
|
||||
* the app will draw under the status bar. This is useful when using a
|
||||
* semi transparent status bar color.
|
||||
*
|
||||
* Please note that this prop has no effect on Android 15+
|
||||
*
|
||||
* @platform android
|
||||
*/
|
||||
translucent?: boolean | undefined;
|
||||
|
||||
@@ -58,6 +58,9 @@ export type StatusBarAnimation = $Keys<{
|
||||
export type StatusBarPropsAndroid = $ReadOnly<{
|
||||
/**
|
||||
* The background color of the status bar.
|
||||
*
|
||||
* Please note that this prop has no effect on Android 15+
|
||||
*
|
||||
* @platform android
|
||||
*/
|
||||
backgroundColor?: ?ColorValue,
|
||||
@@ -66,6 +69,8 @@ export type StatusBarPropsAndroid = $ReadOnly<{
|
||||
* When translucent is set to true, the app will draw under the status bar.
|
||||
* This is useful when using a semi transparent status bar color.
|
||||
*
|
||||
* Please note that this prop has no effect on Android 15+
|
||||
*
|
||||
* @platform android
|
||||
*/
|
||||
translucent?: ?boolean,
|
||||
|
||||
@@ -30,6 +30,9 @@ type AndroidProps = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
type IOSProps = $ReadOnly<{
|
||||
/**
|
||||
* @deprecated Use `focusable` instead
|
||||
*/
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
}>;
|
||||
|
||||
|
||||
+1
@@ -29,6 +29,7 @@ type TVProps = {
|
||||
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
||||
*
|
||||
* @platform ios
|
||||
* @deprecated Use `focusable` instead
|
||||
*/
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface TVProps {
|
||||
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
||||
*
|
||||
* @platform ios
|
||||
* @deprecated Use `focusable` instead
|
||||
*/
|
||||
hasTVPreferredFocus?: boolean | undefined;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ export type TVProps = $ReadOnly<{
|
||||
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
||||
*
|
||||
* @platform ios
|
||||
* @deprecated Use `focusable` instead
|
||||
*/
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
|
||||
|
||||
+12
-13
@@ -16,11 +16,6 @@ import ViewNativeComponent from './ViewNativeComponent';
|
||||
import * as React from 'react';
|
||||
import {use} from 'react';
|
||||
|
||||
type PropsWithRef = $ReadOnly<{
|
||||
ref?: React.RefSetter<React.ElementRef<typeof ViewNativeComponent>>,
|
||||
...ViewProps,
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The most fundamental component for building a UI, View is a container that
|
||||
* supports layout with flexbox, style, some touch handling, and accessibility
|
||||
@@ -28,7 +23,10 @@ type PropsWithRef = $ReadOnly<{
|
||||
*
|
||||
* @see https://reactnative.dev/docs/view
|
||||
*/
|
||||
function View(props: PropsWithRef): React.Node {
|
||||
export default component View(
|
||||
ref?: React.RefSetter<React.ElementRef<typeof ViewNativeComponent>>,
|
||||
...props: ViewProps
|
||||
) {
|
||||
const hasTextAncestor = use(TextAncestor);
|
||||
|
||||
let actualView;
|
||||
@@ -55,7 +53,7 @@ function View(props: PropsWithRef): React.Node {
|
||||
} = props;
|
||||
|
||||
// Since we destructured props, we can now treat it as mutable
|
||||
const processedProps = otherProps as {...PropsWithRef};
|
||||
const processedProps = otherProps as {...ViewProps};
|
||||
|
||||
const parsedAriaLabelledBy = ariaLabelledBy?.split(/\s*,\s*/g);
|
||||
if (parsedAriaLabelledBy !== undefined) {
|
||||
@@ -118,7 +116,12 @@ function View(props: PropsWithRef): React.Node {
|
||||
};
|
||||
}
|
||||
|
||||
actualView = <ViewNativeComponent {...processedProps} />;
|
||||
actualView =
|
||||
ref == null ? (
|
||||
<ViewNativeComponent {...processedProps} />
|
||||
) : (
|
||||
<ViewNativeComponent {...processedProps} ref={ref} />
|
||||
);
|
||||
} else {
|
||||
const {
|
||||
accessibilityElementsHidden,
|
||||
@@ -198,6 +201,7 @@ function View(props: PropsWithRef): React.Node {
|
||||
: importantForAccessibility
|
||||
}
|
||||
nativeID={id ?? nativeID}
|
||||
ref={ref}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -207,8 +211,3 @@ function View(props: PropsWithRef): React.Node {
|
||||
}
|
||||
return actualView;
|
||||
}
|
||||
|
||||
export default View as component(
|
||||
ref?: React.RefSetter<React.ElementRef<typeof ViewNativeComponent>>,
|
||||
...props: ViewProps
|
||||
);
|
||||
|
||||
@@ -374,13 +374,6 @@ export type AccessibilityProps = $ReadOnly<{
|
||||
*/
|
||||
'aria-label'?: ?Stringish,
|
||||
|
||||
/**
|
||||
* Defines the order in which descendant elements receive accessibility focus.
|
||||
* The elements in the array represent nativeID values for the respective
|
||||
* descendant elements.
|
||||
*/
|
||||
experimental_accessibilityOrder?: ?Array<string>,
|
||||
|
||||
/**
|
||||
* Indicates to accessibility services to treat UI component like a specific role.
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,9 @@ import {
|
||||
import {Touchable} from '../Touchable/Touchable';
|
||||
import {AccessibilityProps} from './ViewAccessibility';
|
||||
|
||||
/**
|
||||
* @deprecated These properties are not implemented natively.
|
||||
*/
|
||||
export interface TVViewPropsIOS {
|
||||
/**
|
||||
* *(Apple TV only)* When set to true, this view will be focusable
|
||||
@@ -34,6 +37,7 @@ export interface TVViewPropsIOS {
|
||||
* *(Apple TV only)* May be set to true to force the Apple TV focus engine to move focus to this view.
|
||||
*
|
||||
* @platform ios
|
||||
* @deprecated Use `focusable` instead
|
||||
*/
|
||||
hasTVPreferredFocus?: boolean | undefined;
|
||||
|
||||
|
||||
@@ -280,6 +280,7 @@ export type ViewPropsAndroid = $ReadOnly<{
|
||||
* Whether to force the Android TV focus engine to move focus to this view.
|
||||
*
|
||||
* @platform android
|
||||
* @deprecated Use `focusable` instead
|
||||
*/
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
|
||||
@@ -489,6 +490,13 @@ type ViewBaseProps = $ReadOnly<{
|
||||
* See https://reactnative.dev/docs/view#removeclippedsubviews
|
||||
*/
|
||||
removeClippedSubviews?: ?boolean,
|
||||
|
||||
/**
|
||||
* Defines the order in which descendant elements receive accessibility focus.
|
||||
* The elements in the array represent nativeID values for the respective
|
||||
* descendant elements.
|
||||
*/
|
||||
experimental_accessibilityOrder?: ?Array<string>,
|
||||
}>;
|
||||
|
||||
export type ViewProps = $ReadOnly<{
|
||||
|
||||
@@ -169,6 +169,20 @@ describe('<View>', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('transform style', () => {
|
||||
it('causes view to be unflattened', () => {
|
||||
const root = Fantom.createRoot();
|
||||
|
||||
Fantom.runTask(() => {
|
||||
root.render(<View style={{transform: [{translateX: 10}]}} />);
|
||||
});
|
||||
|
||||
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
|
||||
<rn-view transform='[{"translateX": 10.000000}]' />,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('props', () => {
|
||||
describe('pointerEvents', () => {
|
||||
it('auto does not propagate to the mounting layer, it is the default', () => {
|
||||
|
||||
@@ -31,8 +31,8 @@ describe('<Button>', () => {
|
||||
.toJSX(),
|
||||
).toEqual(
|
||||
// Upper case on Android (also used by Fantom)
|
||||
<rn-view backgroundColor="rgba(33, 150, 243, 255)">
|
||||
<rn-paragraph foregroundColor="rgba(255, 255, 255, 255)">
|
||||
<rn-view backgroundColor="rgba(33, 150, 243, 1)">
|
||||
<rn-paragraph foregroundColor="rgba(255, 255, 255, 1)">
|
||||
HELLO
|
||||
</rn-paragraph>
|
||||
</rn-view>,
|
||||
@@ -53,8 +53,8 @@ describe('<Button>', () => {
|
||||
.getRenderedOutput({props: ['foregroundColor', 'backgroundColor']})
|
||||
.toJSX(),
|
||||
).toEqual(
|
||||
<rn-view backgroundColor="rgba(0, 0, 255, 255)">
|
||||
<rn-paragraph foregroundColor="rgba(255, 255, 255, 255)">
|
||||
<rn-view backgroundColor="rgba(0, 0, 255, 1)">
|
||||
<rn-paragraph foregroundColor="rgba(255, 255, 255, 1)">
|
||||
HELLO
|
||||
</rn-paragraph>
|
||||
</rn-view>,
|
||||
@@ -99,8 +99,8 @@ describe('<Button>', () => {
|
||||
.getRenderedOutput({props: ['foregroundColor', 'backgroundColor']})
|
||||
.toJSX(),
|
||||
).toEqual(
|
||||
<rn-view backgroundColor="rgba(223, 223, 223, 255)">
|
||||
<rn-paragraph foregroundColor="rgba(161, 161, 161, 255)">
|
||||
<rn-view backgroundColor="rgba(223, 223, 223, 1)">
|
||||
<rn-paragraph foregroundColor="rgba(161, 161, 161, 1)">
|
||||
HELLO
|
||||
</rn-paragraph>
|
||||
</rn-view>,
|
||||
@@ -181,8 +181,8 @@ describe('<Button>', () => {
|
||||
.getRenderedOutput({props: ['foregroundColor', 'backgroundColor']})
|
||||
.toJSX(),
|
||||
).toEqual(
|
||||
<rn-view backgroundColor="rgba(33, 150, 243, 255)">
|
||||
<rn-paragraph foregroundColor="rgba(255, 255, 255, 255)">
|
||||
<rn-view backgroundColor="rgba(33, 150, 243, 1)">
|
||||
<rn-paragraph foregroundColor="rgba(255, 255, 255, 1)">
|
||||
HELLO
|
||||
</rn-paragraph>
|
||||
</rn-view>,
|
||||
@@ -223,8 +223,8 @@ describe('<Button>', () => {
|
||||
.getRenderedOutput({props: ['foregroundColor', 'backgroundColor']})
|
||||
.toJSX(),
|
||||
).toEqual(
|
||||
<rn-view backgroundColor="rgba(223, 223, 223, 255)">
|
||||
<rn-paragraph foregroundColor="rgba(161, 161, 161, 255)">
|
||||
<rn-view backgroundColor="rgba(223, 223, 223, 1)">
|
||||
<rn-paragraph foregroundColor="rgba(161, 161, 161, 1)">
|
||||
HELLO
|
||||
</rn-paragraph>
|
||||
</rn-view>,
|
||||
|
||||
@@ -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(data.message);
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
|
||||
@@ -133,7 +133,7 @@ function runExceptionsManagerTests() {
|
||||
);
|
||||
expect(exceptionData.isFatal).toBe(false);
|
||||
expect(logToConsoleInReact).toBe(false);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
});
|
||||
|
||||
test('does not pop frames off the stack with framesToPop', () => {
|
||||
@@ -163,16 +163,10 @@ 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(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
});
|
||||
|
||||
test('wraps string in an Error and sends to handleException', () => {
|
||||
@@ -211,7 +205,13 @@ function runExceptionsManagerTests() {
|
||||
);
|
||||
expect(exceptionData.isFatal).toBe(false);
|
||||
expect(logToConsoleInReact).toBe(false);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
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);
|
||||
});
|
||||
|
||||
test('reports "Unspecified error" if error is null', () => {
|
||||
@@ -249,7 +249,15 @@ function runExceptionsManagerTests() {
|
||||
);
|
||||
expect(exceptionData.isFatal).toBe(false);
|
||||
expect(logToConsoleInReact).toBe(false);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
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',
|
||||
);
|
||||
});
|
||||
|
||||
test('works with a frozen error object', () => {
|
||||
@@ -280,7 +288,7 @@ function runExceptionsManagerTests() {
|
||||
// No component stack.
|
||||
const formattedMessage = 'Error: ' + error.message;
|
||||
expect(exceptionData.message).toBe(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
});
|
||||
|
||||
test('does not mutate the message', () => {
|
||||
@@ -312,7 +320,7 @@ function runExceptionsManagerTests() {
|
||||
'This error is located at:' +
|
||||
capturedErrorDefaults.componentStack;
|
||||
expect(exceptionData.message).toBe(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
});
|
||||
|
||||
test('can safely process the same error multiple times', () => {
|
||||
@@ -360,7 +368,7 @@ function runExceptionsManagerTests() {
|
||||
);
|
||||
expect(exceptionData.isFatal).toBe(false);
|
||||
expect(logToConsoleInReact).toBe(false);
|
||||
expect(console.error).toBeCalledWith(formattedMessage);
|
||||
expect(console.error).toBeCalledWith(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -664,7 +672,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(formattedMessage);
|
||||
expect(console.error.mock.calls[0][0]).toBe(error);
|
||||
});
|
||||
|
||||
test('handling a non-fatal Error', () => {
|
||||
@@ -697,7 +705,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(formattedMessage);
|
||||
expect(console.error.mock.calls[0][0]).toBe(error);
|
||||
});
|
||||
|
||||
test('handling a thrown string', () => {
|
||||
@@ -726,7 +734,11 @@ function runExceptionsManagerTests() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toHaveLength(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toEqual([message]);
|
||||
expect(console.error.mock.calls[0][0]).toBeInstanceOf(
|
||||
ExceptionsManager.SyntheticError,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0][0].toString()).toBe(message);
|
||||
});
|
||||
|
||||
test('does not pop frames off the stack with framesToPop', () => {
|
||||
@@ -759,9 +771,7 @@ function runExceptionsManagerTests() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toHaveLength(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toEqual([
|
||||
'Error: ' + error.message,
|
||||
]);
|
||||
expect(console.error.mock.calls[0][0]).toBe(error);
|
||||
});
|
||||
|
||||
test('logs fatal "warn"-type errors', () => {
|
||||
@@ -783,19 +793,17 @@ function runExceptionsManagerTests() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toHaveLength(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(console.error.mock.calls[0]).toEqual([
|
||||
'Error: ' + error.message,
|
||||
]);
|
||||
expect(console.error.mock.calls[0][0]).toBe(error);
|
||||
});
|
||||
});
|
||||
|
||||
describe('unstable_setExceptionDecorator', () => {
|
||||
let mockError;
|
||||
let mockConsoleError;
|
||||
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.
|
||||
mockError = console.error;
|
||||
mockConsoleError = console.error;
|
||||
ExceptionsManager.installConsoleErrorReporter();
|
||||
});
|
||||
|
||||
@@ -861,15 +869,11 @@ function runExceptionsManagerTests() {
|
||||
...beforeDecorator,
|
||||
message: 'decorated: ' + beforeDecorator.message,
|
||||
});
|
||||
expect(mockError).toBeCalledTimes(2);
|
||||
expect(mockConsoleError).toBeCalledTimes(2);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[0][0]).toEqual(
|
||||
'Error: Some error happened',
|
||||
);
|
||||
expect(mockConsoleError.mock.calls[0][0]).toBe(error);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[1][0]).toMatch(
|
||||
'decorated: Error: Some error happened',
|
||||
);
|
||||
expect(mockConsoleError.mock.calls[1][0]).toBe(error);
|
||||
});
|
||||
|
||||
test('clearing a decorator', () => {
|
||||
@@ -893,11 +897,9 @@ function runExceptionsManagerTests() {
|
||||
expect(logBoxAddException).not.toBeCalled();
|
||||
expect(nativeReportException).toBeCalledTimes(1);
|
||||
}
|
||||
expect(mockError).toBeCalledTimes(1);
|
||||
expect(mockConsoleError).toBeCalledTimes(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[0][0]).toEqual(
|
||||
'Error: Some error happened',
|
||||
);
|
||||
expect(mockConsoleError.mock.calls[0][0]).toBe(error);
|
||||
});
|
||||
|
||||
test('prevents decorator recursion from error handler', () => {
|
||||
@@ -928,15 +930,13 @@ function runExceptionsManagerTests() {
|
||||
/decorated: .*Some error happened/,
|
||||
);
|
||||
}
|
||||
expect(mockError).toBeCalledTimes(2);
|
||||
expect(mockConsoleError).toBeCalledTimes(2);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[0][0]).toMatch(
|
||||
expect(mockConsoleError.mock.calls[0][0]).toMatch(
|
||||
/Logging an error within the decorator/,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[1][0]).toMatch(
|
||||
/decorated: .*Some error happened/,
|
||||
);
|
||||
expect(mockConsoleError.mock.calls[1][0]).toBe(error);
|
||||
});
|
||||
|
||||
test('prevents decorator recursion from console.error', () => {
|
||||
@@ -974,14 +974,14 @@ function runExceptionsManagerTests() {
|
||||
/decorated: .*Some error happened/,
|
||||
);
|
||||
}
|
||||
expect(mockError).toBeCalledTimes(2);
|
||||
expect(mockConsoleError).toBeCalledTimes(2);
|
||||
// console.error calls are chained without exception pre-processing, so decorator doesn't apply
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[0][0].toString()).toMatch(
|
||||
expect(mockConsoleError.mock.calls[0][0].toString()).toMatch(
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[1][0]).toMatch(
|
||||
expect(mockConsoleError.mock.calls[1][0]).toMatch(
|
||||
/Logging an error within the decorator/,
|
||||
);
|
||||
});
|
||||
@@ -1012,11 +1012,9 @@ function runExceptionsManagerTests() {
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
}
|
||||
expect(mockError).toBeCalledTimes(1);
|
||||
expect(mockConsoleError).toBeCalledTimes(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[0][0]).toMatch(
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
expect(mockConsoleError.mock.calls[0][0]).toBe(error);
|
||||
});
|
||||
|
||||
test('can handle throwing decorators recursion when exception is logged', () => {
|
||||
@@ -1044,9 +1042,9 @@ function runExceptionsManagerTests() {
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
}
|
||||
expect(mockError).toBeCalledTimes(1);
|
||||
expect(mockConsoleError).toBeCalledTimes(1);
|
||||
// $FlowFixMe[prop-missing]
|
||||
expect(mockError.mock.calls[0][0].toString()).toMatch(
|
||||
expect(mockConsoleError.mock.calls[0][0].toString()).toMatch(
|
||||
/Error: Some error happened/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ export type {EventSubscription, EmitterSubscription};
|
||||
export type NativeEventSubscription = EventSubscription;
|
||||
|
||||
// $FlowFixMe[unclear-type] unclear type of events
|
||||
type UnsafeObject = Object;
|
||||
type UnsafeNativeEventObject = Object;
|
||||
|
||||
/**
|
||||
* `NativeEventEmitter` is intended for use by Native Modules to emit events to
|
||||
@@ -46,8 +46,8 @@ type UnsafeObject = Object;
|
||||
*/
|
||||
export default class NativeEventEmitter<
|
||||
TEventToArgsMap: $ReadOnly<
|
||||
Record<string, $ReadOnlyArray<UnsafeObject>>,
|
||||
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
||||
Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>,
|
||||
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeNativeEventObject>>>,
|
||||
> implements IEventEmitter<TEventToArgsMap>
|
||||
{
|
||||
_nativeModule: ?NativeModule;
|
||||
|
||||
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = min_supported_versions
|
||||
s.source = source
|
||||
s.source_files = "**/*.{c,h,m,mm,cpp}"
|
||||
s.source_files = podspec_sources("**/*.{c,h,m,mm,cpp}", "**/*.h")
|
||||
s.header_dir = "FBLazyVector"
|
||||
|
||||
end
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
#import <React/RCTImageLoaderLoggable.h>
|
||||
#import <React/RCTImageLoaderProtocol.h>
|
||||
#import <React/RCTImageURLLoader.h>
|
||||
|
||||
// TODO (T61325135): Remove C++ checks
|
||||
#ifdef __cplusplus
|
||||
#import <string>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
struct ImageURLLoaderAttribution {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#import <React/RCTImageUtils.h>
|
||||
|
||||
#import <tgmath.h>
|
||||
#import <cmath>
|
||||
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#import <MobileCoreServices/UTCoreTypes.h>
|
||||
|
||||
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
|
||||
s.platforms = min_supported_versions
|
||||
s.compiler_flags = '-Wno-nullability-completeness'
|
||||
s.source = source
|
||||
s.source_files = "*.{m,mm}"
|
||||
s.source_files = podspec_sources("*.{m,mm}", "**/*.h")
|
||||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
||||
s.header_dir = "RCTImage"
|
||||
s.pod_target_xcconfig = {
|
||||
|
||||
@@ -229,7 +229,8 @@ function _processUpdate() {
|
||||
*/
|
||||
const InteractionManager = (
|
||||
ReactNativeFeatureFlags.disableInteractionManager()
|
||||
? require('./InteractionManagerStub').default
|
||||
? // $FlowFixMe[incompatible-variance]
|
||||
require('./InteractionManagerStub').default
|
||||
: InteractionManagerImpl
|
||||
) as typeof InteractionManagerImpl;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ type OnAnimationDidFailCallback = () => void;
|
||||
let isLayoutAnimationEnabled: boolean =
|
||||
ReactNativeFeatureFlags.isLayoutAnimationEnabled();
|
||||
|
||||
function setEnabled(value: boolean) {
|
||||
function setLayoutAnimationEnabled(value: boolean) {
|
||||
isLayoutAnimationEnabled = isLayoutAnimationEnabled;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ function configureNext(
|
||||
}
|
||||
}
|
||||
|
||||
function create(
|
||||
function createLayoutAnimation(
|
||||
duration: number,
|
||||
type?: LayoutAnimationType,
|
||||
property?: LayoutAnimationProperty,
|
||||
@@ -129,12 +129,16 @@ function create(
|
||||
}
|
||||
|
||||
const Presets = {
|
||||
easeInEaseOut: (create(
|
||||
easeInEaseOut: (createLayoutAnimation(
|
||||
300,
|
||||
'easeInEaseOut',
|
||||
'opacity',
|
||||
): LayoutAnimationConfig),
|
||||
linear: (create(500, 'linear', 'opacity'): LayoutAnimationConfig),
|
||||
linear: (createLayoutAnimation(
|
||||
500,
|
||||
'linear',
|
||||
'opacity',
|
||||
): LayoutAnimationConfig),
|
||||
spring: ({
|
||||
duration: 700,
|
||||
create: {
|
||||
@@ -180,7 +184,7 @@ const LayoutAnimation = {
|
||||
/**
|
||||
* Helper for creating a config for `configureNext`.
|
||||
*/
|
||||
create,
|
||||
create: createLayoutAnimation,
|
||||
Types: Object.freeze({
|
||||
spring: 'spring',
|
||||
linear: 'linear',
|
||||
@@ -208,7 +212,7 @@ const LayoutAnimation = {
|
||||
spring: (configureNext.bind(null, Presets.spring): (
|
||||
onAnimationDidEnd?: OnAnimationDidEndCallback,
|
||||
) => void),
|
||||
setEnabled,
|
||||
setEnabled: setLayoutAnimationEnabled,
|
||||
};
|
||||
|
||||
export default LayoutAnimation;
|
||||
|
||||
@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
|
||||
s.platforms = min_supported_versions
|
||||
s.compiler_flags = '-Wno-nullability-completeness'
|
||||
s.source = source
|
||||
s.source_files = "*.{m,mm}"
|
||||
s.source_files = podspec_sources("*.{m,mm}", "")
|
||||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
||||
s.header_dir = "RCTLinking"
|
||||
s.pod_target_xcconfig = {
|
||||
|
||||
+1
-2
@@ -15,6 +15,7 @@ import type {
|
||||
ListRenderItemInfo,
|
||||
ViewabilityConfigCallbackPair,
|
||||
ViewToken,
|
||||
VirtualizedListProps,
|
||||
} from '@react-native/virtualized-lists';
|
||||
|
||||
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
|
||||
@@ -181,8 +182,6 @@ type FlatListBaseProps<ItemT> = {
|
||||
...OptionalProps<ItemT>,
|
||||
};
|
||||
|
||||
type VirtualizedListProps = React.ElementConfig<typeof VirtualizedList>;
|
||||
|
||||
export type FlatListProps<ItemT> = {
|
||||
...Omit<
|
||||
VirtualizedListProps,
|
||||
|
||||
+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 = {
|
||||
const error: ExtendedExceptionData = {
|
||||
message: `
|
||||
|
||||
197 | });
|
||||
@@ -344,7 +344,7 @@ describe('parseLogBoxLog', () => {
|
||||
});
|
||||
|
||||
it('parses an invalid require syntax error', () => {
|
||||
const error = {
|
||||
const error: ExtendedExceptionData = {
|
||||
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 = {
|
||||
const error: ExtendedExceptionData = {
|
||||
message: `
|
||||
|
||||
197 | });
|
||||
@@ -462,7 +462,7 @@ If you are sure the module exists, try these steps:
|
||||
});
|
||||
|
||||
it('parses a babel codeframe error', () => {
|
||||
const error = {
|
||||
const error: ExtendedExceptionData = {
|
||||
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 = {
|
||||
const error: ExtendedExceptionData = {
|
||||
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
|
||||
|
||||
+8
-2
@@ -35,9 +35,9 @@ export interface ModalBaseProps {
|
||||
*/
|
||||
visible?: boolean | undefined;
|
||||
/**
|
||||
* The `onRequestClose` callback is called when the user taps the hardware back button on Android or the menu button on Apple TV.
|
||||
* The `onRequestClose` callback is called when the user taps the hardware back button on Android, dismisses the sheet using a gesture on iOS (when `allowSwipeDismissal` is set to true) or the menu button on Apple TV.
|
||||
*
|
||||
* This is required on Apple TV and Android.
|
||||
* This is required on iOS and Android.
|
||||
*/
|
||||
onRequestClose?: ((event: NativeSyntheticEvent<any>) => void) | undefined;
|
||||
/**
|
||||
@@ -89,6 +89,12 @@ export interface ModalPropsIOS {
|
||||
onOrientationChange?:
|
||||
| ((event: NativeSyntheticEvent<any>) => void)
|
||||
| undefined;
|
||||
|
||||
/**
|
||||
* Controls whether the modal can be dismissed by swiping down on iOS.
|
||||
* This requires you to implement the `onRequestClose` prop to handle the dismissal.
|
||||
*/
|
||||
allowSwipeDismissal?: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface ModalPropsAndroid {
|
||||
|
||||
+19
-2
@@ -86,9 +86,9 @@ export type ModalBaseProps = {
|
||||
*/
|
||||
visible?: ?boolean,
|
||||
/**
|
||||
* The `onRequestClose` callback is called when the user taps the hardware back button on Android or the menu button on Apple TV.
|
||||
* The `onRequestClose` callback is called when the user taps the hardware back button on Android, dismisses the sheet using a gesture on iOS (when `allowSwipeDismissal` is set to true) or the menu button on Apple TV.
|
||||
*
|
||||
* This is required on Apple TV and Android.
|
||||
* This is required on iOS and Android.
|
||||
*/
|
||||
// onRequestClose?: (event: NativeSyntheticEvent<any>) => void;
|
||||
onRequestClose?: ?DirectEventHandler<null>,
|
||||
@@ -147,6 +147,12 @@ export type ModalPropsIOS = {
|
||||
// | ((event: NativeSyntheticEvent<any>) => void)
|
||||
// | undefined;
|
||||
onOrientationChange?: ?DirectEventHandler<OrientationChangeEvent>,
|
||||
|
||||
/**
|
||||
* Controls whether the modal can be dismissed by swiping down on iOS.
|
||||
* This requires you to implement the `onRequestClose` prop to handle the dismissal.
|
||||
*/
|
||||
allowSwipeDismissal?: ?boolean,
|
||||
};
|
||||
|
||||
export type ModalPropsAndroid = {
|
||||
@@ -192,6 +198,16 @@ function confirmProps(props: ModalProps) {
|
||||
'Modal with translucent navigation bar and without translucent status bar is not supported.',
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
Platform.OS === 'ios' &&
|
||||
props.allowSwipeDismissal === true &&
|
||||
!props.onRequestClose
|
||||
) {
|
||||
console.warn(
|
||||
'Modal requires the onRequestClose prop when used with `allowSwipeDismissal`. This is necessary to prevent state corruption.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,6 +343,7 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
||||
onStartShouldSetResponder={this._shouldSetResponder}
|
||||
supportedOrientations={this.props.supportedOrientations}
|
||||
onOrientationChange={this.props.onOrientationChange}
|
||||
allowSwipeDismissal={this.props.allowSwipeDismissal}
|
||||
testID={this.props.testID}>
|
||||
<VirtualizedListContextResetter>
|
||||
<ScrollView.Context.Provider value={null}>
|
||||
|
||||
@@ -30,7 +30,7 @@ Pod::Spec.new do |s|
|
||||
s.platforms = min_supported_versions
|
||||
s.compiler_flags = '-Wno-nullability-completeness'
|
||||
s.source = source
|
||||
s.source_files = "**/*.{h,m,mm}"
|
||||
s.source_files = podspec_sources("**/*.{h,m,mm}", "**/*.h")
|
||||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
||||
s.header_dir = "RCTAnimation"
|
||||
s.pod_target_xcconfig = {
|
||||
|
||||
@@ -30,7 +30,7 @@ Pod::Spec.new do |s|
|
||||
s.platforms = min_supported_versions
|
||||
s.compiler_flags = '-Wno-nullability-completeness'
|
||||
s.source = source
|
||||
s.source_files = "*.{m,mm}"
|
||||
s.source_files = podspec_sources("*.{m,mm}", "")
|
||||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
||||
s.header_dir = "RCTNetwork"
|
||||
s.pod_target_xcconfig = {
|
||||
|
||||
@@ -130,7 +130,7 @@ const PERMISSIONS = Object.freeze({
|
||||
*
|
||||
* See https://reactnative.dev/docs/permissionsandroid
|
||||
*/
|
||||
class PermissionsAndroid {
|
||||
class PermissionsAndroidImpl {
|
||||
PERMISSIONS: PermissionsType = PERMISSIONS;
|
||||
RESULTS: $ReadOnly<{
|
||||
DENIED: 'denied',
|
||||
@@ -297,5 +297,6 @@ class PermissionsAndroid {
|
||||
}
|
||||
}
|
||||
|
||||
const PermissionsAndroidInstance: PermissionsAndroid = new PermissionsAndroid();
|
||||
const PermissionsAndroidInstance: PermissionsAndroidImpl =
|
||||
new PermissionsAndroidImpl();
|
||||
export default PermissionsAndroidInstance;
|
||||
|
||||
@@ -13,8 +13,8 @@ import type {RootTag} from '../Types/RootTagTypes';
|
||||
import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
|
||||
import type {DisplayModeType} from './DisplayMode';
|
||||
|
||||
type Task = (taskData: any) => Promise<void>;
|
||||
export type TaskProvider = () => Task;
|
||||
type HeadlessTask = (taskData: any) => Promise<void>;
|
||||
export type TaskProvider = () => HeadlessTask;
|
||||
|
||||
export type ComponentProvider = () => React.ComponentType<any>;
|
||||
export type ComponentProviderInstrumentationHook = (
|
||||
|
||||
packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js
Vendored
+80
-61
@@ -61,7 +61,7 @@ function restoreDeletedValuesInNestedArray(
|
||||
} else if (node && removedKeyCount > 0) {
|
||||
const obj = node;
|
||||
for (const propKey in removedKeys) {
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
// $FlowFixMe[incompatible-use] removedKeys is always non-null
|
||||
if (!removedKeys[propKey]) {
|
||||
continue;
|
||||
}
|
||||
@@ -133,12 +133,12 @@ function diffNestedArrayProperty(
|
||||
);
|
||||
}
|
||||
for (; i < nextArray.length; i++) {
|
||||
// Add all remaining properties.
|
||||
updatePayload = addNestedProperty(
|
||||
updatePayload,
|
||||
nextArray[i],
|
||||
validAttributes,
|
||||
);
|
||||
// Add all remaining properties
|
||||
const nextProp = nextArray[i];
|
||||
if (!nextProp) {
|
||||
continue;
|
||||
}
|
||||
updatePayload = addNestedProperty(updatePayload, nextProp, validAttributes);
|
||||
}
|
||||
return updatePayload;
|
||||
}
|
||||
@@ -183,9 +183,7 @@ function diffNestedProperty(
|
||||
if (Array.isArray(prevProp)) {
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
// $FlowFixMe - We know that this is always an object when the input is.
|
||||
flattenStyle(prevProp),
|
||||
// $FlowFixMe - We know that this isn't an array because of above flow.
|
||||
nextProp,
|
||||
validAttributes,
|
||||
);
|
||||
@@ -194,43 +192,11 @@ function diffNestedProperty(
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
prevProp,
|
||||
// $FlowFixMe - We know that this is always an object when the input is.
|
||||
flattenStyle(nextProp),
|
||||
validAttributes,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* addNestedProperty takes a single set of props and valid attribute
|
||||
* attribute configurations. It processes each prop and adds it to the
|
||||
* updatePayload.
|
||||
*/
|
||||
function addNestedProperty(
|
||||
updatePayload: null | Object,
|
||||
nextProp: NestedNode,
|
||||
validAttributes: AttributeConfiguration,
|
||||
): $FlowFixMe {
|
||||
if (!nextProp) {
|
||||
return updatePayload;
|
||||
}
|
||||
|
||||
if (!Array.isArray(nextProp)) {
|
||||
// Add each property of the leaf.
|
||||
return addProperties(updatePayload, nextProp, validAttributes);
|
||||
}
|
||||
|
||||
for (let i = 0; i < nextProp.length; i++) {
|
||||
// Add all the properties of the array.
|
||||
updatePayload = addNestedProperty(
|
||||
updatePayload,
|
||||
nextProp[i],
|
||||
validAttributes,
|
||||
);
|
||||
}
|
||||
|
||||
return updatePayload;
|
||||
}
|
||||
|
||||
/**
|
||||
* clearNestedProperty takes a single set of props and valid attributes. It
|
||||
* adds a null sentinel to the updatePayload, for each prop key.
|
||||
@@ -285,14 +251,19 @@ function diffProperties(
|
||||
prevProp = prevProps[propKey];
|
||||
nextProp = nextProps[propKey];
|
||||
|
||||
// functions are converted to booleans as markers that the associated
|
||||
// events should be sent from native.
|
||||
if (typeof nextProp === 'function') {
|
||||
nextProp = (true: any);
|
||||
// If nextProp is not a function, then don't bother changing prevProp
|
||||
// since nextProp will win and go into the updatePayload regardless.
|
||||
if (typeof prevProp === 'function') {
|
||||
prevProp = (true: any);
|
||||
const attributeConfigHasProcess =
|
||||
typeof attributeConfig === 'object' &&
|
||||
typeof attributeConfig.process === 'function';
|
||||
if (!attributeConfigHasProcess) {
|
||||
// functions are converted to booleans as markers that the associated
|
||||
// events should be sent from native.
|
||||
nextProp = (true: any);
|
||||
// If nextProp is not a function, then don't bother changing prevProp
|
||||
// since nextProp will win and go into the updatePayload regardless.
|
||||
if (typeof prevProp === 'function') {
|
||||
prevProp = (true: any);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,16 +413,69 @@ function diffProperties(
|
||||
return updatePayload;
|
||||
}
|
||||
|
||||
/**
|
||||
* addProperties adds all the valid props to the payload after being processed.
|
||||
*/
|
||||
function addProperties(
|
||||
updatePayload: null | Object,
|
||||
function addNestedProperty(
|
||||
payload: null | Object,
|
||||
props: Object,
|
||||
validAttributes: AttributeConfiguration,
|
||||
): null | Object {
|
||||
// TODO: Fast path
|
||||
return diffProperties(updatePayload, emptyObject, props, validAttributes);
|
||||
// Flatten nested style props.
|
||||
if (Array.isArray(props)) {
|
||||
for (let i = 0; i < props.length; i++) {
|
||||
payload = addNestedProperty(payload, props[i], validAttributes);
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
|
||||
for (const propKey in props) {
|
||||
const prop = props[propKey];
|
||||
|
||||
const attributeConfig = ((validAttributes[
|
||||
propKey
|
||||
]: any): AttributeConfiguration);
|
||||
|
||||
if (attributeConfig == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let newValue;
|
||||
|
||||
if (prop === undefined) {
|
||||
// Discard the prop if it was previously defined.
|
||||
if (payload && payload[propKey] !== undefined) {
|
||||
newValue = null;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if (typeof attributeConfig === 'object') {
|
||||
if (typeof attributeConfig.process === 'function') {
|
||||
// An atomic prop with custom processing.
|
||||
newValue = attributeConfig.process(prop);
|
||||
} else if (typeof attributeConfig.diff === 'function') {
|
||||
// An atomic prop with custom diffing. We don't need to do diffing when adding props.
|
||||
newValue = prop;
|
||||
}
|
||||
} else {
|
||||
if (typeof prop === 'function') {
|
||||
// A function prop. It represents an event handler. Pass it to native as 'true'.
|
||||
newValue = true;
|
||||
} else {
|
||||
// An atomic prop. Doesn't need to be flattened.
|
||||
newValue = prop;
|
||||
}
|
||||
}
|
||||
|
||||
if (newValue !== undefined) {
|
||||
if (!payload) {
|
||||
payload = ({}: {[string]: $FlowFixMe});
|
||||
}
|
||||
payload[propKey] = newValue;
|
||||
continue;
|
||||
}
|
||||
|
||||
payload = addNestedProperty(payload, prop, attributeConfig);
|
||||
}
|
||||
|
||||
return payload;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,7 +487,6 @@ function clearProperties(
|
||||
prevProps: Object,
|
||||
validAttributes: AttributeConfiguration,
|
||||
): null | Object {
|
||||
// TODO: Fast path
|
||||
return diffProperties(updatePayload, prevProps, emptyObject, validAttributes);
|
||||
}
|
||||
|
||||
@@ -471,11 +494,7 @@ export function create(
|
||||
props: Object,
|
||||
validAttributes: AttributeConfiguration,
|
||||
): null | Object {
|
||||
return addProperties(
|
||||
null, // updatePayload
|
||||
props,
|
||||
validAttributes,
|
||||
);
|
||||
return addNestedProperty(null, props, validAttributes);
|
||||
}
|
||||
|
||||
export function diff(
|
||||
|
||||
+495
@@ -0,0 +1,495 @@
|
||||
/**
|
||||
* 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
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {AttributeConfiguration} from '../../../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
const {create, diff} = require('../ReactNativeAttributePayload');
|
||||
|
||||
describe('ReactNativeAttributePayload.create', () => {
|
||||
it('should work with simple example', () => {
|
||||
expect(create({b: 2, c: 3}, {a: true, b: true})).toEqual({
|
||||
b: 2,
|
||||
});
|
||||
});
|
||||
|
||||
it('should work with complex example', () => {
|
||||
const validAttributes: AttributeConfiguration = {
|
||||
style: {
|
||||
position: true,
|
||||
zIndex: true,
|
||||
flexGrow: true,
|
||||
flexShrink: true,
|
||||
flexDirection: true,
|
||||
overflow: true,
|
||||
backgroundColor: true,
|
||||
},
|
||||
};
|
||||
|
||||
expect(
|
||||
create(
|
||||
{
|
||||
style: [
|
||||
{
|
||||
flexGrow: 1,
|
||||
flexShrink: 1,
|
||||
flexDirection: 'row',
|
||||
overflow: 'scroll',
|
||||
},
|
||||
[
|
||||
{position: 'relative', zIndex: 2},
|
||||
{flexGrow: 0},
|
||||
{backgroundColor: 'red'},
|
||||
],
|
||||
],
|
||||
},
|
||||
validAttributes,
|
||||
),
|
||||
).toEqual({
|
||||
flexGrow: 0,
|
||||
flexShrink: 1,
|
||||
flexDirection: 'row',
|
||||
overflow: 'scroll',
|
||||
position: 'relative',
|
||||
zIndex: 2,
|
||||
backgroundColor: 'red',
|
||||
});
|
||||
});
|
||||
|
||||
it('should nullify previously defined style prop that is subsequently set to null or undefined', () => {
|
||||
expect(
|
||||
create({style: [{a: 0}, {a: undefined}]}, {style: {a: true}}),
|
||||
).toEqual({a: null});
|
||||
expect(create({style: [{a: 0}, {a: null}]}, {style: {a: true}})).toEqual({
|
||||
a: null,
|
||||
});
|
||||
});
|
||||
|
||||
it('should ignore non-style fields that are set to undefined', () => {
|
||||
expect(create({}, {a: true})).toEqual(null);
|
||||
expect(create({a: undefined}, {a: true})).toEqual(null);
|
||||
expect(create({a: undefined, b: undefined}, {a: true, b: true})).toEqual(
|
||||
null,
|
||||
);
|
||||
expect(
|
||||
create({a: undefined, b: undefined, c: 1}, {a: true, b: true}),
|
||||
).toEqual(null);
|
||||
expect(
|
||||
create({a: undefined, b: undefined, c: 1}, {a: true, b: true, c: true}),
|
||||
).toEqual({c: 1});
|
||||
expect(
|
||||
create({a: 1, b: undefined, c: 2}, {a: true, b: true, c: true}),
|
||||
).toEqual({a: 1, c: 2});
|
||||
});
|
||||
|
||||
it('should ignore invalid fields', () => {
|
||||
expect(create({b: 2}, {})).toEqual(null);
|
||||
});
|
||||
|
||||
it('should not use the diff attribute', () => {
|
||||
const diffA = jest.fn();
|
||||
expect(create({a: [2]}, {a: {diff: diffA}})).toEqual({a: [2]});
|
||||
expect(diffA).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('should use the process attribute', () => {
|
||||
const processA = jest.fn(a => a + 1);
|
||||
expect(create({a: 2}, {a: {process: processA}})).toEqual({a: 3});
|
||||
expect(processA).toBeCalledWith(2);
|
||||
});
|
||||
|
||||
it('should use the process attribute for functions as well', () => {
|
||||
const process = (x: Object) => x;
|
||||
const nextFunction = () => {};
|
||||
expect(create({a: nextFunction}, {a: {process}})).toEqual({
|
||||
a: nextFunction,
|
||||
});
|
||||
});
|
||||
|
||||
it('should work with undefined styles', () => {
|
||||
expect(create({style: undefined}, {style: {b: true}})).toEqual(null);
|
||||
expect(create({style: {a: '#ffffff', b: 1}}, {style: {b: true}})).toEqual({
|
||||
b: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it('should flatten nested styles and predefined styles', () => {
|
||||
const validStyleAttribute: AttributeConfiguration = {
|
||||
style: {foo: true, bar: true},
|
||||
};
|
||||
expect(create({style: [{foo: 1}, {bar: 2}]}, validStyleAttribute)).toEqual({
|
||||
foo: 1,
|
||||
bar: 2,
|
||||
});
|
||||
expect(create({}, validStyleAttribute)).toEqual(null);
|
||||
const barStyle = {
|
||||
bar: 3,
|
||||
};
|
||||
expect(
|
||||
create({style: [[{foo: 1}, {foo: 2}], barStyle]}, validStyleAttribute),
|
||||
).toEqual({foo: 2, bar: 3});
|
||||
});
|
||||
|
||||
it('should not flatten nested props if attribute config is a primitive or only has diff/process', () => {
|
||||
expect(create({a: {foo: 1, bar: 2}}, {a: true})).toEqual({
|
||||
a: {foo: 1, bar: 2},
|
||||
});
|
||||
expect(create({a: [{foo: 1}, {bar: 2}]}, {a: true})).toEqual({
|
||||
a: [{foo: 1}, {bar: 2}],
|
||||
});
|
||||
expect(create({a: {foo: 1, bar: 2}}, {a: {diff: a => a}})).toEqual({
|
||||
a: {foo: 1, bar: 2},
|
||||
});
|
||||
expect(
|
||||
create({a: [{foo: 1}, {bar: 2}]}, {a: {diff: a => a, process: a => a}}),
|
||||
).toEqual({a: [{foo: 1}, {bar: 2}]});
|
||||
});
|
||||
|
||||
it('handles attributes defined multiple times', () => {
|
||||
const validAttributes: AttributeConfiguration = {
|
||||
foo: true,
|
||||
style: {foo: true},
|
||||
};
|
||||
expect(create({foo: 4, style: {foo: 2}}, validAttributes)).toEqual({
|
||||
foo: 2,
|
||||
});
|
||||
expect(create({style: {foo: 2}}, validAttributes)).toEqual({
|
||||
foo: 2,
|
||||
});
|
||||
expect(create({style: {foo: 2}, foo: 4}, validAttributes)).toEqual({
|
||||
foo: 4,
|
||||
});
|
||||
expect(create({foo: 4, style: {foo: null}}, validAttributes)).toEqual({
|
||||
foo: null, // this should ideally be null.
|
||||
});
|
||||
expect(
|
||||
create({foo: 4, style: [{foo: null}, {foo: 5}]}, validAttributes),
|
||||
).toEqual({
|
||||
foo: 5,
|
||||
});
|
||||
});
|
||||
|
||||
// Function properties are just markers to native that events should be sent.
|
||||
it('should convert functions to booleans', () => {
|
||||
expect(
|
||||
create(
|
||||
{
|
||||
a: function () {
|
||||
return 9;
|
||||
},
|
||||
b: function () {
|
||||
return 3;
|
||||
},
|
||||
},
|
||||
{a: true, b: true},
|
||||
),
|
||||
).toEqual({a: true, b: true});
|
||||
});
|
||||
});
|
||||
|
||||
describe('ReactNativeAttributePayload.diff', () => {
|
||||
it('should work with simple example', () => {
|
||||
expect(diff({a: 1, c: 3}, {b: 2, c: 3}, {a: true, b: true})).toEqual({
|
||||
a: null,
|
||||
b: 2,
|
||||
});
|
||||
});
|
||||
|
||||
it('should skip fields that are equal', () => {
|
||||
expect(
|
||||
diff(
|
||||
{a: 1, b: 'two', c: true, d: false, e: undefined, f: 0},
|
||||
{a: 1, b: 'two', c: true, d: false, e: undefined, f: 0},
|
||||
{a: true, b: true, c: true, d: true, e: true, f: true},
|
||||
),
|
||||
).toEqual(null);
|
||||
});
|
||||
|
||||
it('should remove fields', () => {
|
||||
expect(diff({a: 1}, {}, {a: true})).toEqual({a: null});
|
||||
});
|
||||
|
||||
it('should remove fields that are set to undefined', () => {
|
||||
expect(diff({a: 1}, {a: undefined}, {a: true})).toEqual({a: null});
|
||||
});
|
||||
|
||||
it('should ignore invalid fields', () => {
|
||||
expect(diff({a: 1}, {b: 2}, {})).toEqual(null);
|
||||
});
|
||||
|
||||
it('should use the diff attribute', () => {
|
||||
const diffA = jest.fn((a, b) => true);
|
||||
const diffB = jest.fn((a, b) => false);
|
||||
expect(
|
||||
diff(
|
||||
{a: [1], b: [3]},
|
||||
{a: [2], b: [4]},
|
||||
{a: {diff: diffA}, b: {diff: diffB}},
|
||||
),
|
||||
).toEqual({a: [2]});
|
||||
expect(diffA).toBeCalledWith([1], [2]);
|
||||
expect(diffB).toBeCalledWith([3], [4]);
|
||||
});
|
||||
|
||||
it('should not use the diff attribute on addition/removal', () => {
|
||||
const diffA = jest.fn();
|
||||
const diffB = jest.fn();
|
||||
expect(
|
||||
diff({a: [1]}, {b: [2]}, {a: {diff: diffA}, b: {diff: diffB}}),
|
||||
).toEqual({a: null, b: [2]});
|
||||
expect(diffA).not.toBeCalled();
|
||||
expect(diffB).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('should do deep diffs of Objects by default', () => {
|
||||
expect(
|
||||
diff(
|
||||
{a: [1], b: {k: [3, 4]}, c: {k: [4, 4]}},
|
||||
{a: [2], b: {k: [3, 4]}, c: {k: [4, 5]}},
|
||||
{a: true, b: true, c: true},
|
||||
),
|
||||
).toEqual({a: [2], c: {k: [4, 5]}});
|
||||
});
|
||||
|
||||
it('should work with undefined styles', () => {
|
||||
expect(
|
||||
diff(
|
||||
{style: {a: '#ffffff', b: 1}},
|
||||
{style: undefined},
|
||||
{style: {b: true}},
|
||||
),
|
||||
).toEqual({b: null});
|
||||
expect(
|
||||
diff(
|
||||
{style: undefined},
|
||||
{style: {a: '#ffffff', b: 1}},
|
||||
{style: {b: true}},
|
||||
),
|
||||
).toEqual({b: 1});
|
||||
expect(
|
||||
diff({style: undefined}, {style: undefined}, {style: {b: true}}),
|
||||
).toEqual(null);
|
||||
});
|
||||
|
||||
it('should work with empty styles', () => {
|
||||
const validAttributes: AttributeConfiguration = {a: true, b: true};
|
||||
expect(diff({a: 1, c: 3}, {}, validAttributes)).toEqual({a: null});
|
||||
expect(diff({}, {a: 1, c: 3}, validAttributes)).toEqual({a: 1});
|
||||
expect(diff({}, {}, validAttributes)).toEqual(null);
|
||||
});
|
||||
|
||||
it('should flatten nested styles and predefined styles', () => {
|
||||
const validStyleAttribute: AttributeConfiguration = {
|
||||
style: {foo: true, bar: true},
|
||||
};
|
||||
|
||||
expect(
|
||||
diff({}, {style: [{foo: 1}, {bar: 2}]}, validStyleAttribute),
|
||||
).toEqual({foo: 1, bar: 2});
|
||||
|
||||
expect(
|
||||
diff({style: [{foo: 1}, {bar: 2}]}, {}, validStyleAttribute),
|
||||
).toEqual({foo: null, bar: null});
|
||||
|
||||
const barStyle = {
|
||||
bar: 3,
|
||||
};
|
||||
|
||||
expect(
|
||||
diff({}, {style: [[{foo: 1}, {foo: 2}], barStyle]}, validStyleAttribute),
|
||||
).toEqual({foo: 2, bar: 3});
|
||||
});
|
||||
|
||||
it('should reset a value to a previous if it is removed', () => {
|
||||
const validStyleAttribute: AttributeConfiguration = {
|
||||
style: {foo: true, bar: true},
|
||||
};
|
||||
|
||||
expect(
|
||||
diff(
|
||||
{style: [{foo: 1}, {foo: 3}]},
|
||||
{style: [{foo: 1}, {bar: 2}]},
|
||||
validStyleAttribute,
|
||||
),
|
||||
).toEqual({foo: 1, bar: 2});
|
||||
});
|
||||
|
||||
it('should not clear removed props if they are still in another slot', () => {
|
||||
const validStyleAttribute: AttributeConfiguration = {
|
||||
style: {foo: true, bar: true},
|
||||
};
|
||||
|
||||
expect(
|
||||
diff(
|
||||
{style: [{}, {foo: 3, bar: 2}]},
|
||||
{style: [{foo: 3}, {bar: 2}]},
|
||||
validStyleAttribute,
|
||||
),
|
||||
).toEqual({foo: 3}); // this should ideally be null. heuristic tradeoff.
|
||||
|
||||
expect(
|
||||
diff(
|
||||
{style: [{}, {foo: 3, bar: 2}]},
|
||||
{style: [{foo: 1, bar: 1}, {bar: 2}]},
|
||||
validStyleAttribute,
|
||||
),
|
||||
).toEqual({bar: 2, foo: 1});
|
||||
});
|
||||
|
||||
it('should clear a prop if a later style is explicit null/undefined', () => {
|
||||
const validStyleAttribute: AttributeConfiguration = {
|
||||
style: {foo: true, bar: true},
|
||||
};
|
||||
expect(
|
||||
diff(
|
||||
{style: [{}, {foo: 3, bar: 2}]},
|
||||
{style: [{foo: 1}, {bar: 2, foo: null}]},
|
||||
validStyleAttribute,
|
||||
),
|
||||
).toEqual({foo: null});
|
||||
|
||||
expect(
|
||||
diff(
|
||||
{style: [{foo: 3}, {foo: null, bar: 2}]},
|
||||
{style: [{foo: null}, {bar: 2}]},
|
||||
validStyleAttribute,
|
||||
),
|
||||
).toEqual({foo: null});
|
||||
|
||||
expect(
|
||||
diff(
|
||||
{style: [{foo: 1}, {foo: null}]},
|
||||
{style: [{foo: 2}, {foo: null}]},
|
||||
validStyleAttribute,
|
||||
),
|
||||
).toEqual({foo: null}); // this should ideally be null. heuristic.
|
||||
|
||||
// Test the same case with object equality because an early bailout doesn't
|
||||
// work in this case.
|
||||
const fooObj = {foo: 3};
|
||||
expect(
|
||||
diff(
|
||||
{style: [{foo: 1}, fooObj]},
|
||||
{style: [{foo: 2}, fooObj]},
|
||||
validStyleAttribute,
|
||||
),
|
||||
).toEqual({foo: 3}); // this should ideally be null. heuristic.
|
||||
|
||||
expect(
|
||||
diff(
|
||||
{style: [{foo: 1}, {foo: 3}]},
|
||||
{style: [{foo: 2}, {foo: undefined}]},
|
||||
validStyleAttribute,
|
||||
),
|
||||
).toEqual({foo: null}); // this should ideally be null. heuristic.
|
||||
});
|
||||
|
||||
it('handles attributes defined multiple times', () => {
|
||||
const validAttributes: AttributeConfiguration = {
|
||||
foo: true,
|
||||
style: {foo: true},
|
||||
};
|
||||
expect(diff({}, {foo: 4, style: {foo: 2}}, validAttributes)).toEqual({
|
||||
foo: 2,
|
||||
});
|
||||
expect(diff({foo: 4}, {style: {foo: 2}}, validAttributes)).toEqual({
|
||||
foo: 2,
|
||||
});
|
||||
expect(diff({style: {foo: 2}}, {foo: 4}, validAttributes)).toEqual({
|
||||
foo: 4,
|
||||
});
|
||||
});
|
||||
|
||||
// Function properties are just markers to native that events should be sent.
|
||||
it('should convert functions to booleans', () => {
|
||||
// Note that if the property changes from one function to another, we don't
|
||||
// need to send an update.
|
||||
expect(
|
||||
diff(
|
||||
{
|
||||
a: function () {
|
||||
return 1;
|
||||
},
|
||||
b: function () {
|
||||
return 2;
|
||||
},
|
||||
c: 3,
|
||||
},
|
||||
{
|
||||
b: function () {
|
||||
return 9;
|
||||
},
|
||||
c: function () {
|
||||
return 3;
|
||||
},
|
||||
},
|
||||
{a: true, b: true, c: true},
|
||||
),
|
||||
).toEqual({a: null, c: true});
|
||||
});
|
||||
|
||||
it('should skip changed functions', () => {
|
||||
expect(
|
||||
diff(
|
||||
{
|
||||
a: function () {
|
||||
return 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
a: function () {
|
||||
return 9;
|
||||
},
|
||||
},
|
||||
{a: true},
|
||||
),
|
||||
).toEqual(null);
|
||||
});
|
||||
|
||||
it('should skip deeply-nested changed functions', () => {
|
||||
expect(
|
||||
diff(
|
||||
{
|
||||
wrapper: {
|
||||
a: function () {
|
||||
return 1;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
wrapper: {
|
||||
a: function () {
|
||||
return 9;
|
||||
},
|
||||
},
|
||||
},
|
||||
{wrapper: true},
|
||||
),
|
||||
).toEqual(null);
|
||||
});
|
||||
|
||||
it('should use the process function config when prop is a function', () => {
|
||||
const process = jest.fn(a => a);
|
||||
const nextFunction = function () {};
|
||||
expect(
|
||||
diff(
|
||||
{
|
||||
a: function () {},
|
||||
},
|
||||
{
|
||||
a: nextFunction,
|
||||
},
|
||||
{a: {process}},
|
||||
),
|
||||
).toEqual({a: nextFunction});
|
||||
expect(process).toBeCalled();
|
||||
});
|
||||
});
|
||||
@@ -7,7 +7,7 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow strict
|
||||
* @generated SignedSource<<4216c04f5a8c40a833b0146588fab5fa>>
|
||||
* @generated SignedSource<<6166de7ecbfb5d83e56c11a3b6cde9ba>>
|
||||
*/
|
||||
|
||||
import type {
|
||||
@@ -35,15 +35,6 @@ 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,
|
||||
@@ -84,7 +75,7 @@ export type PartialViewConfig = $ReadOnly<{
|
||||
directEventTypes?: ViewConfig['directEventTypes'],
|
||||
supportsRawText?: boolean,
|
||||
uiViewClassName: string,
|
||||
validAttributes?: PartialAttributeConfiguration,
|
||||
validAttributes?: AttributeConfiguration,
|
||||
}>;
|
||||
|
||||
type InspectorDataProps = $ReadOnly<{
|
||||
|
||||
@@ -25,6 +25,6 @@ Pod::Spec.new do |s|
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = min_supported_versions
|
||||
s.source = source
|
||||
s.source_files = "**/*.{c,h,m,mm,cpp}"
|
||||
s.source_files = podspec_sources("**/*.{c,h,m,mm,cpp}", "**/*.h")
|
||||
s.header_dir = "RCTRequired"
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
|
||||
s.platforms = min_supported_versions
|
||||
s.compiler_flags = '-Wno-nullability-completeness'
|
||||
s.source = source
|
||||
s.source_files = "*.{m,mm}"
|
||||
s.source_files = podspec_sources("*.{m,mm}", "**/*.h")
|
||||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
||||
s.header_dir = "RCTSettings"
|
||||
s.pod_target_xcconfig = {
|
||||
|
||||
+13
-11
@@ -8,6 +8,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {BackgroundImageValue} from '../StyleSheetTypes';
|
||||
|
||||
import processBackgroundImage from '../processBackgroundImage';
|
||||
|
||||
const {OS} = require('../../Utilities/Platform').default;
|
||||
@@ -121,7 +123,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process a linear gradient object style with case-insensitive direction keyword', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: 'To Bottom',
|
||||
@@ -138,7 +140,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process a linear gradient object style with case-insensitive angle', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: '45DEG',
|
||||
@@ -350,7 +352,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process an array of style objects', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: 'to bottom right',
|
||||
@@ -374,7 +376,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process an style object with default direction', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [{color: 'red'}, {color: 'blue'}],
|
||||
@@ -388,7 +390,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process style object with direction enum', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: 'to right',
|
||||
@@ -403,7 +405,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process style object with direction angle', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
direction: '45deg',
|
||||
@@ -418,7 +420,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should fix up stop positions #1', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
@@ -456,7 +458,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should process multiple stop positions', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
@@ -493,7 +495,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should fix up stop positions #2', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
@@ -526,7 +528,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should fix up stop positions #3', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
@@ -559,7 +561,7 @@ describe('processBackgroundImage', () => {
|
||||
});
|
||||
|
||||
it('should fix up stop positions #4', () => {
|
||||
const input = [
|
||||
const input: $ReadOnlyArray<BackgroundImageValue> | string = [
|
||||
{
|
||||
type: 'linear-gradient' as const,
|
||||
colorStops: [
|
||||
|
||||
@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = min_supported_versions
|
||||
s.source = source
|
||||
s.source_files = "**/*.{h,m,mm}"
|
||||
s.source_files = podspec_sources("**/*.{h,m,mm}", "**/*.h")
|
||||
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
|
||||
s.header_dir = "RCTText"
|
||||
s.framework = ["MobileCoreServices"]
|
||||
|
||||
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = min_supported_versions
|
||||
s.source = source
|
||||
s.source_files = "**/*.{c,h,m,mm,cpp}"
|
||||
s.source_files = podspec_sources("**/*.{c,h,m,mm,cpp}", "**/*.h")
|
||||
s.header_dir = "RCTTypeSafety"
|
||||
s.pod_target_xcconfig = {
|
||||
"USE_HEADERMAP" => "YES",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user