mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
148
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b39ecde1fc | ||
|
|
c6608685cb | ||
|
|
53ce247dbd | ||
|
|
e441954c82 | ||
|
|
b50ad49a4d | ||
|
|
8c806ec31b | ||
|
|
a164874b1a | ||
|
|
0031377ae6 | ||
|
|
6b85c54ef4 | ||
|
|
7e8eadc041 | ||
|
|
bc7a9d9c4e | ||
|
|
167ec92f86 | ||
|
|
1348d7ee78 | ||
|
|
2ae154f650 | ||
|
|
5ba0e1f97a | ||
|
|
482f737ee1 | ||
|
|
02203f8608 | ||
|
|
d6efe9a56f | ||
|
|
0b4429a33e | ||
|
|
ca647c13c2 | ||
|
|
448fe573e0 | ||
|
|
823414e691 | ||
|
|
e5049091c5 | ||
|
|
818e62e977 | ||
|
|
3d97bac5f2 | ||
|
|
9b82e706fb | ||
|
|
da0938edfd | ||
|
|
dca83bc158 | ||
|
|
04858ecbab | ||
|
|
d8e00f0bb1 | ||
|
|
07f6f70aef | ||
|
|
ece8ca82cd | ||
|
|
08a59c59e0 | ||
|
|
fbd44ade3a | ||
|
|
4f94028ca6 | ||
|
|
0a567a63cd | ||
|
|
19ebd4c188 | ||
|
|
a2a72e239d | ||
|
|
fedceecc37 | ||
|
|
e3047db0dc | ||
|
|
1e212f91bc | ||
|
|
4f1f72ea34 | ||
|
|
fe1aacae6d | ||
|
|
a82b5acf3d | ||
|
|
8cc2874d3f | ||
|
|
d012b2c19b | ||
|
|
cfc6960bc4 | ||
|
|
ef742dbc68 | ||
|
|
11a1ad7a98 | ||
|
|
b01a5f91fe | ||
|
|
65ae3dafcd | ||
|
|
d3495fd162 | ||
|
|
252e1345bf | ||
|
|
dd1b795abe | ||
|
|
c125f306c2 | ||
|
|
03ab6a3098 | ||
|
|
46b562b9b3 | ||
|
|
c1bf39bfdf | ||
|
|
f238b74658 | ||
|
|
76e2ab4ac8 | ||
|
|
35dba09724 | ||
|
|
9e96acbd0f | ||
|
|
40b8f4ad22 | ||
|
|
3306691d64 | ||
|
|
f184b591cf | ||
|
|
62d8d30652 | ||
|
|
60967fdffb | ||
|
|
4b91b63094 | ||
|
|
7f7655d711 | ||
|
|
76e04fac82 | ||
|
|
18f4db44ef | ||
|
|
251eb3fd4c | ||
|
|
3782fe865d | ||
|
|
5742227dd8 | ||
|
|
90654e4ba2 | ||
|
|
60c01b4715 | ||
|
|
69e028da45 | ||
|
|
152cb538f6 | ||
|
|
2ec6e3d901 | ||
|
|
1a86ee17fb | ||
|
|
8888cf9a2d | ||
|
|
27c97ac942 | ||
|
|
e69f0726cd | ||
|
|
1ced97fbe6 | ||
|
|
ff7e24f19a | ||
|
|
d9ec57a3b9 | ||
|
|
33fed54a16 | ||
|
|
7b7b538d6b | ||
|
|
9612d2e225 | ||
|
|
ee8b66e278 | ||
|
|
f214a52a9a | ||
|
|
f338db9c17 | ||
|
|
fe4047fe3a | ||
|
|
9f479ff8d6 | ||
|
|
dda8ab69d4 | ||
|
|
f04d1f1ef7 | ||
|
|
54a1e41694 | ||
|
|
269cf58140 | ||
|
|
941853974b | ||
|
|
36c0826f56 | ||
|
|
7970f79078 | ||
|
|
37e863e866 | ||
|
|
5961edd825 | ||
|
|
71d6d86ed6 | ||
|
|
0a7e1342cd | ||
|
|
891656d055 | ||
|
|
abbef4a0b8 | ||
|
|
e888329e9a | ||
|
|
1f8374e1dd | ||
|
|
a10ee5808b | ||
|
|
ab2ce4f2d8 | ||
|
|
ee256d11ae | ||
|
|
1f53d51e64 | ||
|
|
4f71a9434d | ||
|
|
ed9969b3d0 | ||
|
|
04da4800da | ||
|
|
bc093b8fa9 | ||
|
|
fbbd20dd63 | ||
|
|
710e08cd54 | ||
|
|
cc442eb8c8 | ||
|
|
aaad7e083d | ||
|
|
999f437b02 | ||
|
|
ffb37373ba | ||
|
|
e297fe1582 | ||
|
|
386a930afb | ||
|
|
281f48daf4 | ||
|
|
a44098ea27 | ||
|
|
0f7bf66bba | ||
|
|
14a213229a | ||
|
|
4223285a23 | ||
|
|
55b87a5293 | ||
|
|
0cf2985d27 | ||
|
|
2f3b104224 | ||
|
|
6a3116a8a9 | ||
|
|
432ad09c41 | ||
|
|
b950fa2afb | ||
|
|
52df5dee91 | ||
|
|
50ea5b4380 | ||
|
|
184664d47b | ||
|
|
2b75479fa2 | ||
|
|
2a52ee8ddb | ||
|
|
1d945629bf | ||
|
|
7885508f9b | ||
|
|
5e331304cb | ||
|
|
f00b449498 | ||
|
|
94cbf206d6 | ||
|
|
6bfc1187a8 | ||
|
|
29704b1f02 |
+3
-1
@@ -47,6 +47,8 @@ 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
|
||||
|
||||
@@ -103,4 +105,4 @@ untyped-import
|
||||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.273.1
|
||||
^0.274.0
|
||||
|
||||
@@ -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'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+260
-5133
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")
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -58,7 +58,7 @@
|
||||
"@typescript-eslint/parser": "^7.1.1",
|
||||
"ansi-styles": "^4.2.1",
|
||||
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
|
||||
"babel-plugin-syntax-hermes-parser": "0.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",
|
||||
@@ -76,11 +76,11 @@
|
||||
"eslint-plugin-react-native": "^4.0.0",
|
||||
"eslint-plugin-redundant-undefined": "^0.4.0",
|
||||
"eslint-plugin-relay": "^1.8.3",
|
||||
"flow-api-translator": "0.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",
|
||||
@@ -96,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"
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
|
||||
+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
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -17,6 +17,7 @@ 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';
|
||||
|
||||
@@ -152,6 +153,7 @@ test('animation driven by onScroll event', () => {
|
||||
|
||||
test('animated opacity', () => {
|
||||
let _opacity;
|
||||
let _opacityAnimation;
|
||||
const viewRef = createRef<HostInstance>();
|
||||
|
||||
function MyApp() {
|
||||
@@ -182,7 +184,7 @@ test('animated opacity', () => {
|
||||
expect(viewElement.getBoundingClientRect().x).toBe(0);
|
||||
|
||||
Fantom.runTask(() => {
|
||||
Animated.timing(_opacity, {
|
||||
_opacityAnimation = Animated.timing(_opacity, {
|
||||
toValue: 0,
|
||||
duration: 30,
|
||||
useNativeDriver: true,
|
||||
@@ -194,8 +196,10 @@ test('animated opacity', () => {
|
||||
0,
|
||||
);
|
||||
|
||||
// TODO(T223344928): this shouldn't be neccessary with cxxNativeAnimatedRemoveJsSync:true
|
||||
Fantom.runWorkLoop();
|
||||
// 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" />,
|
||||
@@ -475,3 +479,61 @@ describe('Value.extractOffset', () => {
|
||||
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" />,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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: {...}> = {
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
+6
-4
@@ -281,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>,
|
||||
@@ -362,7 +364,7 @@ const Button: component(
|
||||
: importantForAccessibility;
|
||||
|
||||
return (
|
||||
<Touchable
|
||||
<NativeTouchable
|
||||
accessible={accessible}
|
||||
accessibilityActions={accessibilityActions}
|
||||
onAccessibilityAction={onAccessibilityAction}
|
||||
@@ -391,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<{
|
||||
|
||||
@@ -24,7 +24,7 @@ import * as React from 'react';
|
||||
* 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({
|
||||
@@ -32,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
+1
-1
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {PartialAttributeConfiguration as AttributeConfiguration} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import type {AttributeConfiguration} from '../../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
import flattenStyle from '../../StyleSheet/flattenStyle';
|
||||
import deepDiffer from '../../Utilities/differ/deepDiffer';
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PartialAttributeConfiguration as AttributeConfiguration} from '../../../Renderer/shims/ReactNativeTypes';
|
||||
import type {AttributeConfiguration} from '../../../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
const {create, diff} = require('../ReactNativeAttributePayload');
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -9,6 +9,4 @@
|
||||
*/
|
||||
|
||||
export * from '../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo';
|
||||
import NativeDeviceInfo from '../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo';
|
||||
|
||||
export default NativeDeviceInfo;
|
||||
export {default} from '../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo';
|
||||
|
||||
@@ -23,7 +23,7 @@ type Options = $ReadOnly<{
|
||||
excludedPlatforms?: $ReadOnlyArray<'iOS' | 'android'>,
|
||||
}>;
|
||||
|
||||
export type NativeComponentType<T> = HostComponent<T>;
|
||||
export type NativeComponentType<T: {...}> = HostComponent<T>;
|
||||
|
||||
// If this function runs then that means the view configs were not
|
||||
// generated at build time using `GenerateViewConfigJs.js`. Thus
|
||||
|
||||
@@ -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 = "RCTVibration"
|
||||
s.pod_target_xcconfig = {
|
||||
|
||||
@@ -136,7 +136,7 @@ export type EventConfig<T> = {
|
||||
useNativeDriver: boolean,
|
||||
platformConfig?: PlatformConfig,
|
||||
};
|
||||
declare export function attachNativeEvent(
|
||||
declare export function attachNativeEventImpl(
|
||||
viewRef: any,
|
||||
eventName: string,
|
||||
argMapping: $ReadOnlyArray<?Mapping>,
|
||||
@@ -166,7 +166,10 @@ declare export default {
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Animated/AnimatedExports.js.flow 1`] = `
|
||||
"export { default as FlatList } from \\"./components/AnimatedFlatList\\";
|
||||
"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\\";
|
||||
export { default as SectionList } from \\"./components/AnimatedSectionList\\";
|
||||
@@ -185,6 +188,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\\";
|
||||
@@ -222,53 +226,53 @@ exports[`public API should not change unintentionally Libraries/Animated/Animate
|
||||
reset: () => void,
|
||||
...
|
||||
};
|
||||
declare const add: (
|
||||
declare const addImpl: (
|
||||
a: AnimatedNode | number,
|
||||
b: AnimatedNode | number
|
||||
) => AnimatedAddition;
|
||||
declare const subtract: (
|
||||
declare const subtractImpl: (
|
||||
a: AnimatedNode | number,
|
||||
b: AnimatedNode | number
|
||||
) => AnimatedSubtraction;
|
||||
declare const divide: (
|
||||
declare const divideImpl: (
|
||||
a: AnimatedNode | number,
|
||||
b: AnimatedNode | number
|
||||
) => AnimatedDivision;
|
||||
declare const multiply: (
|
||||
declare const multiplyImpl: (
|
||||
a: AnimatedNode | number,
|
||||
b: AnimatedNode | number
|
||||
) => AnimatedMultiplication;
|
||||
declare const modulo: (a: AnimatedNode, modulus: number) => AnimatedModulo;
|
||||
declare const diffClamp: (
|
||||
declare const moduloImpl: (a: AnimatedNode, modulus: number) => AnimatedModulo;
|
||||
declare const diffClampImpl: (
|
||||
a: AnimatedNode,
|
||||
min: number,
|
||||
max: number
|
||||
) => AnimatedDiffClamp;
|
||||
declare const spring: (
|
||||
declare const springImpl: (
|
||||
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
||||
config: SpringAnimationConfig
|
||||
) => CompositeAnimation;
|
||||
declare const timing: (
|
||||
declare const timingImpl: (
|
||||
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
||||
config: TimingAnimationConfig
|
||||
) => CompositeAnimation;
|
||||
declare const decay: (
|
||||
declare const decayImpl: (
|
||||
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
||||
config: DecayAnimationConfig
|
||||
) => CompositeAnimation;
|
||||
declare const sequence: (
|
||||
declare const sequenceImpl: (
|
||||
animations: Array<CompositeAnimation>
|
||||
) => CompositeAnimation;
|
||||
type ParallelConfig = {
|
||||
stopTogether?: boolean,
|
||||
...
|
||||
};
|
||||
declare const parallel: (
|
||||
declare const parallelImpl: (
|
||||
animations: Array<CompositeAnimation>,
|
||||
config?: ?ParallelConfig
|
||||
) => CompositeAnimation;
|
||||
declare const delay: (time: number) => CompositeAnimation;
|
||||
declare const stagger: (
|
||||
declare const delayImpl: (time: number) => CompositeAnimation;
|
||||
declare const staggerImpl: (
|
||||
time: number,
|
||||
animations: Array<CompositeAnimation>
|
||||
) => CompositeAnimation;
|
||||
@@ -277,19 +281,19 @@ type LoopAnimationConfig = {
|
||||
resetBeforeIteration?: boolean,
|
||||
...
|
||||
};
|
||||
declare const loop: (
|
||||
declare const loopImpl: (
|
||||
animation: CompositeAnimation,
|
||||
$$PARAM_1$$?: LoopAnimationConfig
|
||||
) => CompositeAnimation;
|
||||
declare function forkEvent(
|
||||
declare function forkEventImpl(
|
||||
event: ?AnimatedEvent | ?Function,
|
||||
listener: Function
|
||||
): AnimatedEvent | Function;
|
||||
declare function unforkEvent(
|
||||
declare function unforkEventImpl(
|
||||
event: ?AnimatedEvent | ?Function,
|
||||
listener: Function
|
||||
): void;
|
||||
declare const event: <T>(
|
||||
declare const eventImpl: <T>(
|
||||
argMapping: $ReadOnlyArray<?Mapping>,
|
||||
config: EventConfig<T>
|
||||
) => any;
|
||||
@@ -309,25 +313,25 @@ declare export default {
|
||||
Color: typeof AnimatedColor,
|
||||
Interpolation: typeof AnimatedInterpolation,
|
||||
Node: typeof AnimatedNode,
|
||||
decay: typeof decay,
|
||||
timing: typeof timing,
|
||||
spring: typeof spring,
|
||||
add: typeof add,
|
||||
subtract: typeof subtract,
|
||||
divide: typeof divide,
|
||||
multiply: typeof multiply,
|
||||
modulo: typeof modulo,
|
||||
diffClamp: typeof diffClamp,
|
||||
delay: typeof delay,
|
||||
sequence: typeof sequence,
|
||||
parallel: typeof parallel,
|
||||
stagger: typeof stagger,
|
||||
loop: typeof loop,
|
||||
event: typeof event,
|
||||
decay: typeof decayImpl,
|
||||
timing: typeof timingImpl,
|
||||
spring: typeof springImpl,
|
||||
add: typeof addImpl,
|
||||
subtract: typeof subtractImpl,
|
||||
divide: typeof divideImpl,
|
||||
multiply: typeof multiplyImpl,
|
||||
modulo: typeof moduloImpl,
|
||||
diffClamp: typeof diffClampImpl,
|
||||
delay: typeof delayImpl,
|
||||
sequence: typeof sequenceImpl,
|
||||
parallel: typeof parallelImpl,
|
||||
stagger: typeof staggerImpl,
|
||||
loop: typeof loopImpl,
|
||||
event: typeof eventImpl,
|
||||
createAnimatedComponent: typeof createAnimatedComponent,
|
||||
attachNativeEvent: typeof attachNativeEvent,
|
||||
forkEvent: typeof forkEvent,
|
||||
unforkEvent: typeof unforkEvent,
|
||||
attachNativeEvent: typeof attachNativeEventImpl,
|
||||
forkEvent: typeof forkEventImpl,
|
||||
unforkEvent: typeof unforkEventImpl,
|
||||
Event: typeof AnimatedEvent,
|
||||
};
|
||||
"
|
||||
@@ -628,10 +632,9 @@ exports[`public API should not change unintentionally Libraries/Animated/compone
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Animated/components/AnimatedScrollView.js 1`] = `
|
||||
"type AnimatedScrollViewProps = React.ElementConfig<typeof ScrollView>;
|
||||
type AnimatedScrollViewInstance = React.ElementRef<typeof ScrollView>;
|
||||
"type AnimatedScrollViewInstance = React.ElementRef<typeof ScrollView>;
|
||||
declare const AnimatedScrollView: AnimatedComponentType<
|
||||
AnimatedScrollViewProps,
|
||||
ScrollViewProps,
|
||||
AnimatedScrollViewInstance,
|
||||
>;
|
||||
declare export default typeof AnimatedScrollView;
|
||||
@@ -648,7 +651,7 @@ exports[`public API should not change unintentionally Libraries/Animated/compone
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Animated/components/AnimatedText.js 1`] = `
|
||||
"declare export default AnimatedComponentType<
|
||||
React.ElementConfig<typeof Text>,
|
||||
TextProps,
|
||||
React.ElementRef<typeof Text>,
|
||||
>;
|
||||
"
|
||||
@@ -656,7 +659,7 @@ exports[`public API should not change unintentionally Libraries/Animated/compone
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Animated/components/AnimatedView.js 1`] = `
|
||||
"declare export default AnimatedComponentType<
|
||||
React.ElementConfig<typeof View>,
|
||||
ViewProps,
|
||||
React.ElementRef<typeof View>,
|
||||
>;
|
||||
"
|
||||
@@ -695,9 +698,7 @@ type NonAnimatedProps =
|
||||
| \\"disabled\\"
|
||||
| \\"accessibilityLabel\\";
|
||||
type PassThroughProps = $ReadOnly<{
|
||||
passthroughAnimatedPropExplicitValues?: React.ElementConfig<
|
||||
typeof View,
|
||||
> | null,
|
||||
passthroughAnimatedPropExplicitValues?: ViewProps | null,
|
||||
}>;
|
||||
export type AnimatedProps<Props: { ... }> = {
|
||||
[K in keyof Props]: K extends NonAnimatedProps
|
||||
@@ -1538,10 +1539,10 @@ exports[`public API should not change unintentionally Libraries/Components/Butto
|
||||
accessibilityHint?: ?string,
|
||||
accessibilityLanguage?: ?Stringish,
|
||||
}>;
|
||||
declare const Touchable:
|
||||
declare const NativeTouchable:
|
||||
| typeof TouchableNativeFeedback
|
||||
| typeof TouchableOpacity;
|
||||
type ButtonRef = React.ElementRef<typeof Touchable>;
|
||||
type ButtonRef = React.ElementRef<typeof NativeTouchable>;
|
||||
declare const Button: component(
|
||||
ref?: React.RefSetter<ButtonRef>,
|
||||
...props: ButtonProps
|
||||
@@ -1757,8 +1758,7 @@ declare export default typeof LayoutConformanceNativeComponent;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Components/Pressable/Pressable.js 1`] = `
|
||||
"type ViewStyleProp = React.ElementConfig<typeof View>[\\"style\\"];
|
||||
export type { PressableAndroidRippleConfig };
|
||||
"export type { PressableAndroidRippleConfig };
|
||||
export type PressableStateCallbackType = $ReadOnly<{
|
||||
pressed: boolean,
|
||||
}>;
|
||||
@@ -1932,11 +1932,11 @@ export { default } from \\"../../../src/private/specs_DEPRECATED/components/RCTS
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Components/SafeAreaView/SafeAreaView.js 1`] = `
|
||||
"declare const exported: component(
|
||||
"declare const SafeAreaView: component(
|
||||
ref?: React.RefSetter<React.ElementRef<typeof View>>,
|
||||
...props: ViewProps
|
||||
);
|
||||
declare export default typeof exported;
|
||||
declare export default typeof SafeAreaView;
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -4179,11 +4179,11 @@ exports[`public API should not change unintentionally Libraries/EventEmitter/Nat
|
||||
type EmitterSubscription = EventSubscription;
|
||||
export type { EventSubscription, EmitterSubscription };
|
||||
export type NativeEventSubscription = EventSubscription;
|
||||
type UnsafeObject = Object;
|
||||
type UnsafeNativeEventObject = Object;
|
||||
declare 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>
|
||||
{
|
||||
constructor(nativeModule?: ?NativeModule): void;
|
||||
@@ -4859,13 +4859,13 @@ export type LayoutAnimationProperties = $ReadOnly<{
|
||||
}>;
|
||||
type OnAnimationDidEndCallback = () => void;
|
||||
type OnAnimationDidFailCallback = () => void;
|
||||
declare function setEnabled(value: boolean): void;
|
||||
declare function setLayoutAnimationEnabled(value: boolean): void;
|
||||
declare function configureNext(
|
||||
config: LayoutAnimationConfig,
|
||||
onAnimationDidEnd?: OnAnimationDidEndCallback,
|
||||
onAnimationDidFail?: OnAnimationDidFailCallback
|
||||
): void;
|
||||
declare function create(
|
||||
declare function createLayoutAnimation(
|
||||
duration: number,
|
||||
type?: LayoutAnimationType,
|
||||
property?: LayoutAnimationProperty
|
||||
@@ -4877,7 +4877,7 @@ declare const Presets: {
|
||||
};
|
||||
declare const LayoutAnimation: {
|
||||
configureNext: typeof configureNext,
|
||||
create: typeof create,
|
||||
create: typeof createLayoutAnimation,
|
||||
Types: LayoutAnimationTypes,
|
||||
Properties: LayoutAnimationProperties,
|
||||
checkConfig(...args: Array<mixed>): void,
|
||||
@@ -4885,7 +4885,7 @@ declare const LayoutAnimation: {
|
||||
easeInEaseOut: (onAnimationDidEnd?: OnAnimationDidEndCallback) => void,
|
||||
linear: (onAnimationDidEnd?: OnAnimationDidEndCallback) => void,
|
||||
spring: (onAnimationDidEnd?: OnAnimationDidEndCallback) => void,
|
||||
setEnabled: typeof setEnabled,
|
||||
setEnabled: typeof setLayoutAnimationEnabled,
|
||||
};
|
||||
declare export default typeof LayoutAnimation;
|
||||
"
|
||||
@@ -4940,8 +4940,7 @@ declare export default typeof FillRateHelper;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Lists/FlatList.js 1`] = `
|
||||
"declare const VirtualizedList: typeof VirtualizedLists.VirtualizedList;
|
||||
type RequiredProps<ItemT> = {
|
||||
"type RequiredProps<ItemT> = {
|
||||
data: ?$ReadOnly<$ArrayLike<ItemT>>,
|
||||
};
|
||||
type OptionalProps<ItemT> = {
|
||||
@@ -4971,7 +4970,6 @@ type FlatListBaseProps<ItemT> = {
|
||||
...RequiredProps<ItemT>,
|
||||
...OptionalProps<ItemT>,
|
||||
};
|
||||
type VirtualizedListProps = React.ElementConfig<typeof VirtualizedList>;
|
||||
export type FlatListProps<ItemT> = {
|
||||
...Omit<
|
||||
VirtualizedListProps,
|
||||
@@ -6147,7 +6145,7 @@ type PermissionsType = $ReadOnly<{
|
||||
}>;
|
||||
export type PermissionStatus = \\"granted\\" | \\"denied\\" | \\"never_ask_again\\";
|
||||
export type Permission = $Values<PermissionsType>;
|
||||
declare class PermissionsAndroid {
|
||||
declare class PermissionsAndroidImpl {
|
||||
PERMISSIONS: PermissionsType;
|
||||
RESULTS: $ReadOnly<{
|
||||
DENIED: \\"denied\\",
|
||||
@@ -6168,7 +6166,7 @@ declare class PermissionsAndroid {
|
||||
permissions: Array<Permission>
|
||||
): Promise<{ [permission: Permission]: PermissionStatus, ... }>;
|
||||
}
|
||||
declare const PermissionsAndroidInstance: PermissionsAndroid;
|
||||
declare const PermissionsAndroidInstance: PermissionsAndroidImpl;
|
||||
declare export default typeof PermissionsAndroidInstance;
|
||||
"
|
||||
`;
|
||||
@@ -6434,8 +6432,8 @@ declare export default typeof AppContainer;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/ReactNative/AppRegistry.flow.js 1`] = `
|
||||
"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 = (
|
||||
component_: ComponentProvider,
|
||||
@@ -8365,7 +8363,7 @@ declare export default typeof NativeDevLoadingView;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Utilities/NativeDeviceInfo.js 1`] = `
|
||||
"export * from \\"../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo\\";
|
||||
declare export default typeof NativeDeviceInfo;
|
||||
export { default } from \\"../../src/private/specs_DEPRECATED/modules/NativeDeviceInfo\\";
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -8656,7 +8654,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/codege
|
||||
paperComponentNameDeprecated?: string,
|
||||
excludedPlatforms?: $ReadOnlyArray<\\"iOS\\" | \\"android\\">,
|
||||
}>;
|
||||
export type NativeComponentType<T> = HostComponent<T>;
|
||||
export type NativeComponentType<T: { ... }> = HostComponent<T>;
|
||||
declare function codegenNativeComponent<Props: { ... }>(
|
||||
componentName: string,
|
||||
options?: Options
|
||||
@@ -8961,12 +8959,12 @@ declare export default ErrorUtils;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/vendor/emitter/EventEmitter.js 1`] = `
|
||||
"type UnsafeObject = Object;
|
||||
"type UnsafeEventObject = Object;
|
||||
export interface EventSubscription {
|
||||
remove(): void;
|
||||
}
|
||||
export interface IEventEmitter<
|
||||
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
||||
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
|
||||
> {
|
||||
addListener<TEvent: $Keys<TEventToArgsMap>>(
|
||||
eventType: TEvent,
|
||||
@@ -8982,8 +8980,8 @@ export interface IEventEmitter<
|
||||
}
|
||||
declare export default class EventEmitter<
|
||||
TEventToArgsMap: $ReadOnly<
|
||||
Record<string, $ReadOnlyArray<UnsafeObject>>,
|
||||
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
||||
Record<string, $ReadOnlyArray<UnsafeEventObject>>,
|
||||
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
|
||||
> implements IEventEmitter<TEventToArgsMap>
|
||||
{
|
||||
constructor(): void;
|
||||
@@ -9063,6 +9061,8 @@ export type {
|
||||
export { default as RefreshControl } from \\"./Libraries/Components/RefreshControl/RefreshControl\\";
|
||||
export { default as SafeAreaView } from \\"./Libraries/Components/SafeAreaView/SafeAreaView\\";
|
||||
export type {
|
||||
ScrollViewImperativeMethods,
|
||||
ScrollViewScrollToOptions,
|
||||
ScrollResponderType,
|
||||
ScrollViewProps,
|
||||
ScrollViewPropsAndroid,
|
||||
@@ -9349,6 +9349,11 @@ export type {
|
||||
PublicRootInstance,
|
||||
PublicTextInstance,
|
||||
} from \\"./Libraries/ReactPrivate/ReactNativePrivateInterface\\";
|
||||
export {
|
||||
default as unstable_VirtualView,
|
||||
VirtualViewMode,
|
||||
} from \\"./src/private/components/virtualview/VirtualView\\";
|
||||
export type { ModeChangeEvent } from \\"./src/private/components/virtualview/VirtualView\\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import type {TransformVisitor} from 'hermes-transform';
|
||||
|
||||
const {
|
||||
visitors: stripPrivateProperties,
|
||||
} = require('../../../../scripts/build-types/transforms/stripPrivateProperties');
|
||||
} = require('../../../../scripts/build-types/transforms/flow/stripPrivateProperties');
|
||||
const translate = require('flow-api-translator');
|
||||
const {existsSync, promises: fs} = require('fs');
|
||||
const glob = require('glob');
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
*/
|
||||
|
||||
// $FlowFixMe[unclear-type] unclear type of events
|
||||
type UnsafeObject = Object;
|
||||
type UnsafeEventObject = Object;
|
||||
|
||||
export interface EventSubscription {
|
||||
remove(): void;
|
||||
}
|
||||
|
||||
export interface IEventEmitter<
|
||||
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
||||
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
|
||||
> {
|
||||
addListener<TEvent: $Keys<TEventToArgsMap>>(
|
||||
eventType: TEvent,
|
||||
@@ -41,7 +41,7 @@ interface Registration<TArgs> {
|
||||
}
|
||||
|
||||
type Registry<
|
||||
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
||||
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
|
||||
> = {
|
||||
[K in keyof TEventToArgsMap]: Set<Registration<TEventToArgsMap[K]>>,
|
||||
};
|
||||
@@ -68,8 +68,8 @@ type Registry<
|
||||
*/
|
||||
export default class EventEmitter<
|
||||
TEventToArgsMap: $ReadOnly<
|
||||
Record<string, $ReadOnlyArray<UnsafeObject>>,
|
||||
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
||||
Record<string, $ReadOnlyArray<UnsafeEventObject>>,
|
||||
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
|
||||
> implements IEventEmitter<TEventToArgsMap>
|
||||
{
|
||||
#registry: Registry<TEventToArgsMap>;
|
||||
@@ -157,7 +157,7 @@ export default class EventEmitter<
|
||||
}
|
||||
|
||||
function allocate<
|
||||
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
||||
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<UnsafeEventObject>>>,
|
||||
TEvent: $Keys<TEventToArgsMap>,
|
||||
TEventArgs: TEventToArgsMap[TEvent],
|
||||
>(
|
||||
|
||||
@@ -397,6 +397,7 @@ let reactFabric = RNTarget(
|
||||
"components/textinput",
|
||||
"components/textinput/platform/ios/",
|
||||
"components/unimplementedview",
|
||||
"components/virtualview",
|
||||
"components/root/tests",
|
||||
],
|
||||
dependencies: [.reactNativeDependencies, .reactJsiExecutor, .rctTypesafety, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .reactRendererDebug, .reactGraphics, .yoga],
|
||||
@@ -415,6 +416,8 @@ let reactFabricComponents = RNTarget(
|
||||
name: .reactFabricComponents,
|
||||
path: "ReactCommon/react/renderer",
|
||||
excludedPaths: [
|
||||
"components/modal/platform/android",
|
||||
"components/modal/platform/cxx",
|
||||
"components/view/platform/android",
|
||||
"components/view/platform/windows",
|
||||
"components/view/platform/macos",
|
||||
@@ -430,7 +433,7 @@ let reactFabricComponents = RNTarget(
|
||||
"conponents/rncore", // this was the old folder where RN Core Components were generated. If you ran codegen in the past, you might have some files in it that might make the build fail.
|
||||
],
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging],
|
||||
sources: ["components/inputaccessory", "components/modal", "components/safeareaview", "components/text", "components/text/platform/cxx", "components/textinput", "components/textinput/platform/ios/", "components/unimplementedview", "textlayoutmanager", "textlayoutmanager/platform/ios"]
|
||||
sources: ["components/inputaccessory", "components/modal", "components/safeareaview", "components/text", "components/text/platform/cxx", "components/textinput", "components/textinput/platform/ios/", "components/unimplementedview", "components/virtualview", "textlayoutmanager", "textlayoutmanager/platform/ios"]
|
||||
)
|
||||
|
||||
/// React-FabricImage.podspec
|
||||
@@ -492,6 +495,14 @@ let reactRCTNetwork = RNTarget(
|
||||
dependencies: [.yoga, .jsi, .reactTurboModuleCore]
|
||||
)
|
||||
|
||||
/// React-RCTVibration.podspec
|
||||
let reactRCTVibration = RNTarget(
|
||||
name: .reactRCTVibration,
|
||||
path: "Libraries/Vibration",
|
||||
linkedFrameworks: ["AudioToolbox"],
|
||||
dependencies: [.yoga, .jsi, .reactTurboModuleCore]
|
||||
)
|
||||
|
||||
/// React-RCTAppDelegate.podspec
|
||||
let reactAppDelegate = RNTarget(
|
||||
name: .reactAppDelegate,
|
||||
@@ -557,6 +568,7 @@ let targets = [
|
||||
reactRCTText,
|
||||
reactRCTBlob,
|
||||
reactRCTNetwork,
|
||||
reactRCTVibration,
|
||||
reactRCTLinking,
|
||||
reactCoreModules,
|
||||
reactTurboModuleBridging,
|
||||
@@ -728,6 +740,7 @@ extension String {
|
||||
static let reactRCTText = "React-RCTText"
|
||||
static let reactRCTBlob = "React-RCTBlob"
|
||||
static let reactRCTNetwork = "React-RCTNetwork"
|
||||
static let reactRCTVibration = "React-RCTVibration"
|
||||
static let reactRCTActionSheet = "React-RCTActionSheet" // Empty target
|
||||
static let reactRCTLinking = "React-RCTLinking"
|
||||
static let reactCoreModules = "React-CoreModules"
|
||||
|
||||
@@ -4,95 +4,53 @@
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
require "json"
|
||||
|
||||
begin
|
||||
react_native_path = File.dirname(Pod::Executable.execute_command('node', ['-p',
|
||||
'require.resolve(
|
||||
"react-native",
|
||||
{paths: [process.argv[1]]},
|
||||
)', __dir__]).strip
|
||||
)
|
||||
rescue => e
|
||||
# Fallback to the parent directory if the above command fails (e.g when building locally in OOT Platform)
|
||||
react_native_path = File.join(__dir__, "..", "..")
|
||||
end
|
||||
|
||||
# package.json
|
||||
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
|
||||
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
||||
version = package['version']
|
||||
|
||||
source = ReactNativeCoreUtils.resolve_podspec_source()
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React-Core-prebuilt"
|
||||
s.version = version
|
||||
s.summary = "The core of React Native prebuilt frameworks."
|
||||
s.homepage = "https://reactnative.dev/"
|
||||
s.license = package["license"]
|
||||
s.author = "Meta Platforms, Inc. and its affiliates"
|
||||
s.platforms = min_supported_versions
|
||||
s.source = source
|
||||
s.vendored_frameworks = "React.xcframework"
|
||||
|
||||
header_search_paths = [
|
||||
"${PODS_ROOT}/Headers/Private/React-Core-prebuilt",
|
||||
"${PODS_ROOT}/Headers/Private/React-Core-prebuilt/RCTDeprecation",
|
||||
"${PODS_ROOT}/Headers/Private/React-Core-prebuilt/ReactCommon/yoga",
|
||||
"${PODS_ROOT}/Headers/Private/React-Core-prebuilt/ReactCommon",
|
||||
"${PODS_ROOT}/Headers/Private/React-Core-prebuilt/Libraries/AppDelegate",
|
||||
"${PODS_ROOT}/Headers/Private/React-Core-prebuilt/Libraries",
|
||||
s.preserve_paths = '**/*.*'
|
||||
s.header_mappings_dir = 'React.xcframework/Headers'
|
||||
s.source_files = 'React.xcframework/Headers/**/*.{h,hpp}'
|
||||
|
||||
"$(REACT_NATIVE_PATH)/React/Base",
|
||||
"$(REACT_NATIVE_PATH)/ReactCommon",
|
||||
"$(REACT_NATIVE_PATH)/Libraries",
|
||||
"$(REACT_NATIVE_PATH)/ReactApple",
|
||||
"$(REACT_NATIVE_PATH)/ReactCxxPlatform",
|
||||
"$(REACT_NATIVE_PATH)/ReactCommon/react/runtime/platform/ios",
|
||||
"${REACT_NATIVE_PATH}/ReactCommon/jsi",
|
||||
"$(REACT_NATIVE_PATH)/ReactCommon/jsiexecutor/",
|
||||
"$(REACT_NATIVE_PATH)/ReactCommon/react/nativemodule/samples/platform/ios",
|
||||
"$(REACT_NATIVE_PATH)/ReactCommon/react/nativemodule/samples",
|
||||
]
|
||||
s.module_name = 'React'
|
||||
s.module_map = 'React.xcframework/Modules/module.modulemap'
|
||||
s.public_header_files = 'React.xcframework/Headers/**/*.h'
|
||||
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'React-Core-prebuilt'
|
||||
spec.version = version
|
||||
spec.summary = "Prebuilt core of React Native."
|
||||
spec.homepage = "https://reactnative.dev/"
|
||||
spec.description = 'Prebuilt React Native Core libraries and headers'
|
||||
spec.homepage = 'https://github.com/facebook/react-native'
|
||||
spec.license = package['license']
|
||||
spec.authors = 'meta'
|
||||
spec.platforms = min_supported_versions
|
||||
spec.source = source
|
||||
|
||||
spec.vendored_frameworks = "React.xcframework"
|
||||
|
||||
spec.preserve_paths = '**/*.*'
|
||||
spec.header_mappings_dir = 'React.xcframework/Headers'
|
||||
spec.source_files = 'React.xcframework/Headers/**/*.{h,hpp}'
|
||||
|
||||
spec.module_name = 'React'
|
||||
spec.module_map = 'React.xcframework/Modules/module.modulemap'
|
||||
spec.public_header_files = 'React.xcframework/Headers/**/*.h'
|
||||
|
||||
# Setup the consuming project's search paths
|
||||
spec.user_target_xcconfig = {
|
||||
"HEADER_SEARCH_PATHS" => header_search_paths,
|
||||
"SWIFT_INCLUDE_PATHS" => "${PODS_ROOT}/Headers/Private/React-Core-prebuilt",
|
||||
'DEFINES_MODULE' => 'YES',
|
||||
'CLANG_ENABLE_MODULES' => 'YES',
|
||||
}
|
||||
|
||||
spec.pod_target_xcconfig = {
|
||||
'WARNING_CFLAGS' => '-Wno-comma -Wno-shorten-64-to-32',
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
||||
'DEFINES_MODULE' => 'YES',
|
||||
'CLANG_ENABLE_MODULES' => 'YES',
|
||||
}
|
||||
add_rn_third_party_dependencies(s)
|
||||
|
||||
# We need to make sure that the React.xcframework is copied correctly - in the downloaded tarball
|
||||
# the root directory is the framework, but when using it we need to have it in a subdirectory
|
||||
# called React.xcframework, so we need to move the contents of the tarball into that directory.
|
||||
# This is done in the prepare_command.
|
||||
spec.prepare_command = <<~'CMD'
|
||||
# We need to make sure that the headers are copied to the right place - local tar.gz has a different structure
|
||||
# than the one from the maven repo
|
||||
s.prepare_command = <<~'CMD'
|
||||
CURRENT_PATH=$(pwd)
|
||||
XCFRAMEWORK_PATH="${CURRENT_PATH}/React.xcframework"
|
||||
|
||||
# Check if XCFRAMEWORK_PATH is empty
|
||||
if [ -z "$XCFRAMEWORK_PATH" ]; then
|
||||
echo "ERROR: XCFRAMEWORK_PATH is empty."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p "${XCFRAMEWORK_PATH}"
|
||||
find "$CURRENT_PATH" -mindepth 1 -maxdepth 1 ! -name "$(basename "$XCFRAMEWORK_PATH")" -exec mv {} "$XCFRAMEWORK_PATH" \;
|
||||
CMD
|
||||
|
||||
# If we are passing a local tarball, we don't want to switch between Debug and Release
|
||||
if !ENV["RCT_USE_LOCAL_RN_CORE"]
|
||||
if !ENV["RCT_TESTONLY_RNCORE_TARBALL_PATH"]
|
||||
script_phase = {
|
||||
:name => "[RNDeps] Replace React Native Core for the right configuration, if needed",
|
||||
:execution_position => :before_compile,
|
||||
@@ -115,8 +73,7 @@ Pod::Spec.new do |spec|
|
||||
# always run the script without warning
|
||||
script_phase[:always_out_of_date] = "1"
|
||||
end
|
||||
|
||||
spec.script_phase = script_phase
|
||||
|
||||
s.script_phase = script_phase
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -66,7 +66,7 @@ Pod::Spec.new do |s|
|
||||
s.default_subspec = "Default"
|
||||
|
||||
s.subspec "Default" do |ss|
|
||||
ss.source_files = "React/**/*.{c,h,m,mm,S,cpp}"
|
||||
ss.source_files = podspec_sources("React/**/*.{c,h,m,mm,S,cpp}", "React/**/*.h")
|
||||
exclude_files = [
|
||||
"React/CoreModules/**/*",
|
||||
"React/DevSupport/**/*",
|
||||
@@ -76,17 +76,24 @@ Pod::Spec.new do |s|
|
||||
"React/Inspector/**/*",
|
||||
"React/Runtime/**/*",
|
||||
]
|
||||
|
||||
|
||||
# The default is use hermes, we don't have jsc installed
|
||||
exclude_files = exclude_files.append("React/CxxBridge/JSCExecutorFactory.{h,mm}")
|
||||
|
||||
ss.exclude_files = exclude_files
|
||||
ss.private_header_files = "React/Cxx*/*.h"
|
||||
|
||||
# Include prebuilt if we're not building from source
|
||||
if !ReactNativeCoreUtils.build_rncore_from_source()
|
||||
ss.dependency "React-Core-prebuilt", version
|
||||
end
|
||||
end
|
||||
|
||||
s.subspec "DevSupport" do |ss|
|
||||
ss.source_files = "React/DevSupport/*.{h,mm,m}",
|
||||
"React/Inspector/*.{h,mm,m}"
|
||||
ss.source_files = podspec_sources(["React/DevSupport/*.{h,mm,m}",
|
||||
"React/Inspector/*.{h,mm,m}"],
|
||||
["React/DevSupport/*.h",
|
||||
"React/Inspector/*.h"])
|
||||
|
||||
ss.dependency "React-Core/Default", version
|
||||
ss.dependency "React-Core/RCTWebSocket", version
|
||||
@@ -94,7 +101,7 @@ Pod::Spec.new do |s|
|
||||
end
|
||||
|
||||
s.subspec "RCTWebSocket" do |ss|
|
||||
ss.source_files = "Libraries/WebSocket/*.{h,m}"
|
||||
ss.source_files = podspec_sources("Libraries/WebSocket/*.{h,m}", "Libraries/WebSocket/*.h")
|
||||
ss.dependency "React-Core/Default", version
|
||||
end
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <tgmath.h>
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
|
||||
s.compiler_flags = '-Wno-nullability-completeness'
|
||||
s.source = source
|
||||
|
||||
s.source_files = "**/*.{c,m,mm,cpp}"
|
||||
s.source_files = podspec_sources("**/*.{c,m,mm,cpp}", "**/*.h")
|
||||
|
||||
s.ios.exclude_files = "PlatformStubs/**/*"
|
||||
exclude_files = ["RCTStatusBarManager.mm"]
|
||||
|
||||
+1
-1
@@ -1215,7 +1215,7 @@ static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
|
||||
result = [NSMutableString string];
|
||||
}
|
||||
if (result.length > 0) {
|
||||
[result appendString:@" "];
|
||||
[result appendString:@", "];
|
||||
}
|
||||
[result appendString:label];
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <React/RCTViewComponentView.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RCTVirtualViewComponentView : RCTViewComponentView
|
||||
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+330
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import "RCTVirtualViewComponentView.h"
|
||||
|
||||
#import <React/RCTAssert.h>
|
||||
#import <React/RCTConversions.h>
|
||||
#import <React/RCTScrollViewComponentView.h>
|
||||
#import <React/RCTScrollableProtocol.h>
|
||||
#import <React/UIView+React.h>
|
||||
#import <jsi/jsi.h>
|
||||
|
||||
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
#import <react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h>
|
||||
#import <react/renderer/components/FBReactNativeSpec/EventEmitters.h>
|
||||
#import <react/renderer/components/FBReactNativeSpec/Props.h>
|
||||
#import <react/renderer/components/virtualview/VirtualViewComponentDescriptor.h>
|
||||
#import <react/renderer/components/virtualview/VirtualViewShadowNode.h>
|
||||
|
||||
#import "RCTFabricComponentsPlugins.h"
|
||||
|
||||
using namespace facebook;
|
||||
using namespace facebook::react;
|
||||
|
||||
typedef NS_ENUM(NSInteger, RCTVirtualViewMode) {
|
||||
RCTVirtualViewModeVisible = 0,
|
||||
RCTVirtualViewModePrerender = 1,
|
||||
RCTVirtualViewModeHidden = 2,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, RCTVirtualViewRenderState) {
|
||||
RCTVirtualViewRenderStateUnknown = 0,
|
||||
RCTVirtualViewRenderStateRendered = 1,
|
||||
RCTVirtualViewRenderStateNone = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks whether one CGRect overlaps with another CGRect.
|
||||
*
|
||||
* This is different from CGRectIntersectsRect because a CGRect representing
|
||||
* a line or a point is considered to overlap with another CGRect if the line
|
||||
* or point is within the rect bounds. However, two CGRects are not considered
|
||||
* to overlap if they only share a boundary.
|
||||
*/
|
||||
static BOOL CGRectOverlaps(CGRect rect1, CGRect rect2)
|
||||
{
|
||||
CGFloat minY1 = CGRectGetMinY(rect1);
|
||||
CGFloat maxY1 = CGRectGetMaxY(rect1);
|
||||
CGFloat minY2 = CGRectGetMinY(rect2);
|
||||
CGFloat maxY2 = CGRectGetMaxY(rect2);
|
||||
if (minY1 >= maxY2 || minY2 >= maxY1) {
|
||||
// No overlap on the y-axis.
|
||||
return NO;
|
||||
}
|
||||
CGFloat minX1 = CGRectGetMinX(rect1);
|
||||
CGFloat maxX1 = CGRectGetMaxX(rect1);
|
||||
CGFloat minX2 = CGRectGetMinX(rect2);
|
||||
CGFloat maxX2 = CGRectGetMaxX(rect2);
|
||||
if (minX1 >= maxX2 || minX2 >= maxX1) {
|
||||
// No overlap on the x-axis.
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@interface RCTVirtualViewComponentView () <UIScrollViewDelegate>
|
||||
@end
|
||||
|
||||
@implementation RCTVirtualViewComponentView {
|
||||
RCTScrollViewComponentView *_lastParentScrollViewComponentView;
|
||||
std::optional<enum RCTVirtualViewMode> _mode;
|
||||
enum RCTVirtualViewRenderState _renderState;
|
||||
std::optional<CGRect> _targetRect;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
_props = VirtualViewShadowNode::defaultSharedProps();
|
||||
_renderState = RCTVirtualViewRenderStateUnknown;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
||||
{
|
||||
const auto &newViewProps = static_cast<const VirtualViewProps &>(*props);
|
||||
|
||||
if (!_mode.has_value()) {
|
||||
_mode = newViewProps.initialHidden ? RCTVirtualViewModeHidden : RCTVirtualViewModeVisible;
|
||||
}
|
||||
|
||||
// If disabled, `_renderState` will always be `RCTVirtualViewRenderStateUnknown`.
|
||||
if (ReactNativeFeatureFlags::enableVirtualViewRenderState()) {
|
||||
switch (newViewProps.renderState) {
|
||||
case 1:
|
||||
_renderState = RCTVirtualViewRenderStateRendered;
|
||||
break;
|
||||
case 2:
|
||||
_renderState = RCTVirtualViewRenderStateNone;
|
||||
break;
|
||||
default:
|
||||
_renderState = RCTVirtualViewRenderStateUnknown;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[super updateProps:props oldProps:oldProps];
|
||||
}
|
||||
|
||||
- (RCTScrollViewComponentView *)getParentScrollViewComponentView
|
||||
{
|
||||
UIView *view = self.superview;
|
||||
while (view != nil) {
|
||||
if ([view isKindOfClass:[RCTScrollViewComponentView class]]) {
|
||||
return (RCTScrollViewComponentView *)view;
|
||||
}
|
||||
view = view.superview;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)prepareForRecycle
|
||||
{
|
||||
[super prepareForRecycle];
|
||||
|
||||
// No need to remove the scroll listener here since the view is always removed from window before being recycled and
|
||||
// we do that in didMoveToWindow, which gets called when the view is removed from window.
|
||||
RCTAssert(
|
||||
_lastParentScrollViewComponentView == nil,
|
||||
@"_lastParentScrollViewComponentView should already have been cleared in didMoveToWindow.");
|
||||
|
||||
_mode.reset();
|
||||
_targetRect.reset();
|
||||
}
|
||||
|
||||
// Handles case when sibling changes size.
|
||||
// TODO(T202601695): This doesn't yet handle the case of elements in the ScrollView outside a VirtualColumn changing
|
||||
// size.
|
||||
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics
|
||||
oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
|
||||
{
|
||||
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:_layoutMetrics];
|
||||
|
||||
[self dispatchOnModeChangeIfNeeded:YES];
|
||||
}
|
||||
|
||||
- (void)didMoveToWindow
|
||||
{
|
||||
[super didMoveToWindow];
|
||||
|
||||
if (_lastParentScrollViewComponentView) {
|
||||
[_lastParentScrollViewComponentView removeScrollListener:self];
|
||||
_lastParentScrollViewComponentView = nil;
|
||||
}
|
||||
|
||||
if (RCTScrollViewComponentView *parentScrollViewComponentView = [self getParentScrollViewComponentView]) {
|
||||
if (self.window) {
|
||||
// TODO(T202601695): We also want the ScrollView to emit layout changes from didLayoutSubviews so that any event
|
||||
// that may affect visibily of this view notifies the listeners.
|
||||
[parentScrollViewComponentView addScrollListener:self];
|
||||
_lastParentScrollViewComponentView = parentScrollViewComponentView;
|
||||
|
||||
// We want to dispatch the event immediately when the view is added to the window before any scrolling occurs.
|
||||
[self dispatchOnModeChangeIfNeeded:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||
{
|
||||
[self dispatchOnModeChangeIfNeeded:NO];
|
||||
}
|
||||
|
||||
- (void)dispatchOnModeChangeIfNeeded:(BOOL)checkForTargetRectChange
|
||||
{
|
||||
if (!_lastParentScrollViewComponentView) {
|
||||
return;
|
||||
}
|
||||
|
||||
UIScrollView *scrollView = _lastParentScrollViewComponentView.scrollView;
|
||||
CGRect targetRect = [self convertRect:self.bounds toView:scrollView];
|
||||
|
||||
// While scrolling, the `targetRect` does not change, so we don't check for changed `targetRect` in that case.
|
||||
if (checkForTargetRectChange) {
|
||||
if (_targetRect.has_value() && CGRectEqualToRect(targetRect, _targetRect.value())) {
|
||||
return;
|
||||
}
|
||||
_targetRect = targetRect;
|
||||
}
|
||||
|
||||
enum RCTVirtualViewMode newMode;
|
||||
CGRect thresholdRect = CGRectMake(
|
||||
scrollView.contentOffset.x,
|
||||
scrollView.contentOffset.y,
|
||||
scrollView.frame.size.width,
|
||||
scrollView.frame.size.height);
|
||||
if (CGRectOverlaps(targetRect, thresholdRect)) {
|
||||
newMode = RCTVirtualViewModeVisible;
|
||||
} else {
|
||||
auto prerender = false;
|
||||
const CGFloat prerenderRatio = ReactNativeFeatureFlags::virtualViewPrerenderRatio();
|
||||
if (prerenderRatio > 0) {
|
||||
thresholdRect = CGRectInset(
|
||||
thresholdRect, -thresholdRect.size.width * prerenderRatio, -thresholdRect.size.height * prerenderRatio);
|
||||
prerender = CGRectOverlaps(targetRect, thresholdRect);
|
||||
}
|
||||
if (prerender) {
|
||||
newMode = RCTVirtualViewModePrerender;
|
||||
} else {
|
||||
newMode = RCTVirtualViewModeHidden;
|
||||
thresholdRect = CGRectZero;
|
||||
}
|
||||
}
|
||||
|
||||
if (_mode.has_value() && newMode == _mode.value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: Make sure to keep these props in sync with dispatchSyncModeChange below where we have to explicitly copy all
|
||||
// props.
|
||||
VirtualViewEventEmitter::OnModeChange event = {
|
||||
.mode = (int)newMode,
|
||||
.targetRect =
|
||||
{.x = targetRect.origin.x,
|
||||
.y = targetRect.origin.y,
|
||||
.width = targetRect.size.width,
|
||||
.height = targetRect.size.height},
|
||||
.thresholdRect =
|
||||
{.x = thresholdRect.origin.x,
|
||||
.y = thresholdRect.origin.y,
|
||||
.width = thresholdRect.size.width,
|
||||
.height = thresholdRect.size.height},
|
||||
};
|
||||
|
||||
const std::optional<enum RCTVirtualViewMode> oldMode = _mode;
|
||||
_mode = newMode;
|
||||
|
||||
switch (newMode) {
|
||||
case RCTVirtualViewModeVisible:
|
||||
if (_renderState == RCTVirtualViewRenderStateUnknown) {
|
||||
// Feature flag is disabled, so use the former logic.
|
||||
[self dispatchSyncModeChange:event];
|
||||
} else {
|
||||
// If the previous mode was prerender and the result of dispatching that event was committed, we do not need to
|
||||
// dispatch an event for visible.
|
||||
const auto wasPrerenderCommitted = oldMode.has_value() && oldMode == RCTVirtualViewModePrerender &&
|
||||
_renderState == RCTVirtualViewRenderStateRendered;
|
||||
if (!wasPrerenderCommitted) {
|
||||
[self dispatchSyncModeChange:event];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RCTVirtualViewModePrerender:
|
||||
if (!oldMode.has_value() || oldMode != RCTVirtualViewModeVisible) {
|
||||
[self dispatchAsyncModeChange:event];
|
||||
}
|
||||
break;
|
||||
case RCTVirtualViewModeHidden:
|
||||
[self dispatchAsyncModeChange:event];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dispatchAsyncModeChange:(VirtualViewEventEmitter::OnModeChange &)event
|
||||
{
|
||||
if (!_eventEmitter) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<const VirtualViewEventEmitter> emitter =
|
||||
std::static_pointer_cast<const VirtualViewEventEmitter>(_eventEmitter);
|
||||
emitter->onModeChange(event);
|
||||
}
|
||||
|
||||
- (void)dispatchSyncModeChange:(VirtualViewEventEmitter::OnModeChange &)event
|
||||
{
|
||||
if (!_eventEmitter) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<const VirtualViewEventEmitter> emitter =
|
||||
std::static_pointer_cast<const VirtualViewEventEmitter>(_eventEmitter);
|
||||
|
||||
// TODO: Move this into a custom event emitter. We had to duplicate the codegen code here from onModeChange in order
|
||||
// to dispatch synchronously and discrete.
|
||||
emitter->experimental_flushSync([&emitter, &event]() {
|
||||
emitter->dispatchEvent(
|
||||
"modeChange",
|
||||
[event](jsi::Runtime &runtime) {
|
||||
auto payload = jsi::Object(runtime);
|
||||
payload.setProperty(runtime, "mode", event.mode);
|
||||
{
|
||||
auto targetRect = jsi::Object(runtime);
|
||||
targetRect.setProperty(runtime, "x", event.targetRect.x);
|
||||
targetRect.setProperty(runtime, "y", event.targetRect.y);
|
||||
targetRect.setProperty(runtime, "width", event.targetRect.width);
|
||||
targetRect.setProperty(runtime, "height", event.targetRect.height);
|
||||
payload.setProperty(runtime, "targetRect", targetRect);
|
||||
}
|
||||
{
|
||||
auto thresholdRect = jsi::Object(runtime);
|
||||
thresholdRect.setProperty(runtime, "x", event.thresholdRect.x);
|
||||
thresholdRect.setProperty(runtime, "y", event.thresholdRect.y);
|
||||
thresholdRect.setProperty(runtime, "width", event.thresholdRect.width);
|
||||
thresholdRect.setProperty(runtime, "height", event.thresholdRect.height);
|
||||
payload.setProperty(runtime, "thresholdRect", thresholdRect);
|
||||
}
|
||||
return payload;
|
||||
},
|
||||
RawEvent::Category::Discrete);
|
||||
});
|
||||
}
|
||||
|
||||
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
||||
{
|
||||
return concreteComponentDescriptorProvider<VirtualViewComponentDescriptor>();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Class<RCTComponentViewProtocol> VirtualViewCls(void)
|
||||
{
|
||||
return RCTVirtualViewComponentView.class;
|
||||
}
|
||||
@@ -72,6 +72,12 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
|
||||
[scheduler.delegate schedulerDidSynchronouslyUpdateViewOnUIThread:tag props:props];
|
||||
}
|
||||
|
||||
void schedulerDidUpdateShadowTree(const std::unordered_map<Tag, folly::dynamic> &tagToProps) override
|
||||
{
|
||||
// Does nothing.
|
||||
// This delegate method is not currently used on iOS.
|
||||
}
|
||||
|
||||
private:
|
||||
void *scheduler_;
|
||||
};
|
||||
|
||||
@@ -16,6 +16,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (std::vector<facebook::react::ProcessedColorStop>)getFixedColorStops:
|
||||
(const std::vector<facebook::react::ColorStop> &)colorStops
|
||||
gradientLineLength:(CGFloat)gradientLineLength;
|
||||
|
||||
// CAGradientLayer linear gradient squishes the non-square gradient to square gradient.
|
||||
// This function fixes the "squished" effect.
|
||||
// See https://stackoverflow.com/a/43176174 for more information.
|
||||
+ (std::pair<CGPoint, CGPoint>)pointsForCAGradientLayerLinearGradient:(CGPoint)startPoint
|
||||
endPoint:(CGPoint)endPoint
|
||||
bounds:(CGSize)bounds;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -9,10 +9,140 @@
|
||||
#import <React/RCTAnimationUtils.h>
|
||||
#import <React/RCTConversions.h>
|
||||
#import <react/utils/FloatComparison.h>
|
||||
#include <optional>
|
||||
#import <vector>
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
namespace {
|
||||
|
||||
struct Line;
|
||||
|
||||
struct LineSegment {
|
||||
CGPoint p1;
|
||||
CGPoint p2;
|
||||
|
||||
LineSegment(CGPoint p1, CGPoint p2) : p1(p1), p2(p2) {}
|
||||
|
||||
LineSegment(CGPoint p1, CGFloat m, CGFloat distance);
|
||||
|
||||
CGFloat getLength() const
|
||||
{
|
||||
CGFloat dx = p2.x - p1.x;
|
||||
CGFloat dy = p2.y - p1.y;
|
||||
return sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
CGFloat getDistance() const
|
||||
{
|
||||
return p1.x <= p2.x ? getLength() : -getLength();
|
||||
}
|
||||
|
||||
CGPoint getMidpoint() const
|
||||
{
|
||||
return CGPointMake((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);
|
||||
}
|
||||
|
||||
CGFloat getSlope() const
|
||||
{
|
||||
CGFloat dx = p2.x - p1.x;
|
||||
if (floatEquality(dx, 0.0)) {
|
||||
return std::numeric_limits<CGFloat>::infinity();
|
||||
}
|
||||
return (p2.y - p1.y) / dx;
|
||||
}
|
||||
|
||||
CGFloat getPerpendicularSlope() const
|
||||
{
|
||||
CGFloat slope = getSlope();
|
||||
if (std::isinf(slope)) {
|
||||
return 0.0;
|
||||
}
|
||||
if (floatEquality(slope, 0.0)) {
|
||||
return -std::numeric_limits<CGFloat>::infinity();
|
||||
}
|
||||
return -1 / slope;
|
||||
}
|
||||
|
||||
Line toLine() const;
|
||||
|
||||
LineSegment perpendicularBisector() const
|
||||
{
|
||||
CGPoint midpoint = getMidpoint();
|
||||
CGFloat perpSlope = getPerpendicularSlope();
|
||||
CGFloat dist = getDistance();
|
||||
return {LineSegment(midpoint, perpSlope, -dist / 2).p2, LineSegment(midpoint, perpSlope, dist / 2).p2};
|
||||
}
|
||||
|
||||
LineSegment multiplied(CGSize multipliers) const
|
||||
{
|
||||
return {
|
||||
CGPointMake(p1.x * multipliers.width, p1.y * multipliers.height),
|
||||
CGPointMake(p2.x * multipliers.width, p2.y * multipliers.height)};
|
||||
}
|
||||
|
||||
LineSegment divided(CGSize divisors) const
|
||||
{
|
||||
return multiplied(CGSizeMake(1 / divisors.width, 1 / divisors.height));
|
||||
}
|
||||
};
|
||||
|
||||
struct Line {
|
||||
CGFloat m;
|
||||
CGFloat b;
|
||||
|
||||
Line(CGFloat m, CGFloat b) : m(m), b(b) {}
|
||||
Line(CGFloat m, CGPoint p) : m(m), b(p.y - m * p.x) {}
|
||||
Line(CGPoint p1, CGPoint p2) : m(LineSegment(p1, p2).getSlope()), b(p1.y - m * p1.x) {}
|
||||
|
||||
CGFloat y(CGFloat x) const
|
||||
{
|
||||
return m * x + b;
|
||||
}
|
||||
|
||||
CGPoint point(CGFloat x) const
|
||||
{
|
||||
return CGPointMake(x, y(x));
|
||||
}
|
||||
|
||||
std::optional<CGPoint> intersection(const Line &other) const
|
||||
{
|
||||
CGFloat n = other.m;
|
||||
CGFloat c = other.b;
|
||||
if (floatEquality(m, n)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
CGFloat x = (c - b) / (m - n);
|
||||
return point(x);
|
||||
}
|
||||
};
|
||||
|
||||
LineSegment::LineSegment(CGPoint p1, CGFloat m, CGFloat distance) : p1(p1)
|
||||
{
|
||||
Line line(m, p1);
|
||||
CGPoint measuringPoint = line.point(p1.x + 1);
|
||||
LineSegment measuringSegment(p1, measuringPoint);
|
||||
CGFloat measuringDeltaH = measuringSegment.getDistance();
|
||||
CGFloat deltaX = !floatEquality(measuringDeltaH, 0.0) ? distance / measuringDeltaH : 0.0;
|
||||
p2 = line.point(p1.x + deltaX);
|
||||
}
|
||||
|
||||
Line LineSegment::toLine() const
|
||||
{
|
||||
return {p1, p2};
|
||||
}
|
||||
|
||||
CGSize calculateMultipliers(CGSize bounds)
|
||||
{
|
||||
if (bounds.height <= bounds.width) {
|
||||
return CGSizeMake(1, bounds.width / bounds.height);
|
||||
} else {
|
||||
return CGSizeMake(bounds.height / bounds.width, 1);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
static std::optional<Float> resolveColorStopPosition(ValueUnit position, CGFloat gradientLineLength)
|
||||
{
|
||||
if (position.unit == UnitType::Point) {
|
||||
@@ -52,21 +182,21 @@ static std::vector<ProcessedColorStop> processColorTransitionHints(const std::ve
|
||||
auto leftDist = offset - offsetLeft;
|
||||
auto rightDist = offsetRight - offset;
|
||||
auto totalDist = offsetRight - offsetLeft;
|
||||
SharedColor leftSharedColor = colorStops[x - 1].color;
|
||||
SharedColor rightSharedColor = colorStops[x + 1].color;
|
||||
const SharedColor &leftSharedColor = colorStops[x - 1].color;
|
||||
const SharedColor &rightSharedColor = colorStops[x + 1].color;
|
||||
|
||||
if (facebook::react::floatEquality(leftDist, rightDist)) {
|
||||
if (floatEquality(leftDist, rightDist)) {
|
||||
colorStops.erase(colorStops.begin() + x);
|
||||
--indexOffset;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (facebook::react::floatEquality(leftDist, .0f)) {
|
||||
if (floatEquality(leftDist, 0.0)) {
|
||||
colorStops[x].color = rightSharedColor;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (facebook::react::floatEquality(rightDist, .0f)) {
|
||||
if (floatEquality(rightDist, 0.0)) {
|
||||
colorStops[x].color = leftSharedColor;
|
||||
continue;
|
||||
}
|
||||
@@ -120,7 +250,7 @@ static std::vector<ProcessedColorStop> processColorTransitionHints(const std::ve
|
||||
auto green = (interpolatedColor >> 8) & 0xFF;
|
||||
auto blue = interpolatedColor & 0xFF;
|
||||
|
||||
newStop.color = facebook::react::colorFromRGBA(red, green, blue, alpha);
|
||||
newStop.color = colorFromRGBA(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
// Replace the color hint with new color stops
|
||||
@@ -201,4 +331,47 @@ static std::vector<ProcessedColorStop> processColorTransitionHints(const std::ve
|
||||
}
|
||||
return processColorTransitionHints(fixedColorStops);
|
||||
}
|
||||
|
||||
// CAGradientLayer linear gradient squishes the non-square gradient to square gradient.
|
||||
// This function fixes the "squished" effect.
|
||||
// See https://stackoverflow.com/a/43176174 for more information.
|
||||
+ (std::pair<CGPoint, CGPoint>)pointsForCAGradientLayerLinearGradient:(CGPoint)startPoint
|
||||
endPoint:(CGPoint)endPoint
|
||||
bounds:(CGSize)bounds
|
||||
{
|
||||
if (floatEquality(startPoint.x, endPoint.x) || floatEquality(startPoint.y, endPoint.y)) {
|
||||
// Apple's implementation of horizontal and vertical gradients works just fine
|
||||
return {startPoint, endPoint};
|
||||
}
|
||||
|
||||
LineSegment startEnd(startPoint, endPoint);
|
||||
LineSegment ab = startEnd.multiplied({bounds.width, bounds.height});
|
||||
const CGPoint a = ab.p1;
|
||||
const CGPoint b = ab.p2;
|
||||
|
||||
LineSegment cd = ab.perpendicularBisector();
|
||||
|
||||
CGSize multipliers = calculateMultipliers(bounds);
|
||||
LineSegment lineSegmentCD = cd.multiplied(multipliers);
|
||||
|
||||
LineSegment lineSegmentEF = lineSegmentCD.perpendicularBisector();
|
||||
|
||||
LineSegment ef = lineSegmentEF.divided(multipliers);
|
||||
|
||||
Line efLine = ef.toLine();
|
||||
|
||||
Line aParallelLine(cd.getSlope(), a);
|
||||
Line bParallelLine(cd.getSlope(), b);
|
||||
|
||||
std::optional<CGPoint> g_opt = efLine.intersection(aParallelLine);
|
||||
std::optional<CGPoint> h_opt = efLine.intersection(bParallelLine);
|
||||
|
||||
if (g_opt && h_opt) {
|
||||
LineSegment gh(*g_opt, *h_opt);
|
||||
LineSegment result = gh.divided({bounds.width, bounds.height});
|
||||
return {result.p1, result.p2};
|
||||
}
|
||||
|
||||
return {startPoint, endPoint};
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -19,54 +19,52 @@ using namespace facebook::react;
|
||||
|
||||
+ (CALayer *)gradientLayerWithSize:(CGSize)size gradient:(const LinearGradient &)gradient
|
||||
{
|
||||
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:size];
|
||||
const auto &direction = gradient.direction;
|
||||
UIImage *gradientImage = [renderer imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull rendererContext) {
|
||||
CGPoint startPoint;
|
||||
CGPoint endPoint;
|
||||
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
||||
CGPoint startPoint;
|
||||
CGPoint endPoint;
|
||||
|
||||
if (direction.type == GradientDirectionType::Angle) {
|
||||
CGFloat angle = std::get<Float>(direction.value);
|
||||
std::tie(startPoint, endPoint) = getPointsFromAngle(angle, size);
|
||||
} else if (direction.type == GradientDirectionType::Keyword) {
|
||||
auto keyword = std::get<GradientKeyword>(direction.value);
|
||||
CGFloat angle = getAngleForKeyword(keyword, size);
|
||||
std::tie(startPoint, endPoint) = getPointsFromAngle(angle, size);
|
||||
} else {
|
||||
// Default to top-to-bottom gradient
|
||||
startPoint = CGPointMake(0.0, 0.0);
|
||||
endPoint = CGPointMake(0.0, size.height);
|
||||
}
|
||||
if (direction.type == GradientDirectionType::Angle) {
|
||||
CGFloat angle = std::get<Float>(direction.value);
|
||||
std::tie(startPoint, endPoint) = getPointsFromAngle(angle, size);
|
||||
} else if (direction.type == GradientDirectionType::Keyword) {
|
||||
auto keyword = std::get<GradientKeyword>(direction.value);
|
||||
CGFloat angle = getAngleForKeyword(keyword, size);
|
||||
std::tie(startPoint, endPoint) = getPointsFromAngle(angle, size);
|
||||
} else {
|
||||
// Default to top-to-bottom gradient
|
||||
CGFloat centerX = size.width / 2;
|
||||
startPoint = CGPointMake(centerX, 0.0);
|
||||
endPoint = CGPointMake(centerX, size.height);
|
||||
}
|
||||
|
||||
CGFloat dx = endPoint.x - startPoint.x;
|
||||
CGFloat dy = endPoint.y - startPoint.y;
|
||||
CGFloat gradientLineLength = sqrt(dx * dx + dy * dy);
|
||||
const auto colorStops = [RCTGradientUtils getFixedColorStops:gradient.colorStops
|
||||
gradientLineLength:gradientLineLength];
|
||||
CGFloat dx = endPoint.x - startPoint.x;
|
||||
CGFloat dy = endPoint.y - startPoint.y;
|
||||
CGFloat gradientLineLength = sqrt(dx * dx + dy * dy);
|
||||
const auto colorStops = [RCTGradientUtils getFixedColorStops:gradient.colorStops
|
||||
gradientLineLength:gradientLineLength];
|
||||
NSMutableArray<id> *colors = [NSMutableArray array];
|
||||
NSMutableArray<NSNumber *> *locations = [NSMutableArray array];
|
||||
CGPoint relativeStartPoint = CGPointMake(startPoint.x / size.width, startPoint.y / size.height);
|
||||
CGPoint relativeEndPoint = CGPointMake(endPoint.x / size.width, endPoint.y / size.height);
|
||||
|
||||
CGContextRef context = rendererContext.CGContext;
|
||||
NSMutableArray *colors = [NSMutableArray array];
|
||||
CGFloat locations[colorStops.size()];
|
||||
CGPoint fixedStartPoint;
|
||||
CGPoint fixedEndPoint;
|
||||
|
||||
for (size_t i = 0; i < colorStops.size(); ++i) {
|
||||
const auto &colorStop = colorStops[i];
|
||||
CGColorRef cgColor = RCTCreateCGColorRefFromSharedColor(colorStop.color);
|
||||
[colors addObject:(__bridge id)cgColor];
|
||||
locations[i] = std::max(std::min(colorStop.position.value(), 1.0), 0.0);
|
||||
}
|
||||
std::tie(fixedStartPoint, fixedEndPoint) = [RCTGradientUtils pointsForCAGradientLayerLinearGradient:relativeStartPoint
|
||||
endPoint:relativeEndPoint
|
||||
bounds:size];
|
||||
|
||||
CGGradientRef cgGradient = CGGradientCreateWithColors(NULL, (__bridge CFArrayRef)colors, locations);
|
||||
gradientLayer.startPoint = fixedStartPoint;
|
||||
gradientLayer.endPoint = fixedEndPoint;
|
||||
|
||||
CGContextDrawLinearGradient(context, cgGradient, startPoint, endPoint, 0);
|
||||
for (const auto &colorStop : colorStops) {
|
||||
[colors addObject:(id)RCTUIColorFromSharedColor(colorStop.color).CGColor];
|
||||
[locations addObject:@(std::max(std::min(colorStop.position.value(), 1.0), 0.0))];
|
||||
}
|
||||
|
||||
for (id color in colors) {
|
||||
CGColorRelease((__bridge CGColorRef)color);
|
||||
}
|
||||
CGGradientRelease(cgGradient);
|
||||
}];
|
||||
|
||||
CALayer *gradientLayer = [CALayer layer];
|
||||
gradientLayer.contents = (__bridge id)gradientImage.CGImage;
|
||||
gradientLayer.colors = colors;
|
||||
gradientLayer.locations = locations;
|
||||
|
||||
return gradientLayer;
|
||||
}
|
||||
|
||||
@@ -153,75 +153,42 @@ static RadiusVector GetRadialGradientRadius(
|
||||
|
||||
+ (CALayer *)gradientLayerWithSize:(CGSize)size gradient:(const RadialGradient &)gradient
|
||||
{
|
||||
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:size];
|
||||
UIImage *gradientImage = [renderer imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull rendererContext) {
|
||||
CGContextRef context = rendererContext.CGContext;
|
||||
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
||||
gradientLayer.type = kCAGradientLayerRadial;
|
||||
CGPoint centerPoint = CGPointMake(size.width / 2.0, size.height / 2.0);
|
||||
|
||||
CGPoint centerPoint = CGPointMake(size.width / 2.0, size.height / 2.0);
|
||||
if (gradient.position.top) {
|
||||
centerPoint.y = gradient.position.top->resolve(size.height);
|
||||
} else if (gradient.position.bottom) {
|
||||
centerPoint.y = size.height - gradient.position.bottom->resolve(size.height);
|
||||
}
|
||||
|
||||
if (gradient.position.top) {
|
||||
centerPoint.y = gradient.position.top->resolve(size.height);
|
||||
} else if (gradient.position.bottom) {
|
||||
centerPoint.y = size.height - gradient.position.bottom->resolve(size.height);
|
||||
}
|
||||
if (gradient.position.left) {
|
||||
centerPoint.x = gradient.position.left->resolve(size.width);
|
||||
} else if (gradient.position.right) {
|
||||
centerPoint.x = size.width - gradient.position.right->resolve(size.width);
|
||||
}
|
||||
|
||||
if (gradient.position.left) {
|
||||
centerPoint.x = gradient.position.left->resolve(size.width);
|
||||
} else if (gradient.position.right) {
|
||||
centerPoint.x = size.width - gradient.position.right->resolve(size.width);
|
||||
}
|
||||
bool isCircle = (gradient.shape == RadialGradientShape::Circle);
|
||||
auto [radiusX, radiusY] =
|
||||
GetRadialGradientRadius(isCircle, gradient.size, centerPoint.x, centerPoint.y, size.width, size.height);
|
||||
const auto gradientLineLength = std::max(radiusX, radiusY);
|
||||
const auto colorStops = [RCTGradientUtils getFixedColorStops:gradient.colorStops
|
||||
gradientLineLength:gradientLineLength];
|
||||
gradientLayer.startPoint = CGPointMake(centerPoint.x / size.width, centerPoint.y / size.height);
|
||||
// endpoint.x is horizontal length and endpoint.y is vertical length
|
||||
gradientLayer.endPoint = CGPointMake(
|
||||
gradientLayer.startPoint.x + radiusX / size.width, gradientLayer.startPoint.y + radiusY / size.height);
|
||||
|
||||
bool isCircle = (gradient.shape == RadialGradientShape::Circle);
|
||||
auto [radiusX, radiusY] =
|
||||
GetRadialGradientRadius(isCircle, gradient.size, centerPoint.x, centerPoint.y, size.width, size.height);
|
||||
NSMutableArray<id> *colors = [NSMutableArray array];
|
||||
NSMutableArray<NSNumber *> *locations = [NSMutableArray array];
|
||||
for (const auto &colorStop : colorStops) {
|
||||
[colors addObject:(id)RCTUIColorFromSharedColor(colorStop.color).CGColor];
|
||||
[locations addObject:@(std::max(std::min(colorStop.position.value(), 1.0), 0.0))];
|
||||
}
|
||||
|
||||
CGFloat scale = 1.0;
|
||||
if (radiusX != radiusY && gradient.shape != RadialGradientShape::Circle) {
|
||||
scale = radiusX / radiusY;
|
||||
CGContextSaveGState(context);
|
||||
// Scale the context to make the circular gradient appear elliptical
|
||||
CGContextTranslateCTM(context, centerPoint.x, centerPoint.y);
|
||||
CGContextScaleCTM(context, 1.0, 1.0 / scale);
|
||||
CGContextTranslateCTM(context, -centerPoint.x, -centerPoint.y);
|
||||
radiusX = std::max(radiusX, radiusY * scale);
|
||||
}
|
||||
|
||||
const auto colorStops = [RCTGradientUtils getFixedColorStops:gradient.colorStops gradientLineLength:radiusX];
|
||||
|
||||
NSMutableArray *colors = [NSMutableArray array];
|
||||
CGFloat locations[colorStops.size()];
|
||||
|
||||
for (size_t i = 0; i < colorStops.size(); ++i) {
|
||||
const auto &colorStop = colorStops[i];
|
||||
CGColorRef cgColor = RCTCreateCGColorRefFromSharedColor(colorStop.color);
|
||||
[colors addObject:(__bridge id)cgColor];
|
||||
locations[i] = std::max(std::min(colorStop.position.value(), 1.0), 0.0);
|
||||
}
|
||||
|
||||
CGGradientRef cgGradient = CGGradientCreateWithColors(NULL, (__bridge CFArrayRef)colors, locations);
|
||||
|
||||
CGContextDrawRadialGradient(
|
||||
context,
|
||||
cgGradient,
|
||||
centerPoint,
|
||||
0,
|
||||
centerPoint,
|
||||
radiusX,
|
||||
kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
|
||||
|
||||
// Restore the context state if we scaled it
|
||||
if (radiusX != radiusY && gradient.shape != RadialGradientShape::Circle) {
|
||||
CGContextRestoreGState(context);
|
||||
}
|
||||
|
||||
for (id color in colors) {
|
||||
CGColorRelease((__bridge CGColorRef)color);
|
||||
}
|
||||
CGGradientRelease(cgGradient);
|
||||
}];
|
||||
|
||||
CALayer *gradientLayer = [CALayer layer];
|
||||
gradientLayer.contents = (__bridge id)gradientImage.CGImage;
|
||||
gradientLayer.colors = colors;
|
||||
gradientLayer.locations = locations;
|
||||
|
||||
return gradientLayer;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,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 = "FBReactNativeSpec/**/*.{c,h,m,mm,cpp}"
|
||||
s.source_files = podspec_sources("FBReactNativeSpec/**/*.{c,h,m,mm,cpp}", "FBReactNativeSpec/**/*.{h}")
|
||||
s.exclude_files = "FBReactNativeSpec/react/renderer/components",
|
||||
s.compiler_flags = new_arch_flags
|
||||
s.header_dir = 'FBReactNativeSpec'
|
||||
@@ -63,7 +63,7 @@ Pod::Spec.new do |s|
|
||||
add_rn_third_party_dependencies(s)
|
||||
|
||||
s.subspec "components" do |ss|
|
||||
ss.source_files = "FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/**/*.{m,mm,cpp,h}"
|
||||
ss.source_files = podspec_sources("FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/**/*.{m,mm,cpp,h}", "FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/**/*.{h}")
|
||||
ss.header_dir = "react/renderer/components/FBReactNativeSpec"
|
||||
|
||||
add_dependency(ss, "React-featureflags")
|
||||
|
||||
@@ -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 = "Fabric/**/*.{c,h,m,mm,S,cpp}"
|
||||
s.source_files = podspec_sources("Fabric/**/*.{c,h,m,mm,S,cpp}", "Fabric/**/*.{h}")
|
||||
s.exclude_files = "**/tests/*",
|
||||
"**/android/*",
|
||||
s.compiler_flags = new_arch_flags
|
||||
@@ -99,7 +99,7 @@ Pod::Spec.new do |s|
|
||||
add_rn_third_party_dependencies(s)
|
||||
|
||||
s.test_spec 'Tests' do |test_spec|
|
||||
test_spec.source_files = "Tests/**/*.{mm}"
|
||||
test_spec.source_files = podspec_sources("Tests/**/*.{mm}", "")
|
||||
test_spec.framework = "XCTest"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,7 +30,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,mm}"
|
||||
s.source_files = podspec_sources("*.{h,mm}", "*.h")
|
||||
s.compiler_flags = new_arch_flags
|
||||
s.header_dir = header_dir
|
||||
s.module_name = module_name
|
||||
|
||||
@@ -148,29 +148,29 @@ public class com/facebook/react/ReactDelegate {
|
||||
public fun <init> (Landroid/app/Activity;Lcom/facebook/react/ReactNativeHost;Ljava/lang/String;Landroid/os/Bundle;)V
|
||||
public fun <init> (Landroid/app/Activity;Lcom/facebook/react/ReactNativeHost;Ljava/lang/String;Landroid/os/Bundle;Z)V
|
||||
protected fun createRootView ()Lcom/facebook/react/ReactRootView;
|
||||
public fun getCurrentReactContext ()Lcom/facebook/react/bridge/ReactContext;
|
||||
public fun getReactHost ()Lcom/facebook/react/ReactHost;
|
||||
public fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
|
||||
public fun getReactRootView ()Lcom/facebook/react/ReactRootView;
|
||||
protected fun isFabricEnabled ()Z
|
||||
public fun loadApp ()V
|
||||
public fun loadApp (Ljava/lang/String;)V
|
||||
public fun onActivityResult (IILandroid/content/Intent;Z)V
|
||||
public fun onBackPressed ()Z
|
||||
public fun onConfigurationChanged (Landroid/content/res/Configuration;)V
|
||||
public fun onHostDestroy ()V
|
||||
public fun onHostPause ()V
|
||||
public fun onHostResume ()V
|
||||
public fun onKeyDown (ILandroid/view/KeyEvent;)Z
|
||||
public fun onKeyLongPress (I)Z
|
||||
public fun onNewIntent (Landroid/content/Intent;)Z
|
||||
public fun onUserLeaveHint ()V
|
||||
public fun onWindowFocusChanged (Z)V
|
||||
public fun reload ()V
|
||||
public fun setReactRootView (Lcom/facebook/react/ReactRootView;)V
|
||||
public fun setReactSurface (Lcom/facebook/react/interfaces/fabric/ReactSurface;)V
|
||||
public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
|
||||
public fun unloadApp ()V
|
||||
public final fun getCurrentReactContext ()Lcom/facebook/react/bridge/ReactContext;
|
||||
public final fun getReactHost ()Lcom/facebook/react/ReactHost;
|
||||
public final fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
|
||||
public final fun getReactRootView ()Lcom/facebook/react/ReactRootView;
|
||||
protected final fun isFabricEnabled ()Z
|
||||
public final fun loadApp ()V
|
||||
public final fun loadApp (Ljava/lang/String;)V
|
||||
public final fun onActivityResult (IILandroid/content/Intent;Z)V
|
||||
public final fun onBackPressed ()Z
|
||||
public final fun onConfigurationChanged (Landroid/content/res/Configuration;)V
|
||||
public final fun onHostDestroy ()V
|
||||
public final fun onHostPause ()V
|
||||
public final fun onHostResume ()V
|
||||
public final fun onKeyDown (ILandroid/view/KeyEvent;)Z
|
||||
public final fun onKeyLongPress (I)Z
|
||||
public final fun onNewIntent (Landroid/content/Intent;)Z
|
||||
public final fun onUserLeaveHint ()V
|
||||
public final fun onWindowFocusChanged (Z)V
|
||||
public final fun reload ()V
|
||||
public final fun setReactRootView (Lcom/facebook/react/ReactRootView;)V
|
||||
public final fun setReactSurface (Lcom/facebook/react/interfaces/fabric/ReactSurface;)V
|
||||
public final fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
|
||||
public final fun unloadApp ()V
|
||||
}
|
||||
|
||||
public class com/facebook/react/ReactFragment : androidx/fragment/app/Fragment, com/facebook/react/modules/core/PermissionAwareActivity {
|
||||
@@ -259,6 +259,7 @@ public class com/facebook/react/ReactInstanceManager {
|
||||
public fun createViewManager (Ljava/lang/String;)Lcom/facebook/react/uimanager/ViewManager;
|
||||
public fun destroy ()V
|
||||
public fun detachRootView (Lcom/facebook/react/uimanager/ReactRoot;)V
|
||||
public fun getCurrentReactContext ()Lcom/facebook/react/bridge/ReactContext;
|
||||
public fun getDevSupportManager ()Lcom/facebook/react/devsupport/interfaces/DevSupportManager;
|
||||
public fun getJsExecutorName ()Ljava/lang/String;
|
||||
public fun getLifecycleState ()Lcom/facebook/react/common/LifecycleState;
|
||||
@@ -600,12 +601,14 @@ public abstract interface class com/facebook/react/bridge/CatalystInstance : com
|
||||
public abstract fun getSourceURL ()Ljava/lang/String;
|
||||
public abstract fun hasNativeModule (Ljava/lang/Class;)Z
|
||||
public abstract fun hasRunJSBundle ()Z
|
||||
public abstract fun initialize ()V
|
||||
public abstract fun invokeCallback (ILcom/facebook/react/bridge/NativeArrayInterface;)V
|
||||
public abstract fun isDestroyed ()Z
|
||||
public abstract fun registerSegment (ILjava/lang/String;)V
|
||||
public abstract fun removeBridgeIdleDebugListener (Lcom/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener;)V
|
||||
public abstract fun runJSBundle ()V
|
||||
public abstract fun setFabricUIManager (Lcom/facebook/react/bridge/UIManager;)V
|
||||
public abstract fun setGlobalVariable (Ljava/lang/String;Ljava/lang/String;)V
|
||||
public abstract fun setTurboModuleRegistry (Lcom/facebook/react/internal/turbomodule/core/interfaces/TurboModuleRegistry;)V
|
||||
}
|
||||
|
||||
@@ -2372,24 +2375,6 @@ public final class com/facebook/react/fabric/FabricUIManagerProviderImpl : com/f
|
||||
public fun createUIManager (Lcom/facebook/react/bridge/ReactApplicationContext;)Lcom/facebook/react/bridge/UIManager;
|
||||
}
|
||||
|
||||
public class com/facebook/react/fabric/mounting/MountItemDispatcher {
|
||||
public fun <init> (Lcom/facebook/react/fabric/mounting/MountingManager;Lcom/facebook/react/fabric/mounting/MountItemDispatcher$ItemDispatchListener;)V
|
||||
public fun addMountItem (Lcom/facebook/react/fabric/mounting/mountitems/MountItem;)V
|
||||
public fun addPreAllocateMountItem (Lcom/facebook/react/fabric/mounting/mountitems/MountItem;)V
|
||||
public fun addViewCommandMountItem (Lcom/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem;)V
|
||||
public fun dispatchMountItems (Ljava/util/Queue;)V
|
||||
public fun dispatchPreMountItems (J)V
|
||||
public fun getBatchedExecutionTime ()J
|
||||
public fun getRunStartTime ()J
|
||||
public fun tryDispatchMountItems ()V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/fabric/mounting/MountItemDispatcher$ItemDispatchListener {
|
||||
public abstract fun didDispatchMountItems ()V
|
||||
public abstract fun didMountItems (Ljava/util/List;)V
|
||||
public abstract fun willMountItems (Ljava/util/List;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/fabric/mounting/SurfaceMountingManager {
|
||||
public static final field TAG Ljava/lang/String;
|
||||
public fun <init> (ILcom/facebook/react/touch/JSResponderHandler;Lcom/facebook/react/uimanager/ViewManagerRegistry;Lcom/facebook/react/uimanager/RootViewManager;Lcom/facebook/react/fabric/mounting/MountingManager$MountItemExecutor;Lcom/facebook/react/uimanager/ThemedReactContext;)V
|
||||
@@ -3315,6 +3300,7 @@ public abstract class com/facebook/react/uimanager/BaseViewManager : com/faceboo
|
||||
public fun getExportedCustomBubblingEventTypeConstants ()Ljava/util/Map;
|
||||
public fun getExportedCustomDirectEventTypeConstants ()Ljava/util/Map;
|
||||
protected fun onAfterUpdateTransaction (Landroid/view/View;)V
|
||||
public fun onDropViewInstance (Landroid/view/View;)V
|
||||
public fun onLayoutChange (Landroid/view/View;IIIIIIII)V
|
||||
protected fun prepareToRecycleView (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)Landroid/view/View;
|
||||
public fun setAccessibilityActions (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
|
||||
@@ -3673,6 +3659,7 @@ public class com/facebook/react/uimanager/ReactAccessibilityDelegate : androidx/
|
||||
public static final field TOP_ACCESSIBILITY_ACTION_EVENT Ljava/lang/String;
|
||||
public static final field sActionIdMap Ljava/util/HashMap;
|
||||
public fun <init> (Landroid/view/View;ZI)V
|
||||
public fun cleanUp ()V
|
||||
public static fun createNodeInfoFromView (Landroid/view/View;)Landroidx/core/view/accessibility/AccessibilityNodeInfoCompat;
|
||||
public fun getAccessibilityNodeProvider (Landroid/view/View;)Landroidx/core/view/accessibility/AccessibilityNodeProviderCompat;
|
||||
protected fun getHostView ()Landroid/view/View;
|
||||
@@ -4353,20 +4340,20 @@ public abstract interface class com/facebook/react/uimanager/UIImplementation$La
|
||||
public abstract fun onLayoutUpdated (Lcom/facebook/react/uimanager/ReactShadowNode;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/uimanager/UIManagerHelper {
|
||||
public final class com/facebook/react/uimanager/UIManagerHelper {
|
||||
public static final field INSTANCE Lcom/facebook/react/uimanager/UIManagerHelper;
|
||||
public static final field PADDING_BOTTOM_INDEX I
|
||||
public static final field PADDING_END_INDEX I
|
||||
public static final field PADDING_START_INDEX I
|
||||
public static final field PADDING_TOP_INDEX I
|
||||
public fun <init> ()V
|
||||
public static fun getDefaultTextInputPadding (Landroid/content/Context;)[F
|
||||
public static fun getEventDispatcher (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/uimanager/events/EventDispatcher;
|
||||
public static fun getEventDispatcherForReactTag (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/uimanager/events/EventDispatcher;
|
||||
public static fun getReactContext (Landroid/view/View;)Lcom/facebook/react/bridge/ReactContext;
|
||||
public static fun getSurfaceId (Landroid/content/Context;)I
|
||||
public static fun getSurfaceId (Landroid/view/View;)I
|
||||
public static fun getUIManager (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/bridge/UIManager;
|
||||
public static fun getUIManagerForReactTag (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/bridge/UIManager;
|
||||
public static final fun getDefaultTextInputPadding (Landroid/content/Context;)[F
|
||||
public static final fun getEventDispatcher (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/uimanager/events/EventDispatcher;
|
||||
public static final fun getEventDispatcherForReactTag (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/uimanager/events/EventDispatcher;
|
||||
public static final fun getReactContext (Landroid/view/View;)Lcom/facebook/react/bridge/ReactContext;
|
||||
public static final fun getSurfaceId (Landroid/content/Context;)I
|
||||
public static final fun getSurfaceId (Landroid/view/View;)I
|
||||
public static final fun getUIManager (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/bridge/UIManager;
|
||||
public static final fun getUIManagerForReactTag (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/bridge/UIManager;
|
||||
}
|
||||
|
||||
public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/bridge/ReactContextBaseJavaModule, com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/OnBatchCompleteListener, com/facebook/react/bridge/UIManager {
|
||||
@@ -4880,20 +4867,6 @@ public abstract interface class com/facebook/react/uimanager/events/EventDispatc
|
||||
public abstract fun removeListener (Lcom/facebook/react/uimanager/events/EventDispatcherListener;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/uimanager/events/EventDispatcherImpl : com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/uimanager/events/EventDispatcher {
|
||||
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;)V
|
||||
public fun addBatchEventDispatchedListener (Lcom/facebook/react/uimanager/events/BatchEventDispatchedListener;)V
|
||||
public fun addListener (Lcom/facebook/react/uimanager/events/EventDispatcherListener;)V
|
||||
public fun dispatchAllEvents ()V
|
||||
public fun dispatchEvent (Lcom/facebook/react/uimanager/events/Event;)V
|
||||
public fun onCatalystInstanceDestroyed ()V
|
||||
public fun onHostDestroy ()V
|
||||
public fun onHostPause ()V
|
||||
public fun onHostResume ()V
|
||||
public fun removeBatchEventDispatchedListener (Lcom/facebook/react/uimanager/events/BatchEventDispatchedListener;)V
|
||||
public fun removeListener (Lcom/facebook/react/uimanager/events/EventDispatcherListener;)V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/uimanager/events/EventDispatcherListener {
|
||||
public abstract fun onEventDispatch (Lcom/facebook/react/uimanager/events/Event;)V
|
||||
}
|
||||
@@ -4904,32 +4877,6 @@ public final class com/facebook/react/uimanager/events/NativeGestureUtil {
|
||||
public static final fun notifyNativeGestureStarted (Landroid/view/View;Landroid/view/MotionEvent;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/uimanager/events/PointerEvent : com/facebook/react/uimanager/events/Event {
|
||||
public fun dispatch (Lcom/facebook/react/uimanager/events/RCTEventEmitter;)V
|
||||
public fun dispatchModern (Lcom/facebook/react/uimanager/events/RCTModernEventEmitter;)V
|
||||
public fun getCoalescingKey ()S
|
||||
public fun getEventAnimationDriverMatchSpec ()Lcom/facebook/react/uimanager/events/Event$EventAnimationDriverMatchSpec;
|
||||
public fun getEventName ()Ljava/lang/String;
|
||||
public static fun obtain (Ljava/lang/String;ILcom/facebook/react/uimanager/events/PointerEvent$PointerEventState;Landroid/view/MotionEvent;)Lcom/facebook/react/uimanager/events/PointerEvent;
|
||||
public static fun obtain (Ljava/lang/String;ILcom/facebook/react/uimanager/events/PointerEvent$PointerEventState;Landroid/view/MotionEvent;S)Lcom/facebook/react/uimanager/events/PointerEvent;
|
||||
public fun onDispose ()V
|
||||
}
|
||||
|
||||
public class com/facebook/react/uimanager/events/PointerEvent$PointerEventState {
|
||||
public fun <init> (IIIILjava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Set;)V
|
||||
public fun getActivePointerId ()I
|
||||
public final fun getEventCoordinatesByPointerId ()Ljava/util/Map;
|
||||
public final fun getHitPathByPointerId ()Ljava/util/Map;
|
||||
public final fun getHitPathForActivePointer ()Ljava/util/List;
|
||||
public fun getHoveringPointerIds ()Ljava/util/Set;
|
||||
public fun getLastButtonState ()I
|
||||
public final fun getOffsetByPointerId ()Ljava/util/Map;
|
||||
public fun getPrimaryPointerId ()I
|
||||
public final fun getScreenCoordinatesByPointerId ()Ljava/util/Map;
|
||||
public fun getSurfaceId ()I
|
||||
public fun supportsHover (I)Z
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/uimanager/events/RCTEventEmitter : com/facebook/react/bridge/JavaScriptModule {
|
||||
public abstract fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
|
||||
public abstract fun receiveTouches (Ljava/lang/String;Lcom/facebook/react/bridge/WritableArray;Lcom/facebook/react/bridge/WritableArray;)V
|
||||
@@ -5336,6 +5283,16 @@ public abstract interface class com/facebook/react/viewmanagers/UnimplementedNat
|
||||
public abstract fun setName (Landroid/view/View;Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/viewmanagers/VirtualViewManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
|
||||
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
|
||||
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/viewmanagers/VirtualViewManagerInterface : com/facebook/react/uimanager/ViewManagerWithGeneratedInterface {
|
||||
public abstract fun setInitialHidden (Landroid/view/View;Z)V
|
||||
public abstract fun setRenderState (Landroid/view/View;I)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/views/drawer/ReactDrawerLayout : androidx/drawerlayout/widget/DrawerLayout {
|
||||
public fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
|
||||
public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z
|
||||
@@ -6163,16 +6120,17 @@ public final class com/facebook/react/views/text/ReactFontManager$Companion {
|
||||
public final fun getInstance ()Lcom/facebook/react/views/text/ReactFontManager;
|
||||
}
|
||||
|
||||
public class com/facebook/react/views/text/ReactTextShadowNode : com/facebook/react/views/text/ReactBaseTextShadowNode {
|
||||
public final class com/facebook/react/views/text/ReactTextShadowNode : com/facebook/react/views/text/ReactBaseTextShadowNode {
|
||||
public fun <init> ()V
|
||||
public fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
|
||||
public synthetic fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun calculateLayoutOnChildren ()Ljava/lang/Iterable;
|
||||
public fun hoistNativeChildren ()Z
|
||||
public fun isVirtualAnchor ()Z
|
||||
public fun markUpdated ()V
|
||||
public fun onBeforeLayout (Lcom/facebook/react/uimanager/NativeViewHierarchyOptimizer;)V
|
||||
public fun onCollectExtraUpdates (Lcom/facebook/react/uimanager/UIViewOperationQueue;)V
|
||||
public fun setShouldNotifyOnTextLayout (Z)V
|
||||
public final fun setShouldNotifyOnTextLayout (Z)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/views/text/ReactTextUpdate {
|
||||
|
||||
+3
-3
@@ -37,15 +37,15 @@ public class MemoryPressureRouter(context: Context) : ComponentCallbacks2 {
|
||||
listeners.remove(listener)
|
||||
}
|
||||
|
||||
override public fun onTrimMemory(level: Int) {
|
||||
public override fun onTrimMemory(level: Int) {
|
||||
dispatchMemoryPressure(level)
|
||||
}
|
||||
|
||||
override public fun onConfigurationChanged(newConfig: Configuration): Unit = Unit
|
||||
public override fun onConfigurationChanged(newConfig: Configuration): Unit = Unit
|
||||
|
||||
@Deprecated(
|
||||
"onLowMemory is deprecated, use onTrimMemory instead.", ReplaceWith("onTrimMemory(level)"))
|
||||
override public fun onLowMemory(): Unit = Unit
|
||||
public override fun onLowMemory(): Unit = Unit
|
||||
|
||||
private fun dispatchMemoryPressure(level: Int) {
|
||||
for (listener in listeners) {
|
||||
|
||||
-460
@@ -1,460 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
|
||||
import com.facebook.react.devsupport.DoubleTapReloadRecognizer;
|
||||
import com.facebook.react.devsupport.ReleaseDevSupportManager;
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
||||
import com.facebook.react.interfaces.fabric.ReactSurface;
|
||||
import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags;
|
||||
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A delegate for handling React Application support. This delegate is unaware whether it is used in
|
||||
* an {@link Activity} or a {@link android.app.Fragment}.
|
||||
*/
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public class ReactDelegate {
|
||||
|
||||
private final Activity mActivity;
|
||||
|
||||
@Nullable private ReactRootView mReactRootView;
|
||||
|
||||
@Nullable private final String mMainComponentName;
|
||||
|
||||
@Nullable private Bundle mLaunchOptions;
|
||||
|
||||
@Nullable private DoubleTapReloadRecognizer mDoubleTapReloadRecognizer;
|
||||
|
||||
@Nullable private ReactNativeHost mReactNativeHost;
|
||||
|
||||
@Nullable private ReactHost mReactHost;
|
||||
|
||||
@Nullable private ReactSurface mReactSurface;
|
||||
|
||||
private boolean mFabricEnabled = ReactNativeNewArchitectureFeatureFlags.enableFabricRenderer();
|
||||
|
||||
/**
|
||||
* Do not use this constructor as it's not accounting for New Architecture at all. You should use
|
||||
* {@link ReactDelegate#ReactDelegate(Activity, ReactNativeHost, String, Bundle, boolean)} as it's
|
||||
* the constructor used for New Architecture.
|
||||
*
|
||||
* @deprecated Use one of the other constructors instead to account for New Architecture.
|
||||
*/
|
||||
@Deprecated(since = "0.75.0")
|
||||
public ReactDelegate(
|
||||
Activity activity,
|
||||
@Nullable ReactNativeHost reactNativeHost,
|
||||
@Nullable String appKey,
|
||||
@Nullable Bundle launchOptions) {
|
||||
mActivity = activity;
|
||||
mMainComponentName = appKey;
|
||||
mLaunchOptions = launchOptions;
|
||||
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
|
||||
mReactNativeHost = reactNativeHost;
|
||||
}
|
||||
|
||||
public ReactDelegate(
|
||||
Activity activity,
|
||||
@Nullable ReactHost reactHost,
|
||||
@Nullable String appKey,
|
||||
@Nullable Bundle launchOptions) {
|
||||
mActivity = activity;
|
||||
mMainComponentName = appKey;
|
||||
mLaunchOptions = launchOptions;
|
||||
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
|
||||
mReactHost = reactHost;
|
||||
}
|
||||
|
||||
@Deprecated(since = "0.81.0")
|
||||
public ReactDelegate(
|
||||
Activity activity,
|
||||
@Nullable ReactNativeHost reactNativeHost,
|
||||
@Nullable String appKey,
|
||||
@Nullable Bundle launchOptions,
|
||||
boolean fabricEnabled) {
|
||||
mFabricEnabled = fabricEnabled;
|
||||
mActivity = activity;
|
||||
mMainComponentName = appKey;
|
||||
mLaunchOptions = launchOptions;
|
||||
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
|
||||
mReactNativeHost = reactNativeHost;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private DevSupportManager getDevSupportManager() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null
|
||||
&& mReactHost.getDevSupportManager() != null) {
|
||||
return mReactHost.getDevSupportManager();
|
||||
} else if (getReactNativeHost() != null
|
||||
&& getReactNativeHost().hasInstance()
|
||||
&& getReactNativeHost().getReactInstanceManager() != null) {
|
||||
return getReactNativeHost().getReactInstanceManager().getDevSupportManager();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void onHostResume() {
|
||||
if (!(mActivity instanceof DefaultHardwareBackBtnHandler)) {
|
||||
throw new ClassCastException(
|
||||
"Host Activity does not implement DefaultHardwareBackBtnHandler");
|
||||
}
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onHostResume(mActivity, (DefaultHardwareBackBtnHandler) mActivity);
|
||||
} else {
|
||||
ReactNativeHost reactNativeHost = getReactNativeHost();
|
||||
if (reactNativeHost != null && reactNativeHost.hasInstance()) {
|
||||
reactNativeHost
|
||||
.getReactInstanceManager()
|
||||
.onHostResume(mActivity, (DefaultHardwareBackBtnHandler) mActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onUserLeaveHint() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onHostLeaveHint(mActivity);
|
||||
} else {
|
||||
ReactNativeHost reactNativeHost = getReactNativeHost();
|
||||
if (reactNativeHost != null && reactNativeHost.hasInstance()) {
|
||||
reactNativeHost.getReactInstanceManager().onUserLeaveHint(mActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onHostPause() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onHostPause(mActivity);
|
||||
} else {
|
||||
ReactNativeHost reactNativeHost = getReactNativeHost();
|
||||
if (reactNativeHost != null && reactNativeHost.hasInstance()) {
|
||||
reactNativeHost.getReactInstanceManager().onHostPause(mActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onHostDestroy() {
|
||||
unloadApp();
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onHostDestroy(mActivity);
|
||||
} else {
|
||||
ReactNativeHost reactNativeHost = getReactNativeHost();
|
||||
if (reactNativeHost != null && reactNativeHost.hasInstance()) {
|
||||
reactNativeHost.getReactInstanceManager().onHostDestroy(mActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBackPressed() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onBackPressed();
|
||||
return true;
|
||||
} else {
|
||||
ReactNativeHost reactNativeHost = getReactNativeHost();
|
||||
if (reactNativeHost != null && reactNativeHost.hasInstance()) {
|
||||
reactNativeHost.getReactInstanceManager().onBackPressed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onNewIntent(Intent intent) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onNewIntent(intent);
|
||||
return true;
|
||||
} else {
|
||||
ReactNativeHost reactNativeHost = getReactNativeHost();
|
||||
if (reactNativeHost != null && reactNativeHost.hasInstance()) {
|
||||
reactNativeHost.getReactInstanceManager().onNewIntent(intent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onActivityResult(
|
||||
int requestCode,
|
||||
int resultCode,
|
||||
@Nullable Intent data,
|
||||
boolean shouldForwardToReactInstance) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onActivityResult(mActivity, requestCode, resultCode, data);
|
||||
} else {
|
||||
ReactNativeHost reactNativeHost = getReactNativeHost();
|
||||
if (reactNativeHost != null
|
||||
&& reactNativeHost.hasInstance()
|
||||
&& shouldForwardToReactInstance) {
|
||||
reactNativeHost
|
||||
.getReactInstanceManager()
|
||||
.onActivityResult(mActivity, requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onWindowFocusChange(hasFocus);
|
||||
} else {
|
||||
if (getReactNativeHost() != null && getReactNativeHost().hasInstance()) {
|
||||
getReactNativeHost().getReactInstanceManager().onWindowFocusChange(hasFocus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
mReactHost.onConfigurationChanged(Assertions.assertNotNull(mActivity));
|
||||
} else {
|
||||
if (getReactNativeHost() != null && getReactNativeHost().hasInstance()) {
|
||||
getReactInstanceManager()
|
||||
.onConfigurationChanged(Assertions.assertNotNull(mActivity), newConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD
|
||||
&& ((ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null
|
||||
&& mReactHost.getDevSupportManager() != null)
|
||||
|| (getReactNativeHost() != null
|
||||
&& getReactNativeHost().hasInstance()
|
||||
&& getReactNativeHost().getUseDeveloperSupport()))) {
|
||||
event.startTracking();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onKeyLongPress(int keyCode) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()
|
||||
&& mReactHost != null) {
|
||||
DevSupportManager devSupportManager = mReactHost.getDevSupportManager();
|
||||
// onKeyLongPress is a Dev API and not supported in RELEASE mode.
|
||||
if (devSupportManager != null && !(devSupportManager instanceof ReleaseDevSupportManager)) {
|
||||
devSupportManager.showDevOptionsDialog();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
ReactNativeHost reactNativeHost = getReactNativeHost();
|
||||
if (reactNativeHost != null
|
||||
&& reactNativeHost.hasInstance()
|
||||
&& reactNativeHost.getUseDeveloperSupport()) {
|
||||
reactNativeHost.getReactInstanceManager().showDevOptionsDialog();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
DevSupportManager devSupportManager = getDevSupportManager();
|
||||
if (devSupportManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reload in RELEASE mode
|
||||
if (devSupportManager instanceof ReleaseDevSupportManager) {
|
||||
// Do not reload the bundle from JS as there is no bundler running in release mode.
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
if (mReactHost != null) {
|
||||
mReactHost.reload("ReactDelegate.reload()");
|
||||
}
|
||||
} else {
|
||||
UiThreadUtil.runOnUiThread(
|
||||
() -> {
|
||||
if (mReactNativeHost != null
|
||||
&& mReactNativeHost.hasInstance()
|
||||
&& mReactNativeHost.getReactInstanceManager() != null) {
|
||||
mReactNativeHost.getReactInstanceManager().recreateReactContextInBackground();
|
||||
}
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Reload in DEBUG mode
|
||||
devSupportManager.handleReloadJS();
|
||||
}
|
||||
|
||||
/** Start the React surface with the app key supplied in the {@link ReactDelegate} constructor. */
|
||||
public void loadApp() {
|
||||
if (mMainComponentName == null) {
|
||||
throw new IllegalStateException("Cannot loadApp without a main component name.");
|
||||
} else {
|
||||
loadApp(mMainComponentName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the React surface for the given app key.
|
||||
*
|
||||
* @param appKey The ID of the app to load into the surface.
|
||||
*/
|
||||
public void loadApp(String appKey) {
|
||||
// With Bridgeless enabled, create and start the surface
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
if (mReactSurface == null && mReactHost != null) {
|
||||
mReactSurface = mReactHost.createSurface(mActivity, appKey, mLaunchOptions);
|
||||
}
|
||||
Objects.requireNonNull(mReactSurface).start();
|
||||
} else {
|
||||
if (mReactRootView != null) {
|
||||
throw new IllegalStateException("Cannot loadApp while app is already running.");
|
||||
}
|
||||
mReactRootView = createRootView();
|
||||
if (getReactNativeHost() != null) {
|
||||
mReactRootView.startReactApplication(
|
||||
getReactNativeHost().getReactInstanceManager(), appKey, mLaunchOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Stop the React surface started with {@link ReactDelegate#loadApp()}. */
|
||||
public void unloadApp() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
if (mReactSurface != null) {
|
||||
mReactSurface.stop();
|
||||
mReactSurface = null;
|
||||
}
|
||||
} else {
|
||||
if (mReactRootView != null) {
|
||||
mReactRootView.unmountReactApplication();
|
||||
mReactRootView = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setReactSurface(ReactSurface reactSurface) {
|
||||
mReactSurface = reactSurface;
|
||||
}
|
||||
|
||||
public void setReactRootView(ReactRootView reactRootView) {
|
||||
mReactRootView = reactRootView;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ReactRootView getReactRootView() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
if (mReactSurface != null) {
|
||||
return (ReactRootView) mReactSurface.getView();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return mReactRootView;
|
||||
}
|
||||
}
|
||||
|
||||
// Not used in bridgeless
|
||||
protected ReactRootView createRootView() {
|
||||
ReactRootView reactRootView = new ReactRootView(mActivity);
|
||||
reactRootView.setIsFabric(isFabricEnabled());
|
||||
return reactRootView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles delegating the {@link Activity#onKeyUp(int, KeyEvent)} method to determine whether the
|
||||
* application should show the developer menu or should reload the React Application.
|
||||
*
|
||||
* @return true if we consume the event and either shoed the develop menu or reloaded the
|
||||
* application.
|
||||
*/
|
||||
public boolean shouldShowDevMenuOrReload(int keyCode, KeyEvent event) {
|
||||
DevSupportManager devSupportManager = getDevSupportManager();
|
||||
// shouldShowDevMenuOrReload is a Dev API and not supported in RELEASE mode.
|
||||
if (devSupportManager == null || devSupportManager instanceof ReleaseDevSupportManager) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
devSupportManager.showDevOptionsDialog();
|
||||
return true;
|
||||
}
|
||||
boolean didDoubleTapR =
|
||||
Objects.requireNonNull(mDoubleTapReloadRecognizer)
|
||||
.didDoubleTapR(keyCode, mActivity.getCurrentFocus());
|
||||
if (didDoubleTapR) {
|
||||
devSupportManager.handleReloadJS();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Get the {@link ReactNativeHost} used by this app. */
|
||||
@DeprecatedInNewArchitecture(message = "Use getReactHost()")
|
||||
private @Nullable ReactNativeHost getReactNativeHost() {
|
||||
return mReactNativeHost;
|
||||
}
|
||||
|
||||
@DeprecatedInNewArchitecture(message = "Use getReactHost()")
|
||||
public ReactInstanceManager getReactInstanceManager() {
|
||||
if (getReactNativeHost() == null) {
|
||||
throw new IllegalStateException("Cannot get ReactInstanceManager without a ReactNativeHost.");
|
||||
}
|
||||
return getReactNativeHost().getReactInstanceManager();
|
||||
}
|
||||
|
||||
public @Nullable ReactHost getReactHost() {
|
||||
return mReactHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current {@link ReactContext} from ReactHost or ReactInstanceManager
|
||||
*
|
||||
* <p>Do not store a reference to this, if the React instance is reloaded or destroyed, this
|
||||
* context will no longer be valid.
|
||||
*/
|
||||
public @Nullable ReactContext getCurrentReactContext() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
if (mReactHost != null) {
|
||||
return mReactHost.getCurrentReactContext();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return getReactInstanceManager().getCurrentReactContext();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method if you wish to selectively toggle Fabric for a specific surface. This will
|
||||
* also control if Concurrent Root (React 18) should be enabled or not.
|
||||
*
|
||||
* @return true if Fabric is enabled for this Activity, false otherwise.
|
||||
*/
|
||||
protected boolean isFabricEnabled() {
|
||||
return mFabricEnabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,410 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.bridge.UiThreadUtil.runOnUiThread
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
|
||||
import com.facebook.react.devsupport.DoubleTapReloadRecognizer
|
||||
import com.facebook.react.devsupport.ReleaseDevSupportManager
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
||||
import com.facebook.react.interfaces.fabric.ReactSurface
|
||||
import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags
|
||||
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
|
||||
|
||||
/**
|
||||
* A delegate for handling React Application support. This delegate is unaware whether it is used in
|
||||
* an [Activity] or a [android.app.Fragment].
|
||||
*/
|
||||
public open class ReactDelegate {
|
||||
private val activity: Activity
|
||||
private var internalReactRootView: ReactRootView? = null
|
||||
private val mainComponentName: String?
|
||||
private var launchOptions: Bundle?
|
||||
private var doubleTapReloadRecognizer: DoubleTapReloadRecognizer?
|
||||
private var reactNativeHost: ReactNativeHost? = null
|
||||
public var reactHost: ReactHost? = null
|
||||
private set
|
||||
|
||||
private var reactSurface: ReactSurface? = null
|
||||
|
||||
/**
|
||||
* Override this method if you wish to selectively toggle Fabric for a specific surface. This will
|
||||
* also control if Concurrent Root (React 18) should be enabled or not.
|
||||
*
|
||||
* @return true if Fabric is enabled for this Activity, false otherwise.
|
||||
*/
|
||||
protected var isFabricEnabled: Boolean =
|
||||
ReactNativeNewArchitectureFeatureFlags.enableFabricRenderer()
|
||||
private set
|
||||
|
||||
/**
|
||||
* Do not use this constructor as it's not accounting for New Architecture at all. You should use
|
||||
* [ReactDelegate(Activity, ReactNativeHost, String, Bundle, boolean)] as it's the constructor
|
||||
* used for New Architecture.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use one of the other constructors instead to account for New Architecture. Deprecated since 0.75.0")
|
||||
public constructor(
|
||||
activity: Activity,
|
||||
reactNativeHost: ReactNativeHost?,
|
||||
appKey: String?,
|
||||
launchOptions: Bundle?
|
||||
) {
|
||||
this.activity = activity
|
||||
mainComponentName = appKey
|
||||
this.launchOptions = launchOptions
|
||||
doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
||||
this.reactNativeHost = reactNativeHost
|
||||
}
|
||||
|
||||
public constructor(
|
||||
activity: Activity,
|
||||
reactHost: ReactHost?,
|
||||
appKey: String?,
|
||||
launchOptions: Bundle?
|
||||
) {
|
||||
this.activity = activity
|
||||
mainComponentName = appKey
|
||||
this.launchOptions = launchOptions
|
||||
doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
||||
this.reactHost = reactHost
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated since 0.81.0, use one of the other constructors instead.")
|
||||
public constructor(
|
||||
activity: Activity,
|
||||
reactNativeHost: ReactNativeHost?,
|
||||
appKey: String?,
|
||||
launchOptions: Bundle?,
|
||||
fabricEnabled: Boolean
|
||||
) {
|
||||
isFabricEnabled = fabricEnabled
|
||||
this.activity = activity
|
||||
mainComponentName = appKey
|
||||
this.launchOptions = launchOptions
|
||||
doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
||||
this.reactNativeHost = reactNativeHost
|
||||
}
|
||||
|
||||
private val devSupportManager: DevSupportManager?
|
||||
get() =
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost?.devSupportManager != null) {
|
||||
reactHost?.devSupportManager
|
||||
} else if (reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.reactInstanceManager != null) {
|
||||
reactNativeHost?.reactInstanceManager?.devSupportManager
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
public fun onHostResume() {
|
||||
if (activity !is DefaultHardwareBackBtnHandler) {
|
||||
throw ClassCastException(
|
||||
"Host Activity `${activity.javaClass.simpleName}` does not implement DefaultHardwareBackBtnHandler")
|
||||
}
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
reactHost?.onHostResume(activity, activity as DefaultHardwareBackBtnHandler)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
reactNativeHost
|
||||
?.reactInstanceManager
|
||||
?.onHostResume(activity, activity as DefaultHardwareBackBtnHandler)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun onUserLeaveHint() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
reactHost?.onHostLeaveHint(activity)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
reactNativeHost?.reactInstanceManager?.onUserLeaveHint(activity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun onHostPause() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
reactHost?.onHostPause(activity)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
reactNativeHost?.reactInstanceManager?.onHostPause(activity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun onHostDestroy() {
|
||||
unloadApp()
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
reactHost?.onHostDestroy(activity)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
reactNativeHost?.reactInstanceManager?.onHostDestroy(activity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun onBackPressed(): Boolean {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
reactHost?.onBackPressed()
|
||||
return true
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
reactNativeHost?.reactInstanceManager?.onBackPressed()
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public fun onNewIntent(intent: Intent): Boolean {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
reactHost?.onNewIntent(intent)
|
||||
return true
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
reactNativeHost?.reactInstanceManager?.onNewIntent(intent)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public fun onActivityResult(
|
||||
requestCode: Int,
|
||||
resultCode: Int,
|
||||
data: Intent?,
|
||||
shouldForwardToReactInstance: Boolean
|
||||
) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null &&
|
||||
shouldForwardToReactInstance) {
|
||||
reactHost?.onActivityResult(activity, requestCode, resultCode, data)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true && shouldForwardToReactInstance) {
|
||||
reactNativeHost
|
||||
?.reactInstanceManager
|
||||
?.onActivityResult(activity, requestCode, resultCode, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
reactHost?.onWindowFocusChange(hasFocus)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
reactNativeHost?.reactInstanceManager?.onWindowFocusChange(hasFocus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
reactHost?.onConfigurationChanged(checkNotNull(activity))
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
getReactInstanceManager().onConfigurationChanged(checkNotNull(activity), newConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD &&
|
||||
((ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost?.devSupportManager != null) ||
|
||||
(reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.useDeveloperSupport == true))) {
|
||||
event.startTracking()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public fun onKeyLongPress(keyCode: Int): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
val devSupportManager = reactHost?.devSupportManager
|
||||
// onKeyLongPress is a Dev API and not supported in RELEASE mode.
|
||||
if (devSupportManager != null && devSupportManager !is ReleaseDevSupportManager) {
|
||||
devSupportManager.showDevOptionsDialog()
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.useDeveloperSupport == true) {
|
||||
reactNativeHost?.reactInstanceManager?.showDevOptionsDialog()
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public fun reload() {
|
||||
val devSupportManager = devSupportManager ?: return
|
||||
|
||||
// Reload in RELEASE mode
|
||||
if (devSupportManager is ReleaseDevSupportManager) {
|
||||
// Do not reload the bundle from JS as there is no bundler running in release mode.
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
reactHost?.reload("ReactDelegate.reload()")
|
||||
} else {
|
||||
runOnUiThread {
|
||||
if (reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.reactInstanceManager != null) {
|
||||
reactNativeHost?.reactInstanceManager?.recreateReactContextInBackground()
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Reload in DEBUG mode
|
||||
devSupportManager.handleReloadJS()
|
||||
}
|
||||
|
||||
/** Start the React surface with the app key supplied in the [ReactDelegate] constructor. */
|
||||
public fun loadApp() {
|
||||
val name = requireNotNull(mainComponentName) { "Cannot loadApp without a main component name." }
|
||||
loadApp(name)
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the React surface for the given app key.
|
||||
*
|
||||
* @param appKey The ID of the app to load into the surface.
|
||||
*/
|
||||
public fun loadApp(appKey: String) {
|
||||
// With Bridgeless enabled, create and start the surface
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
val reactHost = reactHost
|
||||
if (reactSurface == null && reactHost != null) {
|
||||
reactSurface = reactHost.createSurface(activity, appKey, launchOptions)
|
||||
}
|
||||
reactSurface?.start()
|
||||
} else {
|
||||
check(internalReactRootView == null) { "Cannot loadApp while app is already running." }
|
||||
internalReactRootView = createRootView()
|
||||
if (reactNativeHost != null) {
|
||||
internalReactRootView?.startReactApplication(
|
||||
reactNativeHost?.reactInstanceManager, appKey, launchOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Stop the React surface started with [ReactDelegate.loadApp]. */
|
||||
public fun unloadApp() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
reactSurface?.stop()
|
||||
reactSurface = null
|
||||
} else {
|
||||
if (internalReactRootView != null) {
|
||||
internalReactRootView?.unmountReactApplication()
|
||||
internalReactRootView = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public fun setReactSurface(reactSurface: ReactSurface?) {
|
||||
this.reactSurface = reactSurface
|
||||
}
|
||||
|
||||
public var reactRootView: ReactRootView?
|
||||
get() {
|
||||
return if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
if (reactSurface != null) {
|
||||
reactSurface?.view as ReactRootView?
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
internalReactRootView
|
||||
}
|
||||
}
|
||||
set(reactRootView) {
|
||||
internalReactRootView = reactRootView
|
||||
}
|
||||
|
||||
// Not used in bridgeless
|
||||
protected open fun createRootView(): ReactRootView? {
|
||||
val reactRootView = ReactRootView(activity)
|
||||
reactRootView.setIsFabric(isFabricEnabled)
|
||||
return reactRootView
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles delegating the [Activity.onKeyUp] method to determine whether the application should
|
||||
* show the developer menu or should reload the React Application.
|
||||
*
|
||||
* @return true if we consume the event and either show the develop menu or reloaded the
|
||||
* application.
|
||||
*/
|
||||
public fun shouldShowDevMenuOrReload(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
val devSupportManager = devSupportManager
|
||||
// shouldShowDevMenuOrReload is a Dev API and not supported in RELEASE mode.
|
||||
if (devSupportManager == null || devSupportManager is ReleaseDevSupportManager) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
devSupportManager.showDevOptionsDialog()
|
||||
return true
|
||||
}
|
||||
val didDoubleTapR = doubleTapReloadRecognizer?.didDoubleTapR(keyCode, activity.currentFocus)
|
||||
if (didDoubleTapR == true) {
|
||||
devSupportManager.handleReloadJS()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@DeprecatedInNewArchitecture(message = "Use reactHost")
|
||||
public fun getReactInstanceManager(): ReactInstanceManager {
|
||||
val nonNullReactNativeHost =
|
||||
checkNotNull(reactNativeHost) {
|
||||
"Cannot get ReactInstanceManager without a ReactNativeHost."
|
||||
}
|
||||
return nonNullReactNativeHost.reactInstanceManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current [ReactContext] from [ReactHost] or [ReactInstanceManager]
|
||||
*
|
||||
* Do not store a reference to this, if the React instance is reloaded or destroyed, this context
|
||||
* will no longer be valid.
|
||||
*/
|
||||
public val currentReactContext: ReactContext?
|
||||
get() {
|
||||
return if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
|
||||
if (reactHost != null) {
|
||||
reactHost?.currentReactContext
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
getReactInstanceManager().currentReactContext
|
||||
}
|
||||
}
|
||||
}
|
||||
-2
@@ -74,7 +74,6 @@ import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
|
||||
import com.facebook.react.common.LifecycleState;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.SurfaceDelegateFactory;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
@@ -1119,7 +1118,6 @@ public class ReactInstanceManager {
|
||||
/**
|
||||
* @return current ReactApplicationContext
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public @Nullable ReactContext getCurrentReactContext() {
|
||||
synchronized (mReactContextLock) {
|
||||
return mCurrentReactContext;
|
||||
|
||||
+45
-59
@@ -80,7 +80,7 @@ import kotlin.concurrent.Volatile
|
||||
*/
|
||||
@OptIn(UnstableReactNativeAPI::class)
|
||||
@ReactModule(name = NativeAnimatedModuleSpec.NAME)
|
||||
public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
public class NativeAnimatedModule(reactContext: ReactApplicationContext) :
|
||||
NativeAnimatedModuleSpec(reactContext), LifecycleEventListener, UIManagerListener {
|
||||
|
||||
// For `queueAndExecuteBatchedOperations`
|
||||
@@ -163,12 +163,13 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
// Due to a race condition, we manually "carry-over" a polled item from previous batch
|
||||
// instead of peeking the queue itself for consistency.
|
||||
// TODO(T112522554): Clean up the queue access
|
||||
val peekedOperation = peekedOperation
|
||||
if (peekedOperation != null) {
|
||||
if (checkNotNull(peekedOperation).batchNumber > maxBatchNumber) {
|
||||
if (peekedOperation.batchNumber > maxBatchNumber) {
|
||||
break
|
||||
}
|
||||
operations.add(checkNotNull(peekedOperation))
|
||||
peekedOperation = null
|
||||
operations.add(peekedOperation)
|
||||
this.peekedOperation = null
|
||||
}
|
||||
|
||||
val polledOperation =
|
||||
@@ -179,7 +180,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (polledOperation.batchNumber > maxBatchNumber) {
|
||||
// Because the operation is already retrieved from the queue, there's no way of placing it
|
||||
// back as the head element, so we remember it manually here
|
||||
peekedOperation = polledOperation
|
||||
this.peekedOperation = polledOperation
|
||||
break
|
||||
}
|
||||
operations.add(polledOperation)
|
||||
@@ -189,8 +190,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
}
|
||||
}
|
||||
|
||||
private val animatedFrameCallback: GuardedFrameCallback
|
||||
private val reactChoreographer: ReactChoreographer? = ReactChoreographer.getInstance()
|
||||
private val reactChoreographer: ReactChoreographer = ReactChoreographer.getInstance()
|
||||
|
||||
private val operations = ConcurrentOperationQueue()
|
||||
private val preOperations = ConcurrentOperationQueue()
|
||||
@@ -205,7 +205,6 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
|
||||
private var initializedForFabric = false
|
||||
private var initializedForNonFabric = false
|
||||
private var enqueuedAnimationOnFrame = false
|
||||
|
||||
@UIManagerType private var uiManagerType = UIManagerType.LEGACY
|
||||
private var numFabricAnimations = 0
|
||||
@@ -302,8 +301,8 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
}
|
||||
}
|
||||
|
||||
checkNotNull(preOperations).executeBatch(batchNumber, nodesManager)
|
||||
checkNotNull(operations).executeBatch(batchNumber, nodesManager)
|
||||
preOperations.executeBatch(batchNumber, nodesManager)
|
||||
operations.executeBatch(batchNumber, nodesManager)
|
||||
}
|
||||
|
||||
// For non-FabricUIManager only
|
||||
@@ -322,11 +321,9 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
// might be stripped out.
|
||||
val frameNo = currentBatchNumber++
|
||||
|
||||
val preOperationsUIBlock = UIBlock {
|
||||
checkNotNull(preOperations).executeBatch(frameNo, nodesManager)
|
||||
}
|
||||
val preOperationsUIBlock = UIBlock { preOperations.executeBatch(frameNo, nodesManager) }
|
||||
|
||||
val operationsUIBlock = UIBlock { checkNotNull(operations).executeBatch(frameNo, nodesManager) }
|
||||
val operationsUIBlock = UIBlock { operations.executeBatch(frameNo, nodesManager) }
|
||||
|
||||
assert(uiManager is UIManagerModule)
|
||||
val uiManagerModule = uiManager as UIManagerModule
|
||||
@@ -366,41 +363,34 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
nodesManagerRef.set(nodesManager)
|
||||
}
|
||||
|
||||
init {
|
||||
animatedFrameCallback =
|
||||
object : GuardedFrameCallback(checkNotNull(reactContext)) {
|
||||
override fun doFrameGuarded(frameTimeNanos: Long) {
|
||||
try {
|
||||
enqueuedAnimationOnFrame = false
|
||||
val nodesManager = nodesManager
|
||||
if (nodesManager?.hasActiveAnimations() == true) {
|
||||
nodesManager.runUpdates(frameTimeNanos)
|
||||
}
|
||||
// This is very unlikely to ever be hit.
|
||||
if (nodesManager == null || reactChoreographer == null) {
|
||||
return
|
||||
}
|
||||
|
||||
enqueueFrameCallback()
|
||||
} catch (ex: Exception) {
|
||||
throw RuntimeException(ex)
|
||||
private var enqueuedAnimationOnFrame = false
|
||||
private val animatedFrameCallback =
|
||||
object : GuardedFrameCallback(reactContext) {
|
||||
override fun doFrameGuarded(frameTimeNanos: Long) {
|
||||
try {
|
||||
enqueuedAnimationOnFrame = false
|
||||
val nodesManager = nodesManager ?: return
|
||||
if (nodesManager.hasActiveAnimations()) {
|
||||
nodesManager.runUpdates(frameTimeNanos)
|
||||
}
|
||||
|
||||
enqueueFrameCallback()
|
||||
} catch (ex: Exception) {
|
||||
throw RuntimeException(ex)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearFrameCallback() {
|
||||
checkNotNull(reactChoreographer)
|
||||
.removeFrameCallback(
|
||||
ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE, animatedFrameCallback)
|
||||
reactChoreographer.removeFrameCallback(
|
||||
ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE, animatedFrameCallback)
|
||||
enqueuedAnimationOnFrame = false
|
||||
}
|
||||
|
||||
private fun enqueueFrameCallback() {
|
||||
if (!enqueuedAnimationOnFrame) {
|
||||
checkNotNull(reactChoreographer)
|
||||
.postFrameCallback(
|
||||
ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE, animatedFrameCallback)
|
||||
reactChoreographer.postFrameCallback(
|
||||
ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE, animatedFrameCallback)
|
||||
enqueuedAnimationOnFrame = true
|
||||
}
|
||||
}
|
||||
@@ -431,8 +421,9 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
}
|
||||
|
||||
// Subscribe to UIManager (Fabric or non-Fabric) lifecycle events if we haven't yet
|
||||
if (if (uiManagerType == UIManagerType.FABRIC) initializedForFabric
|
||||
else initializedForNonFabric) {
|
||||
val initialized =
|
||||
if (uiManagerType == UIManagerType.FABRIC) initializedForFabric else initializedForNonFabric
|
||||
if (initialized) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -494,16 +485,14 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
override fun createAnimatedNode(tagDouble: Double, config: ReadableMap) {
|
||||
val tag = tagDouble.toInt()
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(NAME, "queue createAnimatedNode: ${tag} config: ${config.toHashMap().toString()}")
|
||||
FLog.d(NAME, "queue createAnimatedNode: $tag config: ${config.toHashMap()}")
|
||||
}
|
||||
|
||||
addOperation(
|
||||
object : UIThreadOperation() {
|
||||
override fun execute(animatedNodesManager: NativeAnimatedNodesManager) {
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("execute createAnimatedNode: ${tag} config: ${config.toHashMap().toString()}"))
|
||||
FLog.d(NAME, ("execute createAnimatedNode: $tag config: ${config.toHashMap()}"))
|
||||
}
|
||||
animatedNodesManager.createAnimatedNode(tag, config)
|
||||
}
|
||||
@@ -513,17 +502,14 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
override fun updateAnimatedNodeConfig(tagDouble: Double, config: ReadableMap) {
|
||||
val tag = tagDouble.toInt()
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME, "queue updateAnimatedNodeConfig: ${tag} config: ${config.toHashMap().toString()}")
|
||||
FLog.d(NAME, "queue updateAnimatedNodeConfig: $tag config: ${config.toHashMap()}")
|
||||
}
|
||||
|
||||
addOperation(
|
||||
object : UIThreadOperation() {
|
||||
override fun execute(animatedNodesManager: NativeAnimatedNodesManager) {
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("execute updateAnimatedNodeConfig: ${tag} config: ${config.toHashMap().toString()}"))
|
||||
FLog.d(NAME, ("execute updateAnimatedNodeConfig: $tag config: ${config.toHashMap()}"))
|
||||
}
|
||||
animatedNodesManager.updateAnimatedNodeConfig(tag, config)
|
||||
}
|
||||
@@ -714,7 +700,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("execute connectAnimatedNodes: parent: ${parentNodeTag} child: ${childNodeTag}"))
|
||||
("execute connectAnimatedNodes: parent: $parentNodeTag child: $childNodeTag"))
|
||||
}
|
||||
animatedNodesManager.connectAnimatedNodes(parentNodeTag, childNodeTag)
|
||||
}
|
||||
@@ -734,7 +720,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("execute disconnectAnimatedNodes: parent: ${parentNodeTag} child: ${childNodeTag}"))
|
||||
("execute disconnectAnimatedNodes: parent: $parentNodeTag child: $childNodeTag"))
|
||||
}
|
||||
animatedNodesManager.disconnectAnimatedNodes(parentNodeTag, childNodeTag)
|
||||
}
|
||||
@@ -747,7 +733,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("queue connectAnimatedNodeToView: animatedNodeTag: ${animatedNodeTag} viewTag: ${viewTag}"))
|
||||
("queue connectAnimatedNodeToView: animatedNodeTag: $animatedNodeTag viewTag: $viewTag"))
|
||||
}
|
||||
|
||||
initializeLifecycleEventListenersForViewTag(viewTag)
|
||||
@@ -758,7 +744,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("execute connectAnimatedNodeToView: animatedNodeTag: ${animatedNodeTag} viewTag: ${viewTag}"))
|
||||
("execute connectAnimatedNodeToView: animatedNodeTag: $animatedNodeTag viewTag: $viewTag"))
|
||||
}
|
||||
animatedNodesManager.connectAnimatedNodeToView(animatedNodeTag, viewTag)
|
||||
}
|
||||
@@ -783,7 +769,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("execute disconnectAnimatedNodeFromView: ${animatedNodeTag} viewTag: ${viewTag}"))
|
||||
("execute disconnectAnimatedNodeFromView: $animatedNodeTag viewTag: $viewTag"))
|
||||
}
|
||||
animatedNodesManager.disconnectAnimatedNodeFromView(animatedNodeTag, viewTag)
|
||||
}
|
||||
@@ -816,7 +802,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("queue addAnimatedEventToView: ${viewTag} eventName: ${eventName} eventMapping: ${eventMapping.toHashMap().toString()}"))
|
||||
("queue addAnimatedEventToView: $viewTag eventName: $eventName eventMapping: ${eventMapping.toHashMap()}"))
|
||||
}
|
||||
|
||||
initializeLifecycleEventListenersForViewTag(viewTag)
|
||||
@@ -827,7 +813,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("execute addAnimatedEventToView: ${viewTag} eventName: ${eventName} eventMapping: ${eventMapping.toHashMap().toString()}"))
|
||||
("execute addAnimatedEventToView: $viewTag eventName: $eventName eventMapping: ${eventMapping.toHashMap()}"))
|
||||
}
|
||||
animatedNodesManager.addAnimatedEventToView(viewTag, eventName, eventMapping)
|
||||
}
|
||||
@@ -844,7 +830,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("queue removeAnimatedEventFromView: viewTag: ${viewTag} eventName: ${eventName} animatedValueTag: ${animatedValueTag}"))
|
||||
("queue removeAnimatedEventFromView: viewTag: $viewTag eventName: $eventName animatedValueTag: $animatedValueTag"))
|
||||
}
|
||||
|
||||
decrementInFlightAnimationsForViewTag(viewTag)
|
||||
@@ -855,7 +841,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
|
||||
if (ANIMATED_MODULE_DEBUG) {
|
||||
FLog.d(
|
||||
NAME,
|
||||
("execute removeAnimatedEventFromView: viewTag: ${viewTag} eventName: ${eventName} animatedValueTag: ${animatedValueTag}"))
|
||||
("execute removeAnimatedEventFromView: viewTag: $viewTag eventName: $eventName animatedValueTag: $animatedValueTag"))
|
||||
}
|
||||
animatedNodesManager.removeAnimatedEventFromView(viewTag, eventName, animatedValueTag)
|
||||
}
|
||||
|
||||
+3
-3
@@ -381,7 +381,7 @@ public class NativeAnimatedNodesManager(
|
||||
("connectAnimatedNodeToView: Animated node connected to view [${viewTag}] should be of type ${PropsAnimatedNode::class.java.name}"))
|
||||
}
|
||||
checkNotNull(reactApplicationContext) {
|
||||
("connectAnimatedNodeToView: Animated node could not be connected, no ReactApplicationContext: ${viewTag}")
|
||||
("connectAnimatedNodeToView: Animated node could not be connected, no ReactApplicationContext: $viewTag")
|
||||
}
|
||||
|
||||
val uiManager = UIManagerHelper.getUIManagerForReactTag(reactApplicationContext, viewTag)
|
||||
@@ -389,7 +389,7 @@ public class NativeAnimatedNodesManager(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
ReactNoCrashSoftException(
|
||||
("connectAnimatedNodeToView: Animated node could not be connected to UIManager - uiManager disappeared for tag: ${viewTag}")))
|
||||
("connectAnimatedNodeToView: Animated node could not be connected to UIManager - uiManager disappeared for tag: $viewTag")))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ public class NativeAnimatedNodesManager(
|
||||
val reason = if (cyclesDetected > 0) ("cycles ($cyclesDetected)") else "disconnected regions"
|
||||
val ex =
|
||||
IllegalStateException(
|
||||
("Looks like animated nodes graph has ${reason}, there are ${activeNodesCount} but toposort visited only ${updatedNodesCount}"))
|
||||
("Looks like animated nodes graph has ${reason}, there are $activeNodesCount but toposort visited only $updatedNodesCount"))
|
||||
if (eventListenerInitializedForFabric && cyclesDetected == 0) {
|
||||
// TODO T71377544: investigate these SoftExceptions and see if we can remove entirely
|
||||
// or fix the root cause
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@ public open class BaseActivityEventListener : ActivityEventListener {
|
||||
ReplaceWith("onActivityResult(activity, requestCode, resultCode, data)"))
|
||||
public open fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent): Unit = Unit
|
||||
|
||||
override public fun onActivityResult(
|
||||
public override fun onActivityResult(
|
||||
activity: Activity,
|
||||
requestCode: Int,
|
||||
resultCode: Int,
|
||||
data: Intent?
|
||||
): Unit = Unit
|
||||
|
||||
override public fun onNewIntent(intent: Intent): Unit = Unit
|
||||
public override fun onNewIntent(intent: Intent): Unit = Unit
|
||||
}
|
||||
|
||||
+2
-3
@@ -9,7 +9,6 @@ package com.facebook.react.bridge
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import com.facebook.react.bridge.queue.ReactQueueConfiguration
|
||||
import com.facebook.react.common.annotations.VisibleForTesting
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModuleRegistry
|
||||
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
|
||||
@@ -53,7 +52,7 @@ public interface CatalystInstance : MemoryPressureListener, JSInstance, JSBundle
|
||||
public val isDestroyed: Boolean
|
||||
|
||||
/** Initialize all the native modules */
|
||||
@VisibleForTesting public fun initialize()
|
||||
public fun initialize()
|
||||
|
||||
public val reactQueueConfiguration: ReactQueueConfiguration
|
||||
|
||||
@@ -90,7 +89,7 @@ public interface CatalystInstance : MemoryPressureListener, JSInstance, JSBundle
|
||||
/** This method registers the file path of an additional JS segment by its ID. */
|
||||
public fun registerSegment(segmentId: Int, path: String)
|
||||
|
||||
@VisibleForTesting public fun setGlobalVariable(propName: String, jsonValue: String)
|
||||
public fun setGlobalVariable(propName: String, jsonValue: String)
|
||||
|
||||
/**
|
||||
* Do not use this anymore. Use [runtimeExecutor] instead. Get the C pointer (as a long) to the
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ protected constructor(private val exceptionHandler: JSExceptionHandler) :
|
||||
protected constructor(reactContext: ReactContext) : this(reactContext.exceptionHandler)
|
||||
|
||||
@Deprecated("AsyncTask is deprecated.")
|
||||
override protected final fun doInBackground(vararg params: Params): Void? {
|
||||
protected final override fun doInBackground(vararg params: Params): Void? {
|
||||
try {
|
||||
doInBackgroundGuarded(*params)
|
||||
} catch (e: RuntimeException) {
|
||||
|
||||
+8
-9
@@ -134,15 +134,14 @@ public class JavaOnlyArray : ReadableArray, WritableArray {
|
||||
|
||||
override fun toString(): String = backingList.toString()
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
} else if (other == null || javaClass != other.javaClass) {
|
||||
return false
|
||||
} else {
|
||||
return backingList == (other as JavaOnlyArray).backingList
|
||||
}
|
||||
}
|
||||
override fun equals(other: Any?): Boolean =
|
||||
if (this === other) {
|
||||
true
|
||||
} else if (other == null || javaClass != other.javaClass) {
|
||||
false
|
||||
} else {
|
||||
backingList == (other as JavaOnlyArray).backingList
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = backingList.hashCode()
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user