diff --git a/.circleci/config.yml b/.circleci/config.yml
index 18d5af7b4d9dd6..989546507a67ee 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -724,10 +724,6 @@ jobs:
# -------------------------
test_android:
executor: reactnativeandroid
- parameters:
- run_disabled_tests:
- type: boolean
- default: false
steps:
- checkout
- setup_artifacts
@@ -741,18 +737,16 @@ jobs:
- report_bundle_size:
platform: android
+ - store_test_results:
+ path: ~/react-native/packages/react-native-gradle-plugin/build/test-results
+
+ - store_test_results:
+ path: ~/react-native/packages/react-native/ReactAndroid/build/test-results
+
- store_artifacts:
path: ~/react-native/packages/rn-tester/android/app/build/outputs/apk/
destination: rntester-apk
- # Optionally, run disabled tests
- - when:
- condition: << parameters.run_disabled_tests >>
- steps:
- - run: echo "Failing tests may be moved here temporarily."
- - run_e2e:
- platform: android
-
# -------------------------
# JOBS: Test Android Docker Image
# -------------------------
@@ -1602,8 +1596,7 @@ workflows:
- build_hermesc_windows
- test_js:
run_disabled_tests: false
- - test_android:
- run_disabled_tests: false
+ - test_android
- test_android_docker_image
- test_android_template:
requires:
diff --git a/.eslintrc.js b/.eslintrc.js
index 2755223a478e90..622c41bf0d51c0 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -21,7 +21,7 @@ module.exports = {
plugins: ['@react-native/eslint-plugin-specs', 'lint'],
overrides: [
- // overriding the JS config from eslint-config-react-native-community config to ensure
+ // overriding the JS config from @react-native/eslint-config to ensure
// that we use hermes-eslint for all js files
{
files: ['*.js'],
diff --git a/.flowconfig b/.flowconfig
index 3fddc6142a6c00..d7312aeeaf7ec7 100644
--- a/.flowconfig
+++ b/.flowconfig
@@ -75,4 +75,4 @@ untyped-import
untyped-type-import
[version]
-^0.204.0
+^0.205.1
diff --git a/.flowconfig.android b/.flowconfig.android
index e486b3865be378..77b5dcf3bf299c 100644
--- a/.flowconfig.android
+++ b/.flowconfig.android
@@ -75,4 +75,4 @@ untyped-import
untyped-type-import
[version]
-^0.204.0
+^0.205.1
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
deleted file mode 100644
index 113169229179c8..00000000000000
--- a/.github/CODEOWNERS
+++ /dev/null
@@ -1,40 +0,0 @@
-# See https://help.github.com/en/articles/about-code-owners
-# to learn more about code owners.
-# Order is important; the last matching pattern takes the most
-# precedence. You may specify either a GitHub username, or an
-# email address if you prefer, as the code owner.
-
-# Any Markdown file anywhere in the repository
-**/*.md @hramos @cpojer
-
-# GitHub Settings, Bots
-/.github/ @hramos
-/packages/react-native-bots @hramos
-
-# Continuous Integration
-/.circleci/ @hramos
-/.circleci/Dockerfiles @gengjiawen
-/.appveyor/ @gengjiawen
-
-# Internals
-React/Base/* @shergin
-React/Views/* @shergin
-React/Modules/* @shergin
-React/CxxBridge/* @mhorowitz
-
-# Components and APIs
-ReactAndroid/src/main/java/com/facebook/react/animated/* @janicduplessis
-Libraries/Animated/* @janicduplessis
-Libraries/NativeAnimation/* @janicduplessis
-Libraries/Image/* @shergin
-Libraries/Text/* @shergin
-
-# Modifications to package.json typically require
-# additional effort from a Facebook employee to land
-/package.json @hramos @cpojer
-
-# These should not be modified through a GitHub PR
-LICENSE* @hramos @cpojer @yungsters
-
-# The eslint-config-react-native-community package requires manual publishing after merging
-/packages/eslint-config-react-native-community/* @matt-oakes
diff --git a/.github/workflow-scripts/actOnLabel.js b/.github/workflow-scripts/actOnLabel.js
index 5073523ee46893..78571fd0ac0511 100644
--- a/.github/workflow-scripts/actOnLabel.js
+++ b/.github/workflow-scripts/actOnLabel.js
@@ -7,7 +7,7 @@
* @format
*/
-module.exports = async (github, context, label) => {
+module.exports = async (github, context, labelWithContext) => {
const closeIssue = async () => {
await github.rest.issues.update({
issue_number: context.issue.number,
@@ -45,7 +45,7 @@ module.exports = async (github, context, label) => {
});
};
- switch (label) {
+ switch (labelWithContext.label) {
case 'Type: Invalid':
await addComment(
`| :warning: | Issue is Invalid |\n` +
@@ -102,11 +102,11 @@ module.exports = async (github, context, label) => {
);
await requestAuthorFeedback();
return;
- case 'Needs: Verify on Latest Version':
+ case 'Newer Patch Available':
await addComment(
`| :warning: | Newer Version of React Native is Available! |\n` +
`| --- | --- |\n` +
- `| :information_source: | You are on a supported minor version, but it looks like there's a newer patch available. Please [upgrade](https://reactnative.dev/docs/upgrading) to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |`,
+ `| :information_source: | You are on a supported minor version, but it looks like there's a newer patch available - ${labelWithContext.newestPatch}. Please [upgrade](https://reactnative.dev/docs/upgrading) to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |`,
);
return;
case 'Needs: Version Info':
@@ -121,7 +121,7 @@ module.exports = async (github, context, label) => {
await addComment(
`| :warning: | Missing Reproducible Example |\n` +
`| --- | --- |\n` +
- `| :information_source: | It looks like your issue is missing a reproducible example. Please provide a [Snack](https://snack.expo.dev) or a repository that demonstrates the issue you are reporting in a [minimal, complete, and reproducible](https://stackoverflow.com/help/minimal-reproducible-example) manner. |`,
+ `| :information_source: | It looks like your issue is missing a reproducible example. Please provide either:
- If your bug is UI related: a [Snack](https://snack.expo.dev)
- If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate)
|`,
);
await requestAuthorFeedback();
return;
diff --git a/.github/workflows/addDescriptiveLabels.js b/.github/workflow-scripts/addDescriptiveLabels.js
similarity index 100%
rename from .github/workflows/addDescriptiveLabels.js
rename to .github/workflow-scripts/addDescriptiveLabels.js
diff --git a/.github/workflow-scripts/verifyVersion.js b/.github/workflow-scripts/verifyVersion.js
index da66a1f2f0f700..b91efe898eed6e 100644
--- a/.github/workflow-scripts/verifyVersion.js
+++ b/.github/workflow-scripts/verifyVersion.js
@@ -23,7 +23,7 @@ module.exports = async (github, context) => {
if (reportedVersionIsNightly(issueVersionUnparsed, issueVersion)) return;
if (!issueVersion) {
- return 'Needs: Version Info';
+ return {label: 'Needs: Version Info'};
}
// Ensure the version matches one we support
@@ -43,7 +43,7 @@ module.exports = async (github, context) => {
const latestVersion = parseVersionFromString(latestRelease.name);
if (!isVersionSupported(issueVersion, latestVersion)) {
- return 'Type: Unsupported Version';
+ return {label: 'Type: Unsupported Version'};
}
// We want to encourage users to repro the issue on the highest available patch for the given minor.
@@ -52,7 +52,10 @@ module.exports = async (github, context) => {
recentReleases,
);
if (latestPatchForVersion > issueVersion.patch) {
- return 'Needs: Verify on Latest Version';
+ return {
+ label: 'Newer Patch Available',
+ newestPatch: `${issueVersion.major}.${issueVersion.minor}.${latestPatchForVersion}`,
+ };
}
};
diff --git a/.github/workflows/on-issue-labeled.yml b/.github/workflows/on-issue-labeled.yml
index f4e976bd3d9695..14f9d4e9c5d608 100644
--- a/.github/workflows/on-issue-labeled.yml
+++ b/.github/workflows/on-issue-labeled.yml
@@ -23,25 +23,25 @@ jobs:
with:
script: |
const verifyVersion = require('./.github/workflow-scripts/verifyVersion.js')
- const labelToAdd = await verifyVersion(github, context);
+ const labelWithContext = await verifyVersion(github, context);
- if(labelToAdd) {
+ if(labelWithContext && labelWithContext.label) {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
- labels: [labelToAdd]
+ labels: [labelWithContext.label]
})
const actOnLabel = require('./.github/workflow-scripts/actOnLabel.js')
- await actOnLabel(github, context, labelToAdd)
+ await actOnLabel(github, context, labelWithContext)
}
- name: Add descriptive label
uses: actions/github-script@v6
with:
script: |
- const addDescriptiveLabel = require('./.github/workflows/addDescriptiveLabels.js')
+ const addDescriptiveLabel = require('./.github/workflow-scripts/addDescriptiveLabels.js')
await addDescriptiveLabel(github, context);
# Reacts to the label that triggered this workflow (added manually or via other workflows)
@@ -54,4 +54,4 @@ jobs:
with:
script: |
const actOnLabel = require('./.github/workflow-scripts/actOnLabel.js')
- await actOnLabel(github, context, context.payload.label.name)
+ await actOnLabel(github, context, {label: context.payload.label.name})
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e32dccfb99ad87..315c44efb08823 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## v0.71.8
+
+### Fixed
+
+#### Android specific
+
+- Read GROUP name in gradle-plugin dependency code ([615d9aefc4](https://github.com/facebook/react-native/commit/615d9aefc4274ed7a193c0410ed7f86e90ad1bff) by [@douglowder](https://github.com/douglowder))
+- Bump RNGP to 0.71.18 ([4bf4c470fe](https://github.com/facebook/react-native/commit/4bf4c470fe4996af02f45c9a9d77c6a790a95362) by [@kelset](https://github.com/kelset))
+
+#### iOS specific
+
+- Do not send extra onChangeText even wnen instantianting multiline TextView ([a804c0f22b](https://github.com/facebook/react-native/commit/a804c0f22b4b11b3d9632dc59a6da14f6c4325e3) by [@dmytrorykun](https://github.com/dmytrorykun))
+
## v0.71.7
### Fixed
@@ -940,6 +953,20 @@ Read the [announcement blogpost here](https://reactnative.dev/blog/2023/01/12/ve
- Add GitHub token permissions for workflows ([3da3d82320](https://github.com/facebook/react-native/commit/3da3d82320bd035c6bd361a82ea12a70dba4e851) by [@varunsh-coder](https://github.com/varunsh-coder))
- Bump RCT-Folly to 2021-07-22 ([68f3a42fc7](https://github.com/facebook/react-native/commit/68f3a42fc7380051714253f43b42175de361f8bd) by [@luissantana](https://github.com/luissantana))
+## v0.69.10
+
+### Fixed
+
+#### Android specific
+
+- Minimize EditText Spans 8/N: CustomStyleSpan ([b384bb613b](https://github.com/facebook/react-native/commit/b384bb613bf533aebf3271ba335c61946fcd3303) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize EditText Spans 6/N: letterSpacing ([5791cf1f7b](https://github.com/facebook/react-native/commit/5791cf1f7b43aed1d98cad7bcc272d97ab659111) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize Spans 5/N: Strikethrough and Underline ([0869ea29db](https://github.com/facebook/react-native/commit/0869ea29db6a4ca20b9043d592a2233ae1a0e7a2) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize Spans 4/N: ReactForegroundColorSpan ([8c9c8ba5ad](https://github.com/facebook/react-native/commit/8c9c8ba5adb59f7f891a5307a0bce7200dd3ac7d) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize Spans 3/N: ReactBackgroundColorSpan ([cc0ba57ea4](https://github.com/facebook/react-native/commit/cc0ba57ea42d876155b2fd7d9ee78604ff8aa57a) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize Spans 1/N: Fix precedence ([1743dd7ab4](https://github.com/facebook/react-native/commit/1743dd7ab40998c4d3491e3b2c56c531daf5dc47) by [@NickGerleman](https://github.com/NickGerleman))
+- Fix measurement of uncontrolled TextInput after edit ([8a0fe30591](https://github.com/facebook/react-native/commit/8a0fe30591e21b90a3481c1ef3eeadd4b592f3ed) by [@NickGerleman](https://github.com/NickGerleman))
+
## v0.69.9
### Changed
@@ -1271,6 +1298,22 @@ Read the [announcement blogpost here](https://reactnative.dev/blog/2023/01/12/ve
- Encode URL params in URLSearchParams.toString() ([1042a8012f](https://github.com/facebook/react-native/commit/1042a8012fb472bd5c882b469fe507dd6279d562) by [@sshic](https://github.com/sshic))
+## v0.68.7
+
+### Fixed
+
+- Use logical operator instead of bit operation in Yoga ([c3ad8](https://github.com/facebook/react-native/commit/c3ad8ec7eb01b7236e0081ac7c7f888630caac21) by [@cuva](https://github.com/cuva))
+
+#### Android specific
+
+- Minimize EditText Spans 8/N: CustomStyleSpan ([b384bb613b](https://github.com/facebook/react-native/commit/b384bb613bf533aebf3271ba335c61946fcd3303) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize EditText Spans 6/N: letterSpacing ([5791cf1f7b](https://github.com/facebook/react-native/commit/5791cf1f7b43aed1d98cad7bcc272d97ab659111) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize Spans 5/N: Strikethrough and Underline ([0869ea29db](https://github.com/facebook/react-native/commit/0869ea29db6a4ca20b9043d592a2233ae1a0e7a2) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize Spans 4/N: ReactForegroundColorSpan ([8c9c8ba5ad](https://github.com/facebook/react-native/commit/8c9c8ba5adb59f7f891a5307a0bce7200dd3ac7d) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize Spans 3/N: ReactBackgroundColorSpan ([cc0ba57ea4](https://github.com/facebook/react-native/commit/cc0ba57ea42d876155b2fd7d9ee78604ff8aa57a) by [@NickGerleman](https://github.com/NickGerleman))
+- Minimize Spans 1/N: Fix precedence ([1743dd7ab4](https://github.com/facebook/react-native/commit/1743dd7ab40998c4d3491e3b2c56c531daf5dc47) by [@NickGerleman](https://github.com/NickGerleman))
+- Fix measurement of uncontrolled TextInput after edit ([8a0fe30591](https://github.com/facebook/react-native/commit/8a0fe30591e21b90a3481c1ef3eeadd4b592f3ed) by [@NickGerleman](https://github.com/NickGerleman))
+
## v0.68.6
### Fixed
diff --git a/build.gradle.kts b/build.gradle.kts
index 6899ccd139409b..1c3ebaccc359de 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -10,7 +10,7 @@ plugins {
id("com.android.library") version "7.4.2" apply false
id("com.android.application") version "7.4.2" apply false
id("de.undercouch.download") version "5.0.1" apply false
- kotlin("android") version "1.7.22" apply false
+ kotlin("android") version "1.8.0" apply false
}
val reactAndroidProperties = java.util.Properties()
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 943f0cbfa75457..c1962a79e29d3e 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 6ec1567a0f8831..a21c6ebe28b660 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 65dcd68d65c82f..aeb74cbb43e393 100755
--- a/gradlew
+++ b/gradlew
@@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -144,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +149,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
diff --git a/package.json b/package.json
index 453b96e6e64c79..004d3a8bdec9f0 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,8 @@
"outputName": "js-test-results.xml"
},
"scripts": {
- "start": "react-native start",
+ "start": "cd packages/rn-tester && npm run start",
+ "android": "cd packages/rn-tester && npm run android",
"test": "jest",
"test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"",
"flow": "flow",
@@ -57,9 +58,8 @@
"@definitelytyped/dtslint": "^0.0.127",
"@jest/create-cache-key-function": "^29.2.1",
"@react-native/metro-config": "^0.73.0",
- "@reactions/component": "^2.0.2",
"@types/react": "^18.0.18",
- "@typescript-eslint/parser": "^5.30.5",
+ "@typescript-eslint/parser": "^5.57.1",
"async": "^3.2.2",
"babel-plugin-transform-flow-enums": "^0.0.2",
"clang-format": "^1.8.0",
@@ -78,7 +78,7 @@
"eslint-plugin-react-native": "^4.0.0",
"eslint-plugin-redundant-undefined": "^0.4.0",
"eslint-plugin-relay": "^1.8.3",
- "flow-bin": "^0.204.0",
+ "flow-bin": "^0.205.1",
"hermes-eslint": "0.8.0",
"inquirer": "^7.1.0",
"jest": "^29.2.1",
@@ -94,7 +94,7 @@
"react-test-renderer": "18.2.0",
"shelljs": "^0.8.5",
"signedsource": "^1.0.0",
- "typescript": "4.1.3",
+ "typescript": "5.0.4",
"ws": "^6.2.2"
}
}
diff --git a/packages/assets/README.md b/packages/assets/README.md
new file mode 100644
index 00000000000000..407cc5b53de5fd
--- /dev/null
+++ b/packages/assets/README.md
@@ -0,0 +1,21 @@
+# @react-native/assets-registry
+
+[![Version][version-badge]][package]
+
+## Installation
+
+```
+yarn add --dev @react-native/assets-registry
+```
+
+*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like*
+
+[version-badge]: https://img.shields.io/npm/v/@react-native/assets-registry?style=flat-square
+[package]: https://www.npmjs.com/package/@react-native/assets-registry
+
+## Testing
+
+To run the tests in this package, run the following commands from the React Native root folder:
+
+1. `yarn` to install the dependencies. You just need to run this once
+2. `yarn jest packages/assets`.
diff --git a/packages/assets/package.json b/packages/assets/package.json
index 1d52c415a5b2bb..cd55b751e227b2 100644
--- a/packages/assets/package.json
+++ b/packages/assets/package.json
@@ -2,10 +2,16 @@
"name": "@react-native/assets-registry",
"version": "0.73.0",
"description": "Asset support code for React Native.",
+ "license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
+ "url": "https://github.com/facebook/react-native.git",
"directory": "packages/assets"
},
- "license": "MIT"
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/assets#readme",
+ "keywords": ["assets", "registry", "react-native", "support"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
+ }
}
diff --git a/packages/assets/path-support.js b/packages/assets/path-support.js
index a6c30d42375a55..f0a85af33ff98d 100644
--- a/packages/assets/path-support.js
+++ b/packages/assets/path-support.js
@@ -82,7 +82,7 @@ function getAndroidResourceIdentifier(asset: PackagerAsset): string {
function getBasePath(asset: PackagerAsset): string {
const basePath = asset.httpServerLocation;
- return basePath.startsWith('/') ? basePath.substr(1) : basePath;
+ return basePath.startsWith('/') ? basePath.slice(1) : basePath;
}
module.exports = {
diff --git a/packages/babel-plugin-codegen/README.md b/packages/babel-plugin-codegen/README.md
new file mode 100644
index 00000000000000..34194810ab2bf8
--- /dev/null
+++ b/packages/babel-plugin-codegen/README.md
@@ -0,0 +1,21 @@
+# @react-native/babel-plugin-codegen
+
+[![Version][version-badge]][package]
+
+## Installation
+
+```
+yarn add --dev @babel/core @react-native/babel-plugin-codegen
+```
+
+*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like*
+
+[version-badge]: https://img.shields.io/npm/v/@react-native/babel-plugin-codegen?style=flat-square
+[package]: https://www.npmjs.com/package/@react-native/babel-plugin-codegen
+
+## Testing
+
+To run the tests in this package, run the following commands from the React Native root folder:
+
+1. `yarn` to install the dependencies. You just need to run this once
+2. `yarn jest packages/babel-plugin-codegen`.
diff --git a/packages/babel-plugin-codegen/package.json b/packages/babel-plugin-codegen/package.json
index 5954d420159810..3e3edcdb4ba5c6 100644
--- a/packages/babel-plugin-codegen/package.json
+++ b/packages/babel-plugin-codegen/package.json
@@ -1,12 +1,19 @@
{
- "version": "0.73.0",
"name": "@react-native/babel-plugin-codegen",
+ "version": "0.73.0",
"description": "Babel plugin to generate native module and view manager code for React Native.",
+ "license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
+ "url": "https://github.com/facebook/react-native.git",
"directory": "packages/babel-plugin-codegen"
},
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/babel-plugin-codegen#readme",
+ "keywords": ["babel", "plugin", "codegen", "react-native", "native-modules", "view-manager"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
+ },
"files": [
"index.js"
],
@@ -15,6 +22,5 @@
},
"devDependencies": {
"@babel/core": "^7.20.0"
- },
- "license": "MIT"
+ }
}
diff --git a/packages/eslint-config-react-native-community/README.md b/packages/eslint-config-react-native/README.md
similarity index 100%
rename from packages/eslint-config-react-native-community/README.md
rename to packages/eslint-config-react-native/README.md
diff --git a/packages/eslint-config-react-native-community/index.js b/packages/eslint-config-react-native/index.js
similarity index 100%
rename from packages/eslint-config-react-native-community/index.js
rename to packages/eslint-config-react-native/index.js
diff --git a/packages/eslint-config-react-native-community/package.json b/packages/eslint-config-react-native/package.json
similarity index 68%
rename from packages/eslint-config-react-native-community/package.json
rename to packages/eslint-config-react-native/package.json
index bb97ff34d9af7f..e42373a8731684 100644
--- a/packages/eslint-config-react-native-community/package.json
+++ b/packages/eslint-config-react-native/package.json
@@ -2,20 +2,25 @@
"name": "@react-native/eslint-config",
"version": "0.73.0",
"description": "ESLint config for React Native",
- "main": "index.js",
"license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
- "directory": "packages/eslint-config-react-native-community"
+ "url": "https://github.com/facebook/react-native.git",
+ "directory": "packages/eslint-config-react-native"
+ },
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-config-react-native#readme",
+ "keywords": ["eslint", "config", "react-native"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
},
- "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-config-react-native-community#readme",
+ "main": "index.js",
"dependencies": {
"@babel/core": "^7.20.0",
"@babel/eslint-parser": "^7.19.0",
"@react-native/eslint-plugin": "^0.73.0",
- "@typescript-eslint/eslint-plugin": "^5.30.5",
- "@typescript-eslint/parser": "^5.30.5",
+ "@typescript-eslint/eslint-plugin": "^5.57.1",
+ "@typescript-eslint/parser": "^5.57.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-ft-flow": "^2.0.1",
diff --git a/packages/eslint-plugin-react-native-community/package.json b/packages/eslint-plugin-react-native-community/package.json
deleted file mode 100644
index f6b8de3cd41a8a..00000000000000
--- a/packages/eslint-plugin-react-native-community/package.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name": "@react-native/eslint-plugin",
- "version": "0.73.0",
- "description": "ESLint rules for @react-native/eslint-config",
- "main": "index.js",
- "repository": {
- "type": "git",
- "url": "git@github.com:facebook/react-native.git",
- "directory": "packages/eslint-plugin-react-native-community"
- },
- "license": "MIT"
-}
diff --git a/packages/eslint-plugin-react-native-community/README.md b/packages/eslint-plugin-react-native/README.md
similarity index 67%
rename from packages/eslint-plugin-react-native-community/README.md
rename to packages/eslint-plugin-react-native/README.md
index 1cf77b71d421f6..48fc9bcf67c1a0 100644
--- a/packages/eslint-plugin-react-native-community/README.md
+++ b/packages/eslint-plugin-react-native/README.md
@@ -1,6 +1,6 @@
# @react-native/eslint-plugin
-This plugin is intended to be used in [`@react-native/eslint-config`](https://github.com/facebook/react-native/tree/HEAD/packages/eslint-config-react-native-community). You probably want to install that package instead.
+This plugin is intended to be used in [`@react-native/eslint-config`](https://github.com/facebook/react-native/tree/HEAD/packages/eslint-config-react-native). You probably want to install that package instead.
## Installation
@@ -25,3 +25,10 @@ Add to your eslint config (`.eslintrc`, or `eslintConfig` field in `package.json
### `platform-colors`
Enforces that calls to `PlatformColor` and `DynamicColorIOS` are statically analyzable to enable performance optimizations.
+
+## Testing
+
+To run the tests in this package, run the following commands from the React Native root folder:
+
+1. `yarn` to install the dependencies. You just need to run this once
+2. `yarn jest packages/eslint-plugin-react-native`.
diff --git a/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js b/packages/eslint-plugin-react-native/__tests__/eslint-tester.js
similarity index 100%
rename from packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js
rename to packages/eslint-plugin-react-native/__tests__/eslint-tester.js
diff --git a/packages/eslint-plugin-react-native-community/__tests__/platform-colors-test.js b/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js
similarity index 100%
rename from packages/eslint-plugin-react-native-community/__tests__/platform-colors-test.js
rename to packages/eslint-plugin-react-native/__tests__/platform-colors-test.js
diff --git a/packages/eslint-plugin-react-native-community/index.js b/packages/eslint-plugin-react-native/index.js
similarity index 100%
rename from packages/eslint-plugin-react-native-community/index.js
rename to packages/eslint-plugin-react-native/index.js
diff --git a/packages/eslint-plugin-react-native/package.json b/packages/eslint-plugin-react-native/package.json
new file mode 100644
index 00000000000000..becda76cc32ffc
--- /dev/null
+++ b/packages/eslint-plugin-react-native/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "@react-native/eslint-plugin",
+ "version": "0.73.0",
+ "description": "ESLint rules for @react-native/eslint-config",
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/facebook/react-native.git",
+ "directory": "packages/eslint-plugin-react-native"
+ },
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-plugin-react-native#readme",
+ "keywords": ["eslint", "rules", "eslint-config", "react-native"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
+ },
+ "main": "index.js"
+}
diff --git a/packages/eslint-plugin-react-native-community/platform-colors.js b/packages/eslint-plugin-react-native/platform-colors.js
similarity index 100%
rename from packages/eslint-plugin-react-native-community/platform-colors.js
rename to packages/eslint-plugin-react-native/platform-colors.js
diff --git a/packages/eslint-plugin-specs/README.md b/packages/eslint-plugin-specs/README.md
new file mode 100644
index 00000000000000..824fe031ea64c1
--- /dev/null
+++ b/packages/eslint-plugin-specs/README.md
@@ -0,0 +1,21 @@
+# @react-native/eslint-plugin-specs
+
+[![Version][version-badge]][package]
+
+## Installation
+
+```
+yarn add --dev @react-native/eslint-plugin-specs
+```
+
+*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like*
+
+[version-badge]: https://img.shields.io/npm/v/@react-native/eslint-plugin-specs?style=flat-square
+[package]: https://www.npmjs.com/package/@react-native/eslint-plugin-specs
+
+## Testing
+
+To run the tests in this package, run the following commands from the React Native root folder:
+
+1. `yarn` to install the dependencies. You just need to run this once
+2. `yarn jest packages/eslint-plugin-specs`.
diff --git a/packages/eslint-plugin-specs/package.json b/packages/eslint-plugin-specs/package.json
index 4255aa43ac282c..9d523702fcae95 100644
--- a/packages/eslint-plugin-specs/package.json
+++ b/packages/eslint-plugin-specs/package.json
@@ -2,12 +2,19 @@
"name": "@react-native/eslint-plugin-specs",
"version": "0.73.0",
"description": "ESLint rules to validate NativeModule and Component Specs",
- "main": "index.js",
+ "license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
+ "url": "https://github.com/facebook/react-native.git",
"directory": "packages/eslint-plugin-specs"
},
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-plugin-specs#readme",
+ "keywords": ["eslint", "rules", "react-native", "native-modules", "components", "specs"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
+ },
+ "main": "index.js",
"scripts": {
"prepack": "node prepack.js",
"postpack": "node postpack.js"
@@ -22,6 +29,5 @@
"make-dir": "^2.1.0",
"pirates": "^4.0.1",
"source-map-support": "0.5.0"
- },
- "license": "MIT"
+ }
}
diff --git a/packages/hermes-inspector-msggen/README.md b/packages/hermes-inspector-msggen/README.md
new file mode 100644
index 00000000000000..b2b98932e32dd4
--- /dev/null
+++ b/packages/hermes-inspector-msggen/README.md
@@ -0,0 +1,21 @@
+# @react-native/hermes-inspector-msggen
+
+[![Version][version-badge]][package]
+
+## Installation
+
+```
+yarn add --dev @babel/cli @babel/core @babel/preset-env @babel/preset-flow jest @react-native/hermes-inspector-msggen
+```
+
+*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like*
+
+[version-badge]: https://img.shields.io/npm/v/@react-native/hermes-inspector-msggen?style=flat-square
+[package]: https://www.npmjs.com/package/@react-native/hermes-inspector-msggen
+
+## Testing
+
+To run the tests in this package, run the following commands from the React Native root folder:
+
+1. `yarn` to install the dependencies. You just need to run this once
+2. `yarn jest packages/hermes-inspector-msggen`.
diff --git a/packages/hermes-inspector-msggen/__tests__/CommandTest.js b/packages/hermes-inspector-msggen/__tests__/command-test.js
similarity index 100%
rename from packages/hermes-inspector-msggen/__tests__/CommandTest.js
rename to packages/hermes-inspector-msggen/__tests__/command-test.js
diff --git a/packages/hermes-inspector-msggen/__tests__/EventTest.js b/packages/hermes-inspector-msggen/__tests__/event-test.js
similarity index 100%
rename from packages/hermes-inspector-msggen/__tests__/EventTest.js
rename to packages/hermes-inspector-msggen/__tests__/event-test.js
diff --git a/packages/hermes-inspector-msggen/__tests__/GraphTest.js b/packages/hermes-inspector-msggen/__tests__/graph-test.js
similarity index 84%
rename from packages/hermes-inspector-msggen/__tests__/GraphTest.js
rename to packages/hermes-inspector-msggen/__tests__/graph-test.js
index b890c050ea8905..5d4043b80e0017 100644
--- a/packages/hermes-inspector-msggen/__tests__/GraphTest.js
+++ b/packages/hermes-inspector-msggen/__tests__/graph-test.js
@@ -25,8 +25,8 @@ beforeEach(() => {
// checks id1 occurs after id2 in arr
function expectOccursAfter(arr, id1, id2) {
- let idx1 = arr.indexOf(id1);
- let idx2 = arr.indexOf(id2);
+ const idx1 = arr.indexOf(id1);
+ const idx2 = arr.indexOf(id2);
expect(idx1).not.toBe(-1);
expect(idx2).not.toBe(-1);
@@ -35,7 +35,9 @@ function expectOccursAfter(arr, id1, id2) {
test('detects cycle', () => {
graph.addEdge('C2', 'A1');
- expect(() => graph.traverse(['A2'])).toThrow(/^Not a DAG/);
+
+ const {cycles} = graph.traverse(['A2']);
+ expect(cycles).toContainEqual({from: 'A1', to: 'B1'});
});
test('checks for presence of root', () => {
@@ -43,10 +45,10 @@ test('checks for presence of root', () => {
});
test('traverses partial graph', () => {
- let ids = graph.traverse(['B1', 'A3']);
+ const {nodes: ids} = graph.traverse(['B1', 'A3']);
// Check that expected nodes are there
- let sortedIds = ids.slice().sort();
+ const sortedIds = ids.slice().sort();
expect(sortedIds).toEqual(['A3', 'B1', 'B2', 'C1', 'C2', 'C3']);
// Check that the result is topologically sorted
@@ -59,10 +61,10 @@ test('traverses partial graph', () => {
});
test('traverses complete graph', () => {
- let ids = graph.traverse(['A1', 'A2', 'A3']);
+ const {nodes: ids} = graph.traverse(['A1', 'A2', 'A3']);
// Check that expected nodes are there
- let sortedIds = ids.slice().sort();
+ const sortedIds = ids.slice().sort();
expect(sortedIds).toEqual(['A1', 'A2', 'A3', 'B1', 'B2', 'C1', 'C2', 'C3']);
// Check that the result is topologically sorted
diff --git a/packages/hermes-inspector-msggen/__tests__/HeaderWriterTest.js b/packages/hermes-inspector-msggen/__tests__/header-writer-test.js
similarity index 95%
rename from packages/hermes-inspector-msggen/__tests__/HeaderWriterTest.js
rename to packages/hermes-inspector-msggen/__tests__/header-writer-test.js
index da8bf0c03a6b50..5ba2bb2a1158b5 100644
--- a/packages/hermes-inspector-msggen/__tests__/HeaderWriterTest.js
+++ b/packages/hermes-inspector-msggen/__tests__/header-writer-test.js
@@ -40,8 +40,12 @@ test('emits type decl', () => {
expectCodeIsEqual(stream.get(), `
struct debugger::Location : public Serializable {
Location() = default;
+ Location(Location&&) = default;
+ Location(const Location&) = delete;
explicit Location(const folly::dynamic &obj);
folly::dynamic toDynamic() const override;
+ Location& operator=(const Location&) = delete;
+ Location& operator=(Location&&) = default;
runtime::ScriptId scriptId{};
int lineNumber{};
diff --git a/packages/hermes-inspector-msggen/__tests__/ImplementationWriterTest.js b/packages/hermes-inspector-msggen/__tests__/implementation-writer-test.js
similarity index 100%
rename from packages/hermes-inspector-msggen/__tests__/ImplementationWriterTest.js
rename to packages/hermes-inspector-msggen/__tests__/implementation-writer-test.js
diff --git a/packages/hermes-inspector-msggen/__tests__/PropertyTest.js b/packages/hermes-inspector-msggen/__tests__/property-test.js
similarity index 100%
rename from packages/hermes-inspector-msggen/__tests__/PropertyTest.js
rename to packages/hermes-inspector-msggen/__tests__/property-test.js
diff --git a/packages/hermes-inspector-msggen/__tests__/TypeTest.js b/packages/hermes-inspector-msggen/__tests__/type-test.js
similarity index 100%
rename from packages/hermes-inspector-msggen/__tests__/TypeTest.js
rename to packages/hermes-inspector-msggen/__tests__/type-test.js
diff --git a/packages/hermes-inspector-msggen/package.json b/packages/hermes-inspector-msggen/package.json
index f39c077005dbfd..856d3b59607f15 100644
--- a/packages/hermes-inspector-msggen/package.json
+++ b/packages/hermes-inspector-msggen/package.json
@@ -1,11 +1,20 @@
{
"name": "@react-native/hermes-inspector-msggen",
- "private": true,
"version": "0.72.0",
+ "private": true,
+ "description": "Hermes Inspector Message Generator for React Native",
"license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/facebook/react-native.git",
+ "directory": "packages/hermes-inspector-msggen"
+ },
"bin": {
"msggen": "./bin/index.js"
},
+ "engines": {
+ "node": ">=16"
+ },
"scripts": {
"flow": "flow",
"build": "babel src --out-dir bin --source-maps",
diff --git a/packages/hermes-inspector-msggen/src/Converters.js b/packages/hermes-inspector-msggen/src/Converters.js
index 8061ef1a41aa24..aa5dbf86552cb6 100644
--- a/packages/hermes-inspector-msggen/src/Converters.js
+++ b/packages/hermes-inspector-msggen/src/Converters.js
@@ -9,11 +9,11 @@
*/
export function toCppNamespace(domain: string): string {
- return domain.substr(0, 1).toLowerCase() + domain.substr(1);
+ return domain.slice(0, 1).toLowerCase() + domain.slice(1);
}
export function toCppType(type: string): string {
- return type.substr(0, 1).toUpperCase() + type.substr(1);
+ return type.slice(0, 1).toUpperCase() + type.slice(1);
}
export type JsTypeString =
diff --git a/packages/hermes-inspector-msggen/src/Property.js b/packages/hermes-inspector-msggen/src/Property.js
index d50df01f50327f..fdad9bc6f7b306 100644
--- a/packages/hermes-inspector-msggen/src/Property.js
+++ b/packages/hermes-inspector-msggen/src/Property.js
@@ -114,8 +114,8 @@ function toDomainAndId(
domain = curDomain;
id = absOrRelRef;
} else {
- domain = absOrRelRef.substr(0, i);
- id = absOrRelRef.substr(i + 1);
+ domain = absOrRelRef.slice(0, i);
+ id = absOrRelRef.slice(i + 1);
}
return [domain, id];
diff --git a/packages/metro-config/README.md b/packages/metro-config/README.md
new file mode 100644
index 00000000000000..903a3b3a76d3df
--- /dev/null
+++ b/packages/metro-config/README.md
@@ -0,0 +1,21 @@
+# @react-native/metro-config
+
+[![Version][version-badge]][package]
+
+## Installation
+
+```
+yarn add --dev @react-native/js-polyfills metro-config metro-react-native-babel-transformer metro-runtime @react-native/metro-config
+```
+
+*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like*
+
+[version-badge]: https://img.shields.io/npm/v/@react-native/metro-config?style=flat-square
+[package]: https://www.npmjs.com/package/@react-native/metro-config
+
+## Testing
+
+To run the tests in this package, run the following commands from the React Native root folder:
+
+1. `yarn` to install the dependencies. You just need to run this once
+2. `yarn jest packages/metro-config`.
diff --git a/packages/metro-config/package.json b/packages/metro-config/package.json
index c95528acb9289c..e86d78e60321ab 100644
--- a/packages/metro-config/package.json
+++ b/packages/metro-config/package.json
@@ -2,12 +2,18 @@
"name": "@react-native/metro-config",
"version": "0.73.0",
"description": "Metro configuration for React Native.",
+ "license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
+ "url": "https://github.com/facebook/react-native.git",
"directory": "packages/metro-config"
},
- "license": "MIT",
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/metro-config#readme",
+ "keywords": ["metro", "config", "react-native"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
+ },
"exports": "./index.js",
"dependencies": {
"@react-native/js-polyfills": "^0.73.0",
diff --git a/packages/normalize-color/README.md b/packages/normalize-color/README.md
new file mode 100644
index 00000000000000..20b618d930a592
--- /dev/null
+++ b/packages/normalize-color/README.md
@@ -0,0 +1,21 @@
+# @react-native/normalize-colors
+
+[![Version][version-badge]][package]
+
+## Installation
+
+```
+yarn add --dev @react-native/normalize-colors
+```
+
+*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like*
+
+[version-badge]: https://img.shields.io/npm/v/@react-native/normalize-colors?style=flat-square
+[package]: https://www.npmjs.com/package/@react-native/normalize-colors
+
+## Testing
+
+To run the tests in this package, run the following commands from the React Native root folder:
+
+1. `yarn` to install the dependencies. You just need to run this once
+2. `yarn jest packages/normalize-color`.
diff --git a/packages/normalize-color/package.json b/packages/normalize-color/package.json
index 71c6740121a691..079c3fe4dabea3 100644
--- a/packages/normalize-color/package.json
+++ b/packages/normalize-color/package.json
@@ -2,10 +2,16 @@
"name": "@react-native/normalize-colors",
"version": "0.73.0",
"description": "Color normalization for React Native.",
+ "license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
+ "url": "https://github.com/facebook/react-native.git",
"directory": "packages/normalize-color"
},
- "license": "MIT"
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/normalize-color#readme",
+ "keywords": ["color", "normalization", "normalize-colors", "react-native"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
+ }
}
diff --git a/packages/polyfills/README.md b/packages/polyfills/README.md
new file mode 100644
index 00000000000000..91f0b04de013bc
--- /dev/null
+++ b/packages/polyfills/README.md
@@ -0,0 +1,21 @@
+# @react-native/js-polyfills
+
+[![Version][version-badge]][package]
+
+## Installation
+
+```
+yarn add @react-native/js-polyfills
+```
+
+*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like*
+
+[version-badge]: https://img.shields.io/npm/v/@react-native/js-polyfills?style=flat-square
+[package]: https://www.npmjs.com/package/@react-native/js-polyfills
+
+## Testing
+
+To run the tests in this package, run the following commands from the React Native root folder:
+
+1. `yarn` to install the dependencies. You just need to run this once
+2. `yarn jest packages/polyfills`.
diff --git a/packages/polyfills/console.js b/packages/polyfills/console.js
index e843f4f74caa3c..338e1590cb3bc7 100644
--- a/packages/polyfills/console.js
+++ b/packages/polyfills/console.js
@@ -252,7 +252,7 @@ const inspect = (function () {
return ' ' + line;
})
.join('\n')
- .substr(2);
+ .slice(2);
} else {
str =
'\n' +
@@ -274,7 +274,7 @@ const inspect = (function () {
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
- name = name.substr(1, name.length - 2);
+ name = name.slice(1, name.length - 1);
name = ctx.stylize(name, 'name');
} else {
name = name
diff --git a/packages/polyfills/package.json b/packages/polyfills/package.json
index 1694345b4b2b7e..de11f640d1be8f 100644
--- a/packages/polyfills/package.json
+++ b/packages/polyfills/package.json
@@ -2,10 +2,16 @@
"name": "@react-native/js-polyfills",
"version": "0.73.0",
"description": "Polyfills for React Native.",
+ "license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
+ "url": "https://github.com/facebook/react-native.git",
"directory": "packages/polyfills"
},
- "license": "MIT"
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/polyfills#readme",
+ "keywords": ["polyfill", "polyfills", "js", "js-polyfills", "react-native"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
+ }
}
diff --git a/packages/react-native-bots/dangerfile.js b/packages/react-native-bots/dangerfile.js
index c14203e4c458d4..0a14b4d0fc2bb0 100644
--- a/packages/react-native-bots/dangerfile.js
+++ b/packages/react-native-bots/dangerfile.js
@@ -60,19 +60,21 @@ if (!includesTestPlan && !isFromPhabricator) {
}
// Check if there is a changelog and validate it
-const status = validateChangelog(danger.github.pr.body);
-const changelogInstructions =
- 'See Changelog format';
-if (status === 'missing') {
- // Provides advice if a changelog is missing
- const title = ':clipboard: Missing Changelog';
- const idea =
- 'Please add a Changelog to your PR description. ' + changelogInstructions;
- fail(`${title} - ${idea}`);
-} else if (status === 'invalid') {
- const title = ':clipboard: Verify Changelog Format';
- const idea = changelogInstructions;
- fail(`${title} - ${idea}`);
+if (!isFromPhabricator) {
+ const status = validateChangelog(danger.github.pr.body);
+ const changelogInstructions =
+ 'See Changelog format';
+ if (status === 'missing') {
+ // Provides advice if a changelog is missing
+ const title = ':clipboard: Missing Changelog';
+ const idea =
+ 'Please add a Changelog to your PR description. ' + changelogInstructions;
+ fail(`${title} - ${idea}`);
+ } else if (status === 'invalid') {
+ const title = ':clipboard: Verify Changelog Format';
+ const idea = changelogInstructions;
+ fail(`${title} - ${idea}`);
+ }
}
// Warns if the PR is opened against stable, as commits need to be cherry picked and tagged by a release maintainer.
diff --git a/packages/react-native-bots/package.json b/packages/react-native-bots/package.json
index ff5485e29f2aad..5a86115c8a9696 100644
--- a/packages/react-native-bots/package.json
+++ b/packages/react-native-bots/package.json
@@ -1,7 +1,18 @@
{
"name": "@react-native/bots",
+ "description": "React Native Bots",
"version": "0.0.0",
"private": true,
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/facebook/react-native.git",
+ "directory": "packages/react-native-bots"
+ },
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-bots#readme",
+ "engines": {
+ "node": ">=16"
+ },
"devDependencies": {
"@rnx-kit/rn-changelog-generator": "^0.4.0",
"@seadub/danger-plugin-eslint": "^3.0.2",
diff --git a/packages/react-native-codegen-typescript-test/package.json b/packages/react-native-codegen-typescript-test/package.json
index 7966c5e443a761..dcc795f149d481 100644
--- a/packages/react-native-codegen-typescript-test/package.json
+++ b/packages/react-native-codegen-typescript-test/package.json
@@ -1,19 +1,22 @@
{
"name": "@react-native/codegen-typescript-test",
"version": "0.0.1",
- "description": "⚛️ TypeScript related unit test for @react-native/codegen",
- "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-typescript-test",
+ "description": "TypeScript related unit test for @react-native/codegen",
+ "license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
+ "url": "https://github.com/facebook/react-native.git",
"directory": "packages/react-native-codegen-typescript-test"
},
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-typescript-test",
+ "engines": {
+ "node": ">=16"
+ },
"scripts": {
"build": "yarn clean && node scripts/build.js --verbose && tsc",
"clean": "rimraf lib && rimraf __generated__/*.ts",
"prepare": "yarn run build"
},
- "license": "MIT",
"dependencies": {
"@react-native/codegen": "*"
},
diff --git a/packages/react-native-codegen/README.md b/packages/react-native-codegen/README.md
index 2380d87f716a3a..8f6856b1c8f073 100644
--- a/packages/react-native-codegen/README.md
+++ b/packages/react-native-codegen/README.md
@@ -15,7 +15,7 @@ yarn add --dev @react-native/codegen
## Testing
-To run the tests in this package, run the following commands from the react Native root folder:
+To run the tests in this package, run the following commands from the React Native root folder:
1. `yarn` to install the dependencies. You just need to run this once
-2. `yarn jest react-native-codegen`.
+2. `yarn jest packages/react-native-codegen`.
diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateEventEmitterH-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateEventEmitterH-test.js.snap
index 876d46a03a124e..57f16617fe96be 100644
--- a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateEventEmitterH-test.js.snap
+++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateEventEmitterH-test.js.snap
@@ -14,12 +14,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ArrayPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
+class ArrayPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -46,12 +45,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT BooleanPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class BooleanPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -78,12 +76,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ColorPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class ColorPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -110,12 +107,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT DimensionPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class DimensionPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -142,12 +138,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT EdgeInsetsPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class EdgeInsetsPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -174,12 +169,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT EnumPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class EnumPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -206,12 +200,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT EventNestedObjectPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
+class EventNestedObjectPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -250,12 +243,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT EventPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
+class EventPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -329,12 +321,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT FloatPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
+class FloatPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -361,12 +352,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ImagePropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class ImagePropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -393,12 +383,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT IntegerPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class IntegerPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -425,12 +414,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT InterfaceOnlyNativeComponentViewEventEmitter : public ViewEventEmitter {
+class InterfaceOnlyNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -459,12 +447,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT MixedPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class MixedPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -491,12 +478,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT MultiNativePropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class MultiNativePropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -523,12 +509,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT NoPropsNoEventsNativeComponentViewEventEmitter : public ViewEventEmitter {
+class NoPropsNoEventsNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -555,12 +540,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ObjectPropsNativeComponentEventEmitter : public ViewEventEmitter {
+class ObjectPropsNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -587,12 +571,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT PointPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class PointPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -619,12 +602,11 @@ Object {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT StringPropNativeComponentViewEventEmitter : public ViewEventEmitter {
+class StringPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap
index ebc4cd23016df7..6bbef39bf4fb9c 100644
--- a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap
+++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap
@@ -14,7 +14,6 @@ Object {
#pragma once
#include
-#include
#include
#include
#include
@@ -141,7 +140,7 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
}
}
-class JSI_EXPORT ArrayPropsNativeComponentViewProps final : public ViewProps {
+class ArrayPropsNativeComponentViewProps final : public ViewProps {
public:
ArrayPropsNativeComponentViewProps() = default;
ArrayPropsNativeComponentViewProps(const PropsParserContext& context, const ArrayPropsNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -181,14 +180,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT BooleanPropNativeComponentViewProps final : public ViewProps {
+class BooleanPropNativeComponentViewProps final : public ViewProps {
public:
BooleanPropNativeComponentViewProps() = default;
BooleanPropNativeComponentViewProps(const PropsParserContext& context, const BooleanPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -218,7 +216,6 @@ Object {
*/
#pragma once
-#include
#include
#include
#include
@@ -226,7 +223,7 @@ Object {
namespace facebook {
namespace react {
-class JSI_EXPORT ColorPropNativeComponentViewProps final : public ViewProps {
+class ColorPropNativeComponentViewProps final : public ViewProps {
public:
ColorPropNativeComponentViewProps() = default;
ColorPropNativeComponentViewProps(const PropsParserContext& context, const ColorPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -255,7 +252,6 @@ Object {
*/
#pragma once
-#include
#include
#include
#include
@@ -263,7 +259,7 @@ Object {
namespace facebook {
namespace react {
-class JSI_EXPORT DimensionPropNativeComponentViewProps final : public ViewProps {
+class DimensionPropNativeComponentViewProps final : public ViewProps {
public:
DimensionPropNativeComponentViewProps() = default;
DimensionPropNativeComponentViewProps(const PropsParserContext& context, const DimensionPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -292,14 +288,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT EdgeInsetsPropNativeComponentViewProps final : public ViewProps {
+class EdgeInsetsPropNativeComponentViewProps final : public ViewProps {
public:
EdgeInsetsPropNativeComponentViewProps() = default;
EdgeInsetsPropNativeComponentViewProps(const PropsParserContext& context, const EdgeInsetsPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -328,7 +323,6 @@ Object {
*/
#pragma once
-#include
#include
#include
@@ -383,7 +377,7 @@ static inline std::string toString(const EnumPropNativeComponentViewIntervals &v
}
}
-class JSI_EXPORT EnumPropNativeComponentViewProps final : public ViewProps {
+class EnumPropNativeComponentViewProps final : public ViewProps {
public:
EnumPropNativeComponentViewProps() = default;
EnumPropNativeComponentViewProps(const PropsParserContext& context, const EnumPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -413,14 +407,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT EventNestedObjectPropsNativeComponentViewProps final : public ViewProps {
+class EventNestedObjectPropsNativeComponentViewProps final : public ViewProps {
public:
EventNestedObjectPropsNativeComponentViewProps() = default;
EventNestedObjectPropsNativeComponentViewProps(const PropsParserContext& context, const EventNestedObjectPropsNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -449,14 +442,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT EventPropsNativeComponentViewProps final : public ViewProps {
+class EventPropsNativeComponentViewProps final : public ViewProps {
public:
EventPropsNativeComponentViewProps() = default;
EventPropsNativeComponentViewProps(const PropsParserContext& context, const EventPropsNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -485,14 +477,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT FloatPropsNativeComponentViewProps final : public ViewProps {
+class FloatPropsNativeComponentViewProps final : public ViewProps {
public:
FloatPropsNativeComponentViewProps() = default;
FloatPropsNativeComponentViewProps(const PropsParserContext& context, const FloatPropsNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -527,7 +518,6 @@ Object {
*/
#pragma once
-#include
#include
#include
#include
@@ -535,7 +525,7 @@ Object {
namespace facebook {
namespace react {
-class JSI_EXPORT ImagePropNativeComponentViewProps final : public ViewProps {
+class ImagePropNativeComponentViewProps final : public ViewProps {
public:
ImagePropNativeComponentViewProps() = default;
ImagePropNativeComponentViewProps(const PropsParserContext& context, const ImagePropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -564,14 +554,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT IntegerPropNativeComponentViewProps final : public ViewProps {
+class IntegerPropNativeComponentViewProps final : public ViewProps {
public:
IntegerPropNativeComponentViewProps() = default;
IntegerPropNativeComponentViewProps(const PropsParserContext& context, const IntegerPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -602,14 +591,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT InterfaceOnlyNativeComponentViewProps final : public ViewProps {
+class InterfaceOnlyNativeComponentViewProps final : public ViewProps {
public:
InterfaceOnlyNativeComponentViewProps() = default;
InterfaceOnlyNativeComponentViewProps(const PropsParserContext& context, const InterfaceOnlyNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -638,14 +626,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT MixedPropNativeComponentViewProps final : public ViewProps {
+class MixedPropNativeComponentViewProps final : public ViewProps {
public:
MixedPropNativeComponentViewProps() = default;
MixedPropNativeComponentViewProps(const PropsParserContext& context, const MixedPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -674,7 +661,6 @@ Object {
*/
#pragma once
-#include
#include
#include
#include
@@ -684,7 +670,7 @@ Object {
namespace facebook {
namespace react {
-class JSI_EXPORT MultiNativePropNativeComponentViewProps final : public ViewProps {
+class MultiNativePropNativeComponentViewProps final : public ViewProps {
public:
MultiNativePropNativeComponentViewProps() = default;
MultiNativePropNativeComponentViewProps(const PropsParserContext& context, const MultiNativePropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -716,14 +702,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT NoPropsNoEventsNativeComponentViewProps final : public ViewProps {
+class NoPropsNoEventsNativeComponentViewProps final : public ViewProps {
public:
NoPropsNoEventsNativeComponentViewProps() = default;
NoPropsNoEventsNativeComponentViewProps(const PropsParserContext& context, const NoPropsNoEventsNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -752,7 +737,6 @@ Object {
*/
#pragma once
-#include
#include
#include
#include
@@ -887,7 +871,7 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
static inline std::string toString(const ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &value) {
return \\"[Object ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct]\\";
}
-class JSI_EXPORT ObjectPropsNativeComponentProps final : public ViewProps {
+class ObjectPropsNativeComponentProps final : public ViewProps {
public:
ObjectPropsNativeComponentProps() = default;
ObjectPropsNativeComponentProps(const PropsParserContext& context, const ObjectPropsNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -918,7 +902,6 @@ Object {
*/
#pragma once
-#include
#include
#include
#include
@@ -926,7 +909,7 @@ Object {
namespace facebook {
namespace react {
-class JSI_EXPORT PointPropNativeComponentViewProps final : public ViewProps {
+class PointPropNativeComponentViewProps final : public ViewProps {
public:
PointPropNativeComponentViewProps() = default;
PointPropNativeComponentViewProps(const PropsParserContext& context, const PointPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
@@ -955,14 +938,13 @@ Object {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT StringPropNativeComponentViewProps final : public ViewProps {
+class StringPropNativeComponentViewProps final : public ViewProps {
public:
StringPropNativeComponentViewProps() = default;
StringPropNativeComponentViewProps(const PropsParserContext& context, const StringPropNativeComponentViewProps &sourceProps, const RawProps &rawProps);
diff --git a/packages/react-native-codegen/package.json b/packages/react-native-codegen/package.json
index d2eeade5d933ab..57412c383f5f88 100644
--- a/packages/react-native-codegen/package.json
+++ b/packages/react-native-codegen/package.json
@@ -1,19 +1,24 @@
{
"name": "@react-native/codegen",
"version": "0.73.0",
- "description": "⚛️ Code generation tools for React Native",
- "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-codegen",
+ "description": "Code generation tools for React Native",
+ "license": "MIT",
"repository": {
"type": "git",
- "url": "git@github.com:facebook/react-native.git",
+ "url": "https://github.com/facebook/react-native.git",
"directory": "packages/react-native-codegen"
},
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-codegen#readme",
+ "keywords": ["code", "generation", "codegen", "tools", "react-native"],
+ "bugs": "https://github.com/facebook/react-native/issues",
+ "engines": {
+ "node": ">=16"
+ },
"scripts": {
"build": "yarn clean && node scripts/build.js --verbose",
"clean": "rimraf lib",
"prepare": "yarn run build"
},
- "license": "MIT",
"files": [
"lib"
],
diff --git a/packages/react-native-codegen/src/CodegenSchema.d.ts b/packages/react-native-codegen/src/CodegenSchema.d.ts
index 78db904aa4c404..3482172d99009f 100644
--- a/packages/react-native-codegen/src/CodegenSchema.d.ts
+++ b/packages/react-native-codegen/src/CodegenSchema.d.ts
@@ -113,7 +113,11 @@ export type EventTypeAnnotation =
| FloatTypeAnnotation
| Int32TypeAnnotation
| StringEnumTypeAnnotation
- | ObjectTypeAnnotation;
+ | ObjectTypeAnnotation
+ | {
+ readonly type: 'ArrayTypeAnnotation';
+ readonly elementType: EventTypeAnnotation
+ };
export type PropTypeAnnotation =
| {
@@ -291,6 +295,7 @@ export interface NativeModuleEnumDeclarationWithMembers {
export interface NativeModuleGenericObjectTypeAnnotation {
readonly type: 'GenericObjectTypeAnnotation';
+ readonly dictionaryValueType?: Nullable | undefined;
}
export interface NativeModuleTypeAliasTypeAnnotation {
@@ -352,4 +357,3 @@ export type NativeModuleReturnOnlyTypeAnnotation =
| NativeModuleFunctionTypeAnnotation
| NativeModulePromiseTypeAnnotation
| VoidTypeAnnotation;
-
diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js
index 361d54ef75c596..f05a4f2e749ab3 100644
--- a/packages/react-native-codegen/src/CodegenSchema.js
+++ b/packages/react-native-codegen/src/CodegenSchema.js
@@ -128,7 +128,11 @@ export type EventTypeAnnotation =
| Int32TypeAnnotation
| MixedTypeAnnotation
| StringEnumTypeAnnotation
- | ObjectTypeAnnotation;
+ | ObjectTypeAnnotation
+ | $ReadOnly<{
+ type: 'ArrayTypeAnnotation',
+ elementType: EventTypeAnnotation,
+ }>;
export type PropTypeAnnotation =
| $ReadOnly<{
@@ -324,6 +328,11 @@ export type NativeModuleEnumDeclarationWithMembers = {
export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{
type: 'GenericObjectTypeAnnotation',
+
+ // a dictionary type is codegen as "Object"
+ // but we know all its members are in the same type
+ // when it happens, the following field is non-null
+ dictionaryValueType?: Nullable,
}>;
export type NativeModuleTypeAliasTypeAnnotation = $ReadOnly<{
diff --git a/packages/react-native-codegen/src/generators/components/CppHelpers.js b/packages/react-native-codegen/src/generators/components/CppHelpers.js
index e1fbfb79dc1d7b..ccecb1bcd08073 100644
--- a/packages/react-native-codegen/src/generators/components/CppHelpers.js
+++ b/packages/react-native-codegen/src/generators/components/CppHelpers.js
@@ -49,6 +49,42 @@ function getCppTypeForAnnotation(
}
}
+function getCppArrayTypeForAnnotation(
+ typeElement: EventTypeAnnotation,
+ structParts?: string[],
+): string {
+ switch (typeElement.type) {
+ case 'BooleanTypeAnnotation':
+ case 'StringTypeAnnotation':
+ case 'DoubleTypeAnnotation':
+ case 'FloatTypeAnnotation':
+ case 'Int32TypeAnnotation':
+ case 'MixedTypeAnnotation':
+ return `std::vector<${getCppTypeForAnnotation(typeElement.type)}>`;
+ case 'StringEnumTypeAnnotation':
+ case 'ObjectTypeAnnotation':
+ if (!structParts) {
+ throw new Error(
+ `Trying to generate the event emitter for an Array of ${typeElement.type} without informations to generate the generic type`,
+ );
+ }
+ return `std::vector<${generateEventStructName(structParts)}>`;
+ case 'ArrayTypeAnnotation':
+ return `std::vector<${getCppArrayTypeForAnnotation(
+ typeElement.elementType,
+ structParts,
+ )}>`;
+ default:
+ throw new Error(
+ `Can't determine array type with typeElement: ${JSON.stringify(
+ typeElement,
+ null,
+ 2,
+ )}`,
+ );
+ }
+}
+
function getImports(
properties:
| $ReadOnlyArray>
@@ -222,6 +258,7 @@ function convertDefaultTypeToString(
module.exports = {
convertDefaultTypeToString,
+ getCppArrayTypeForAnnotation,
getCppTypeForAnnotation,
getEnumMaskName,
getImports,
diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js
index ff478d78feae4b..7a43aea0a2b54e 100644
--- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js
+++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js
@@ -102,9 +102,12 @@ function generateSetter(
variableName: string,
propertyName: string,
propertyParts: $ReadOnlyArray,
+ usingEvent: boolean,
valueMapper: string => string = value => value,
) {
- const eventChain = `$event.${[...propertyParts, propertyName].join('.')}`;
+ const eventChain = usingEvent
+ ? `$event.${[...propertyParts, propertyName].join('.')}`
+ : [propertyParts, propertyName].join('.');
return `${variableName}.setProperty(runtime, "${propertyName}", ${valueMapper(
eventChain,
)});`;
@@ -116,6 +119,7 @@ function generateObjectSetter(
propertyParts: $ReadOnlyArray,
typeAnnotation: ObjectTypeAnnotation,
extraIncludes: Set,
+ usingEvent: boolean,
) {
return `
{
@@ -126,6 +130,7 @@ function generateObjectSetter(
typeAnnotation.properties,
propertyParts.concat([propertyName]),
extraIncludes,
+ usingEvent,
),
2,
)}
@@ -134,11 +139,165 @@ function generateObjectSetter(
`.trim();
}
+function setValueAtIndex(
+ propertyName: string,
+ indexVariable: string,
+ loopLocalVariable: string,
+ mappingFunction: string => string = value => value,
+) {
+ return `${propertyName}.setValueAtIndex(runtime, ${indexVariable}++, ${mappingFunction(
+ loopLocalVariable,
+ )});`;
+}
+
+function generateArraySetter(
+ variableName: string,
+ propertyName: string,
+ propertyParts: $ReadOnlyArray,
+ elementType: EventTypeAnnotation,
+ extraIncludes: Set,
+ usingEvent: boolean,
+): string {
+ const eventChain = usingEvent
+ ? `$event.${[...propertyParts, propertyName].join('.')}`
+ : [propertyParts, propertyName].join('.');
+ const indexVar = `${propertyName}Index`;
+ const innerLoopVar = `${propertyName}Value`;
+ return `
+ auto ${propertyName} = jsi::Array(runtime, ${eventChain}.size());
+ size_t ${indexVar} = 0;
+ for (auto ${innerLoopVar} : ${eventChain}) {
+ ${handleArrayElementType(
+ elementType,
+ propertyName,
+ indexVar,
+ innerLoopVar,
+ propertyParts,
+ extraIncludes,
+ usingEvent,
+ )}
+ }
+ ${variableName}.setProperty(runtime, "${propertyName}", ${propertyName});
+ `;
+}
+
+function handleArrayElementType(
+ elementType: EventTypeAnnotation,
+ propertyName: string,
+ indexVariable: string,
+ loopLocalVariable: string,
+ propertyParts: $ReadOnlyArray,
+ extraIncludes: Set,
+ usingEvent: boolean,
+): string {
+ switch (elementType.type) {
+ case 'BooleanTypeAnnotation':
+ return setValueAtIndex(
+ propertyName,
+ indexVariable,
+ loopLocalVariable,
+ val => `(bool)${val}`,
+ );
+ case 'StringTypeAnnotation':
+ case 'Int32TypeAnnotation':
+ case 'DoubleTypeAnnotation':
+ case 'FloatTypeAnnotation':
+ return setValueAtIndex(propertyName, indexVariable, loopLocalVariable);
+ case 'MixedTypeAnnotation':
+ return setValueAtIndex(
+ propertyName,
+ indexVariable,
+ loopLocalVariable,
+ val => `jsi::valueFromDynamic(runtime, ${val})`,
+ );
+ case 'StringEnumTypeAnnotation':
+ return setValueAtIndex(
+ propertyName,
+ indexVariable,
+ loopLocalVariable,
+ val => `toString(${val})`,
+ );
+ case 'ObjectTypeAnnotation':
+ return convertObjectTypeArray(
+ propertyName,
+ indexVariable,
+ loopLocalVariable,
+ propertyParts,
+ elementType,
+ extraIncludes,
+ );
+ case 'ArrayTypeAnnotation':
+ return convertArrayTypeArray(
+ propertyName,
+ indexVariable,
+ loopLocalVariable,
+ propertyParts,
+ elementType,
+ extraIncludes,
+ usingEvent,
+ );
+ default:
+ throw new Error(
+ `Received invalid elementType for array ${elementType.type}`,
+ );
+ }
+}
+
+function convertObjectTypeArray(
+ propertyName: string,
+ indexVariable: string,
+ loopLocalVariable: string,
+ propertyParts: $ReadOnlyArray,
+ objectTypeAnnotation: ObjectTypeAnnotation,
+ extraIncludes: Set,
+): string {
+ return `auto ${propertyName}Object = jsi::Object(runtime);
+ ${generateSetters(
+ `${propertyName}Object`,
+ objectTypeAnnotation.properties,
+ [].concat([loopLocalVariable]),
+ extraIncludes,
+ false,
+ )}
+ ${setValueAtIndex(propertyName, indexVariable, `${propertyName}Object`)}`;
+}
+
+function convertArrayTypeArray(
+ propertyName: string,
+ indexVariable: string,
+ loopLocalVariable: string,
+ propertyParts: $ReadOnlyArray,
+ eventTypeAnnotation: EventTypeAnnotation,
+ extraIncludes: Set,
+ usingEvent: boolean,
+): string {
+ if (eventTypeAnnotation.type !== 'ArrayTypeAnnotation') {
+ throw new Error(
+ `Inconsistent eventTypeAnnotation received. Expected type = 'ArrayTypeAnnotation'; received = ${eventTypeAnnotation.type}`,
+ );
+ }
+ return `auto ${propertyName}Array = jsi::Array(runtime, ${loopLocalVariable}.size());
+ size_t ${indexVariable}Internal = 0;
+ for (auto ${loopLocalVariable}Internal : ${loopLocalVariable}) {
+ ${handleArrayElementType(
+ eventTypeAnnotation.elementType,
+ `${propertyName}Array`,
+ `${indexVariable}Internal`,
+ `${loopLocalVariable}Internal`,
+ propertyParts,
+ extraIncludes,
+ usingEvent,
+ )}
+ }
+ ${setValueAtIndex(propertyName, indexVariable, `${propertyName}Array`)}`;
+}
+
function generateSetters(
parentPropertyName: string,
properties: $ReadOnlyArray>,
propertyParts: $ReadOnlyArray,
extraIncludes: Set,
+ usingEvent: boolean = true,
): string {
const propSetters = properties
.map(eventProperty => {
@@ -153,6 +312,7 @@ function generateSetters(
parentPropertyName,
eventProperty.name,
propertyParts,
+ usingEvent,
);
case 'MixedTypeAnnotation':
extraIncludes.add('#include ');
@@ -160,6 +320,7 @@ function generateSetters(
parentPropertyName,
eventProperty.name,
propertyParts,
+ usingEvent,
prop => `jsi::valueFromDynamic(runtime, ${prop})`,
);
case 'StringEnumTypeAnnotation':
@@ -167,6 +328,7 @@ function generateSetters(
parentPropertyName,
eventProperty.name,
propertyParts,
+ usingEvent,
prop => `toString(${prop})`,
);
case 'ObjectTypeAnnotation':
@@ -176,6 +338,16 @@ function generateSetters(
propertyParts,
typeAnnotation,
extraIncludes,
+ usingEvent,
+ );
+ case 'ArrayTypeAnnotation':
+ return generateArraySetter(
+ parentPropertyName,
+ eventProperty.name,
+ propertyParts,
+ typeAnnotation.elementType,
+ extraIncludes,
+ usingEvent,
);
default:
(typeAnnotation.type: empty);
diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js
index fcb082d74b8c9b..b5d55033f063b4 100644
--- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js
+++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js
@@ -14,6 +14,7 @@ const nullthrows = require('nullthrows');
const {
getImports,
+ getCppArrayTypeForAnnotation,
getCppTypeForAnnotation,
generateEventStructName,
} = require('./CppHelpers');
@@ -54,7 +55,6 @@ const FileTemplate = ({
#pragma once
#include
-#include
${[...extraIncludes].join('\n')}
namespace facebook {
@@ -74,7 +74,7 @@ const ComponentTemplate = ({
events: string,
}) =>
`
-class JSI_EXPORT ${className}EventEmitter : public ViewEventEmitter {
+class ${className}EventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -134,6 +134,17 @@ function getNativeTypeFromAnnotation(
case 'StringEnumTypeAnnotation':
case 'ObjectTypeAnnotation':
return generateEventStructName([...nameParts, eventProperty.name]);
+ case 'ArrayTypeAnnotation':
+ const eventTypeAnnotation = eventProperty.typeAnnotation;
+ if (eventTypeAnnotation.type !== 'ArrayTypeAnnotation') {
+ throw new Error(
+ "Inconsistent Codegen state: type was ArrayTypeAnnotation at the beginning of the body and now it isn't",
+ );
+ }
+ return getCppArrayTypeForAnnotation(eventTypeAnnotation.elementType, [
+ ...nameParts,
+ eventProperty.name,
+ ]);
default:
(type: empty);
throw new Error(`Received invalid event property type ${type}`);
@@ -166,6 +177,33 @@ function generateEnum(
);
}
+function handleGenerateStructForArray(
+ structs: StructsMap,
+ name: string,
+ componentName: string,
+ elementType: EventTypeAnnotation,
+ nameParts: $ReadOnlyArray,
+): void {
+ if (elementType.type === 'ObjectTypeAnnotation') {
+ generateStruct(
+ structs,
+ componentName,
+ nameParts.concat([name]),
+ nullthrows(elementType.properties),
+ );
+ } else if (elementType.type === 'StringEnumTypeAnnotation') {
+ generateEnum(structs, elementType.options, nameParts.concat([name]));
+ } else if (elementType.type === 'ArrayTypeAnnotation') {
+ handleGenerateStructForArray(
+ structs,
+ name,
+ componentName,
+ elementType.elementType,
+ nameParts,
+ );
+ }
+}
+
function generateStruct(
structs: StructsMap,
componentName: string,
@@ -195,6 +233,15 @@ function generateStruct(
case 'FloatTypeAnnotation':
case 'MixedTypeAnnotation':
return;
+ case 'ArrayTypeAnnotation':
+ handleGenerateStructForArray(
+ structs,
+ name,
+ componentName,
+ typeAnnotation.elementType,
+ nameParts,
+ );
+ return;
case 'ObjectTypeAnnotation':
generateStruct(
structs,
@@ -272,7 +319,7 @@ module.exports = {
.map(moduleName => {
const module = schema.modules[moduleName];
if (module.type !== 'Component') {
- return;
+ return null;
}
const {components} = module;
diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js
index 684153b23b5ea5..b8d4f91d550804 100644
--- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js
+++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js
@@ -80,7 +80,7 @@ const ClassTemplate = ({
`
${enums}
${structs}
-class JSI_EXPORT ${className} final${extendClasses} {
+class ${className} final${extendClasses} {
public:
${className}() = default;
${className}(const PropsParserContext& context, const ${className} &sourceProps, const RawProps &rawProps);
@@ -478,7 +478,6 @@ function getExtendsImports(
const imports: Set = new Set();
imports.add('#include ');
- imports.add('#include ');
extendsProps.forEach(extendProps => {
switch (extendProps.type) {
diff --git a/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js
index e5401bb4e7146c..65f7a46d25ba2c 100644
--- a/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js
+++ b/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js
@@ -1206,6 +1206,99 @@ const EVENT_PROPS: SchemaType = {
},
},
},
+ {
+ name: 'onArrayEventType',
+ optional: true,
+ bubblingType: 'bubble',
+ typeAnnotation: {
+ type: 'EventTypeAnnotation',
+ argument: {
+ type: 'ObjectTypeAnnotation',
+ properties: [
+ {
+ name: 'bool_array_event_prop',
+ optional: false,
+ typeAnnotation: {
+ type: 'ArrayTypeAnnotation',
+ elementType: {
+ type: 'BooleanTypeAnnotation',
+ },
+ },
+ },
+ {
+ name: 'string_enum_event_prop',
+ optional: false,
+ typeAnnotation: {
+ type: 'ArrayTypeAnnotation',
+ elementType: {
+ type: 'StringEnumTypeAnnotation',
+ options: ['YES', 'NO'],
+ },
+ },
+ },
+ {
+ name: 'array_array_event_prop',
+ optional: false,
+ typeAnnotation: {
+ type: 'ArrayTypeAnnotation',
+ elementType: {
+ type: 'ArrayTypeAnnotation',
+ elementType: {
+ type: 'StringTypeAnnotation',
+ },
+ },
+ },
+ },
+ {
+ name: 'array_object_event_prop',
+ optional: false,
+ typeAnnotation: {
+ type: 'ArrayTypeAnnotation',
+ elementType: {
+ type: 'ObjectTypeAnnotation',
+ properties: [
+ {
+ name: 'lat',
+ optional: false,
+ typeAnnotation: {
+ type: 'DoubleTypeAnnotation',
+ },
+ },
+ {
+ name: 'lon',
+ optional: false,
+ typeAnnotation: {
+ type: 'DoubleTypeAnnotation',
+ },
+ },
+ {
+ name: 'names',
+ optional: false,
+ typeAnnotation: {
+ type: 'ArrayTypeAnnotation',
+ elementType: {
+ type: 'StringTypeAnnotation',
+ },
+ },
+ },
+ ],
+ },
+ },
+ },
+ {
+ name: 'array_mixed_event_prop',
+ optional: false,
+ typeAnnotation: {
+ type: 'ArrayTypeAnnotation',
+ elementType: {
+ type: 'MixedTypeAnnotation',
+ },
+ },
+ },
+ ],
+ },
+ },
+ },
{
name: 'onEventDirect',
optional: true,
diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap
index 68fc88ff7a1818..2ec6051506eab0 100644
--- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap
+++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap
@@ -264,6 +264,70 @@ $payload.setProperty(runtime, \\"scale\\", $event.scale);
}
+void EventsNativeComponentEventEmitter::onArrayEventType(OnArrayEventType $event) const {
+ dispatchEvent(\\"arrayEventType\\", [$event=std::move($event)](jsi::Runtime &runtime) {
+ auto $payload = jsi::Object(runtime);
+
+ auto bool_array_event_prop = jsi::Array(runtime, $event.bool_array_event_prop.size());
+ size_t bool_array_event_propIndex = 0;
+ for (auto bool_array_event_propValue : $event.bool_array_event_prop) {
+ bool_array_event_prop.setValueAtIndex(runtime, bool_array_event_propIndex++, (bool)bool_array_event_propValue);
+ }
+ $payload.setProperty(runtime, \\"bool_array_event_prop\\", bool_array_event_prop);
+
+
+ auto string_enum_event_prop = jsi::Array(runtime, $event.string_enum_event_prop.size());
+ size_t string_enum_event_propIndex = 0;
+ for (auto string_enum_event_propValue : $event.string_enum_event_prop) {
+ string_enum_event_prop.setValueAtIndex(runtime, string_enum_event_propIndex++, toString(string_enum_event_propValue));
+ }
+ $payload.setProperty(runtime, \\"string_enum_event_prop\\", string_enum_event_prop);
+
+
+ auto array_array_event_prop = jsi::Array(runtime, $event.array_array_event_prop.size());
+ size_t array_array_event_propIndex = 0;
+ for (auto array_array_event_propValue : $event.array_array_event_prop) {
+ auto array_array_event_propArray = jsi::Array(runtime, array_array_event_propValue.size());
+ size_t array_array_event_propIndexInternal = 0;
+ for (auto array_array_event_propValueInternal : array_array_event_propValue) {
+ array_array_event_propArray.setValueAtIndex(runtime, array_array_event_propIndexInternal++, array_array_event_propValueInternal);
+ }
+ array_array_event_prop.setValueAtIndex(runtime, array_array_event_propIndex++, array_array_event_propArray);
+ }
+ $payload.setProperty(runtime, \\"array_array_event_prop\\", array_array_event_prop);
+
+
+ auto array_object_event_prop = jsi::Array(runtime, $event.array_object_event_prop.size());
+ size_t array_object_event_propIndex = 0;
+ for (auto array_object_event_propValue : $event.array_object_event_prop) {
+ auto array_object_event_propObject = jsi::Object(runtime);
+ array_object_event_propObject.setProperty(runtime, \\"lat\\", array_object_event_propValue.lat);
+array_object_event_propObject.setProperty(runtime, \\"lon\\", array_object_event_propValue.lon);
+
+ auto names = jsi::Array(runtime, array_object_event_propValue.names.size());
+ size_t namesIndex = 0;
+ for (auto namesValue : array_object_event_propValue.names) {
+ names.setValueAtIndex(runtime, namesIndex++, namesValue);
+ }
+ array_object_event_propObject.setProperty(runtime, \\"names\\", names);
+
+ array_object_event_prop.setValueAtIndex(runtime, array_object_event_propIndex++, array_object_event_propObject);
+ }
+ $payload.setProperty(runtime, \\"array_object_event_prop\\", array_object_event_prop);
+
+
+ auto array_mixed_event_prop = jsi::Array(runtime, $event.array_mixed_event_prop.size());
+ size_t array_mixed_event_propIndex = 0;
+ for (auto array_mixed_event_propValue : $event.array_mixed_event_prop) {
+ array_mixed_event_prop.setValueAtIndex(runtime, array_mixed_event_propIndex++, jsi::valueFromDynamic(runtime, array_mixed_event_propValue));
+ }
+ $payload.setProperty(runtime, \\"array_mixed_event_prop\\", array_mixed_event_prop);
+
+ return $payload;
+ });
+}
+
+
void EventsNativeComponentEventEmitter::onEventDirect(OnEventDirect $event) const {
dispatchEvent(\\"eventDirect\\", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap
index e3f05af240c2d9..ca4237ab4d7474 100644
--- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap
+++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap
@@ -14,12 +14,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ArrayPropsNativeComponentEventEmitter : public ViewEventEmitter {
+class ArrayPropsNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -46,12 +45,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ArrayPropsNativeComponentEventEmitter : public ViewEventEmitter {
+class ArrayPropsNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -78,12 +76,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT BooleanPropNativeComponentEventEmitter : public ViewEventEmitter {
+class BooleanPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -110,12 +107,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ColorPropNativeComponentEventEmitter : public ViewEventEmitter {
+class ColorPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -142,12 +138,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT CommandNativeComponentEventEmitter : public ViewEventEmitter {
+class CommandNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -174,12 +169,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT CommandNativeComponentEventEmitter : public ViewEventEmitter {
+class CommandNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -206,12 +200,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT DimensionPropNativeComponentEventEmitter : public ViewEventEmitter {
+class DimensionPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -238,12 +231,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT DoublePropNativeComponentEventEmitter : public ViewEventEmitter {
+class DoublePropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -270,12 +262,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT EventsNestedObjectNativeComponentEventEmitter : public ViewEventEmitter {
+class EventsNestedObjectNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -314,12 +305,11 @@ Map {
#pragma once
#include
-#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT EventsNativeComponentEventEmitter : public ViewEventEmitter {
+class EventsNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -330,6 +320,32 @@ class JSI_EXPORT EventsNativeComponentEventEmitter : public ViewEventEmitter {
Float scale;
};
+ enum class OnArrayEventTypeString_enum_event_prop {
+ YES,
+ NO
+ };
+
+ static char const *toString(const OnArrayEventTypeString_enum_event_prop value) {
+ switch (value) {
+ case OnArrayEventTypeString_enum_event_prop::YES: return \\"YES\\";
+ case OnArrayEventTypeString_enum_event_prop::NO: return \\"NO\\";
+ }
+ }
+
+ struct OnArrayEventTypeArray_object_event_prop {
+ double lat;
+ double lon;
+ std::vector names;
+ };
+
+ struct OnArrayEventType {
+ std::vector bool_array_event_prop;
+ std::vector string_enum_event_prop;
+ std::vector> array_array_event_prop;
+ std::vector array_object_event_prop;
+ std::vector array_mixed_event_prop;
+ };
+
struct OnEventDirect {
bool value;
};
@@ -355,6 +371,8 @@ class JSI_EXPORT EventsNativeComponentEventEmitter : public ViewEventEmitter {
};
void onChange(OnChange value) const;
+ void onArrayEventType(OnArrayEventType value) const;
+
void onEventDirect(OnEventDirect value) const;
void onOrientationChange(OnOrientationChange value) const;
@@ -383,12 +401,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT InterfaceOnlyComponentEventEmitter : public ViewEventEmitter {
+class InterfaceOnlyComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -423,12 +440,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ExcludedAndroidComponentEventEmitter : public ViewEventEmitter {
+class ExcludedAndroidComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -455,12 +471,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ExcludedAndroidIosComponentEventEmitter : public ViewEventEmitter {
+class ExcludedAndroidIosComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -487,19 +502,18 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ExcludedIosComponentEventEmitter : public ViewEventEmitter {
+class ExcludedIosComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
-class JSI_EXPORT MultiFileIncludedNativeComponentEventEmitter : public ViewEventEmitter {
+class MultiFileIncludedNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -526,12 +540,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT FloatPropNativeComponentEventEmitter : public ViewEventEmitter {
+class FloatPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -558,12 +571,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ImagePropNativeComponentEventEmitter : public ViewEventEmitter {
+class ImagePropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -590,12 +602,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT InsetsPropNativeComponentEventEmitter : public ViewEventEmitter {
+class InsetsPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -622,12 +633,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT Int32EnumPropsNativeComponentEventEmitter : public ViewEventEmitter {
+class Int32EnumPropsNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -654,12 +664,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT IntegerPropNativeComponentEventEmitter : public ViewEventEmitter {
+class IntegerPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -686,12 +695,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT InterfaceOnlyComponentEventEmitter : public ViewEventEmitter {
+class InterfaceOnlyComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -720,12 +728,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT MixedPropNativeComponentEventEmitter : public ViewEventEmitter {
+class MixedPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -752,12 +759,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ImageColorPropNativeComponentEventEmitter : public ViewEventEmitter {
+class ImageColorPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -784,12 +790,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT NoPropsNoEventsComponentEventEmitter : public ViewEventEmitter {
+class NoPropsNoEventsComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -816,12 +821,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT ObjectPropsEventEmitter : public ViewEventEmitter {
+class ObjectPropsEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -848,12 +852,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT PointPropNativeComponentEventEmitter : public ViewEventEmitter {
+class PointPropNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -880,12 +883,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT StringEnumPropsNativeComponentEventEmitter : public ViewEventEmitter {
+class StringEnumPropsNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -912,12 +914,11 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT StringPropComponentEventEmitter : public ViewEventEmitter {
+class StringPropComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -944,19 +945,18 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT MultiFile1NativeComponentEventEmitter : public ViewEventEmitter {
+class MultiFile1NativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
-class JSI_EXPORT MultiFile2NativeComponentEventEmitter : public ViewEventEmitter {
+class MultiFile2NativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
@@ -983,19 +983,18 @@ Map {
#pragma once
#include
-#include
namespace facebook {
namespace react {
-class JSI_EXPORT MultiComponent1NativeComponentEventEmitter : public ViewEventEmitter {
+class MultiComponent1NativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
-class JSI_EXPORT MultiComponent2NativeComponentEventEmitter : public ViewEventEmitter {
+class MultiComponent2NativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap
index 7260cdda760c1b..04a92df053eec9 100644
--- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap
+++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap
@@ -14,7 +14,6 @@ Map {
#pragma once
#include
-#include
#include
#include
#include
@@ -193,7 +192,7 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
}
}
-class JSI_EXPORT ArrayPropsNativeComponentProps final : public ViewProps {
+class ArrayPropsNativeComponentProps final : public ViewProps {
public:
ArrayPropsNativeComponentProps() = default;
ArrayPropsNativeComponentProps(const PropsParserContext& context, const ArrayPropsNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -233,7 +232,6 @@ Map {
*/
#pragma once
-#include
#include
#include
#include
@@ -282,7 +280,7 @@ static inline void fromRawValue(const PropsParserContext& context, const RawValu
}
}
-class JSI_EXPORT ArrayPropsNativeComponentProps final : public ViewProps {
+class ArrayPropsNativeComponentProps final : public ViewProps {
public:
ArrayPropsNativeComponentProps() = default;
ArrayPropsNativeComponentProps(const PropsParserContext& context, const ArrayPropsNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -311,14 +309,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT BooleanPropNativeComponentProps final : public ViewProps {
+class BooleanPropNativeComponentProps final : public ViewProps {
public:
BooleanPropNativeComponentProps() = default;
BooleanPropNativeComponentProps(const PropsParserContext& context, const BooleanPropNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -347,7 +344,6 @@ Map {
*/
#pragma once
-#include
#include
#include
#include
@@ -355,7 +351,7 @@ Map {
namespace facebook {
namespace react {
-class JSI_EXPORT ColorPropNativeComponentProps final : public ViewProps {
+class ColorPropNativeComponentProps final : public ViewProps {
public:
ColorPropNativeComponentProps() = default;
ColorPropNativeComponentProps(const PropsParserContext& context, const ColorPropNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -384,14 +380,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT CommandNativeComponentProps final : public ViewProps {
+class CommandNativeComponentProps final : public ViewProps {
public:
CommandNativeComponentProps() = default;
CommandNativeComponentProps(const PropsParserContext& context, const CommandNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -420,14 +415,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT CommandNativeComponentProps final : public ViewProps {
+class CommandNativeComponentProps final : public ViewProps {
public:
CommandNativeComponentProps() = default;
CommandNativeComponentProps(const PropsParserContext& context, const CommandNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -456,7 +450,6 @@ Map {
*/
#pragma once
-#include
#include
#include
#include
@@ -464,7 +457,7 @@ Map {
namespace facebook {
namespace react {
-class JSI_EXPORT DimensionPropNativeComponentProps final : public ViewProps {
+class DimensionPropNativeComponentProps final : public ViewProps {
public:
DimensionPropNativeComponentProps() = default;
DimensionPropNativeComponentProps(const PropsParserContext& context, const DimensionPropNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -493,14 +486,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT DoublePropNativeComponentProps final : public ViewProps {
+class DoublePropNativeComponentProps final : public ViewProps {
public:
DoublePropNativeComponentProps() = default;
DoublePropNativeComponentProps(const PropsParserContext& context, const DoublePropNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -534,14 +526,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT EventsNestedObjectNativeComponentProps final : public ViewProps {
+class EventsNestedObjectNativeComponentProps final : public ViewProps {
public:
EventsNestedObjectNativeComponentProps() = default;
EventsNestedObjectNativeComponentProps(const PropsParserContext& context, const EventsNestedObjectNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -570,14 +561,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT EventsNativeComponentProps final : public ViewProps {
+class EventsNativeComponentProps final : public ViewProps {
public:
EventsNativeComponentProps() = default;
EventsNativeComponentProps(const PropsParserContext& context, const EventsNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -606,14 +596,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT InterfaceOnlyComponentProps final : public ViewProps {
+class InterfaceOnlyComponentProps final : public ViewProps {
public:
InterfaceOnlyComponentProps() = default;
InterfaceOnlyComponentProps(const PropsParserContext& context, const InterfaceOnlyComponentProps &sourceProps, const RawProps &rawProps);
@@ -642,14 +631,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT ExcludedAndroidComponentProps final : public ViewProps {
+class ExcludedAndroidComponentProps final : public ViewProps {
public:
ExcludedAndroidComponentProps() = default;
ExcludedAndroidComponentProps(const PropsParserContext& context, const ExcludedAndroidComponentProps &sourceProps, const RawProps &rawProps);
@@ -678,14 +666,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT ExcludedAndroidIosComponentProps final : public ViewProps {
+class ExcludedAndroidIosComponentProps final : public ViewProps {
public:
ExcludedAndroidIosComponentProps() = default;
ExcludedAndroidIosComponentProps(const PropsParserContext& context, const ExcludedAndroidIosComponentProps &sourceProps, const RawProps &rawProps);
@@ -714,14 +701,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT ExcludedIosComponentProps final : public ViewProps {
+class ExcludedIosComponentProps final : public ViewProps {
public:
ExcludedIosComponentProps() = default;
ExcludedIosComponentProps(const PropsParserContext& context, const ExcludedIosComponentProps &sourceProps, const RawProps &rawProps);
@@ -731,7 +717,7 @@ class JSI_EXPORT ExcludedIosComponentProps final : public ViewProps {
};
-class JSI_EXPORT MultiFileIncludedNativeComponentProps final : public ViewProps {
+class MultiFileIncludedNativeComponentProps final : public ViewProps {
public:
MultiFileIncludedNativeComponentProps() = default;
MultiFileIncludedNativeComponentProps(const PropsParserContext& context, const MultiFileIncludedNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -760,14 +746,13 @@ Map {
*/
#pragma once
-#include
#include
#include
namespace facebook {
namespace react {
-class JSI_EXPORT FloatPropNativeComponentProps final : public ViewProps {
+class FloatPropNativeComponentProps final : public ViewProps {
public:
FloatPropNativeComponentProps() = default;
FloatPropNativeComponentProps(const PropsParserContext& context, const FloatPropNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -801,7 +786,6 @@ Map {
*/
#pragma once
-#include
#include
#include
#include
@@ -809,7 +793,7 @@ Map {
namespace facebook {
namespace react {
-class JSI_EXPORT ImagePropNativeComponentProps final : public ViewProps {
+class ImagePropNativeComponentProps final : public ViewProps {
public:
ImagePropNativeComponentProps() = default;
ImagePropNativeComponentProps(const PropsParserContext& context, const ImagePropNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -838,7 +822,6 @@ Map {
*/
#pragma once
-#include
#include
#include
#include
@@ -846,7 +829,7 @@ Map {
namespace facebook {
namespace react {
-class JSI_EXPORT InsetsPropNativeComponentProps final : public ViewProps {
+class InsetsPropNativeComponentProps final : public ViewProps {
public:
InsetsPropNativeComponentProps() = default;
InsetsPropNativeComponentProps(const PropsParserContext& context, const InsetsPropNativeComponentProps &sourceProps, const RawProps &rawProps);
@@ -875,7 +858,6 @@ Map {
*/
#pragma once
-#include
#include
#include